private void transferbutton_Click(object sender, EventArgs e)
{
if(!transferbutton.Enabled) return;
for(int i = 0; i < allitems.TotalCount; i++)
{
if(itemselected[i])
{
string filepathname = allitems[i].filepathname;
FileInfo fi = new FileInfo(filepathname);
if(fi.Length < 100000000)
{
// Determine mime type from file extension
string mimetype = "application/unknown";
string ext = allitems[i].extension.ToLower();
RegistryKey regkey = Registry.ClassesRoot.OpenSubKey(ext);
if(regkey != null && regkey.GetValue("Content Type") != null)
mimetype = regkey.GetValue("Content Type").ToString();
// Load the file in memory and queue for sending
byte[] data = File.ReadAllBytes(filepathname);
ObexTransferObject obj = new ObexTransferObject(data);
obj.Filename = allitems[i].filename;
obj.MimeType = mimetype;
General.MainWindow.ObexTransferPanel.TransferSingleObject(obj);
General.MainWindow.ObexTransferPanel.ReturnPanel = "librarybrowser";
General.MainWindow.ShowTaggedPanel("transferobex");
}
else
{
General.Sounds.Play("error");
}
}
}
}