private void menuItemEMail_Click(object sender, EventArgs e) { try { String name = "\n"; try { Byte[] ownerbytes = (byte[])Microsoft.Win32.Registry.CurrentUser.OpenSubKey("ControlPanel\\Owner").GetValue("Owner"); name += System.Text.Encoding.Unicode.GetString(ownerbytes, 0, 72).TrimEnd('\0'); } catch { name = ""; } EmailMessage email = new EmailMessage(); String message = this.con.getLanguageElement("Details.SMSMessage", "My personal TV hint:") + "\n"; message += this.con.getLanguageElement("Details.SMSMessageBroadcast", "Broadcast:") + " " + this.broadcast.getTitle() + "\n"; message += this.con.getLanguageElement("Details.SMSMessageTime", "Time:") + " " + this.broadcast.getStart().ToShortDateString() + " " + this.broadcast.getStart().ToShortTimeString() + "\n"; message += this.con.getLanguageElement("Details.SMSMessageChannel", "Channel:") + " " + this.broadcast.getChannel() + "\n"; message += this.con.getLanguageElement("Details.SMSMessageRegards", "Regards"); if (!name.Equals("")) { message += ", " + name; } email.BodyText = message; MessagingApplication.DisplayComposeForm(email); } catch { this.menuItemEMail.Enabled = false; } }
private void DoEmailMagic() { Host.Cursor = Cursors.WaitCursor; //check droppedboxx folder exists var dropfolder = new DirectoryInfo(Settings.Instance.TempDirectory); if (!dropfolder.Exists) { dropfolder.Create(); } var downloadFile = Form1.Instance.DropBox.GetFile(_selectedItem); if (downloadFile != null) { //Attach file var outlook = new OutlookSession(); var message = new EmailMessage(); message.Subject = "Sending File: " + _selectedItem.Name; message.Attachments.Add(new Attachment(downloadFile.LocalFileInfo.FullName)); MessagingApplication.DisplayComposeForm(message); outlook.Dispose(); Host.Cursor = Cursors.Default; } else { //show error...? Host.Cursor = Cursors.Default; MessageDialog.Show("File Download Failed!", null, "OK"); } }
private void OnCheckNowButtonClick(object sender, EventArgs e) { OutlookSession session = new OutlookSession(); MessagingApplication.Synchronize(); }
private void smsInterceptor_MessageReceived(object sender, MessageInterceptorEventArgs e) { try { // Increment the SMS count COUNT = COUNT + 1; SmsMessage sms = (SmsMessage)e.Message; // If Prompt is enabled if (dbManager.CanPrompt()) { string text = sms.Body; if (sms.Body.Length > 90) { text = sms.Body.Substring(0, 90) + " ..."; } if (MessageBox.Show("From : " + sms.From.Address + "\r\n" + "Text : " + text, "Forward via SMS to Email ?" + " (" + COUNT.ToString() + ")", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { // Forward the SMS message this.ForwardSms(sms); } } else { // Forward the SMS message this.ForwardSms(sms); } } catch (StackOverflowException) { } catch (Exception) { } finally { // Decrement the COUNT once an SMS has been processed COUNT = COUNT - 1; // If all pending SMS messages have been processed, dispose and close. if (COUNT <= 0) { // If we sent an SMS message if (this.bSent) { // Sync the Outbox now if we can if (this.dbManager.CanSynchronize()) { MessagingApplication.Synchronize(this.emailAccount); } } // Remove the MessageReceived event handler smsInterceptor.MessageReceived -= smsInterceptor_MessageReceived; // Dispose of the MessageInterceptor smsInterceptor.Dispose(); // Close and Exit this.Close(); } } }