Ejemplo n.º 1
0
 private void _form_ViewOrInspectMessagedClicked(object sender, MessageViewModel msg)
 {
     ViewOrInspectMessage(msg);
 }
Ejemplo n.º 2
0
 private void _form_InspectMessageClicked(object sender, MessageViewModel msg)
 {
     InspectMessage(msg);
 }
Ejemplo n.º 3
0
        private void OnMessageReceived(object sender, MessageEventArgs e)
        {
            lblFolder.Text = "Email Folder Path :" + ConfigurationManager.AppSettings["EmailFolderPath"];

            MessageViewModel message  = new MessageViewModel(e.Message);
            FileInfo         msgFile1 = new FileInfo(ConfigurationManager.AppSettings["EmailFolderPath"] + message.To + "_" + System.Guid.NewGuid() + ".eml");

            message.SaveToFile(msgFile1);

            int display = Convert.ToInt32(ConfigurationManager.AppSettings["EmailShowInGrid"]);

            if (display == 1)
            {
                TempFileCollection tempFiles = new TempFileCollection();
                FileInfo           msgFile   = new FileInfo(tempFiles.AddExtension("eml"));
                message.SaveToFile(msgFile);
                Invoke((MethodInvoker)(() =>
                {
                    _messages.Add(message);

                    if (Settings.Default.MaxMessages > 0)
                    {
                        while (_messages.Count > Settings.Default.MaxMessages)
                        {
                            _messages.RemoveAt(0);
                        }
                    }

                    if (Settings.Default.AutoViewNewMessages ||
                        Settings.Default.AutoInspectNewMessages)
                    {
                        if (Settings.Default.AutoViewNewMessages)
                        {
                            ViewMessage(message);
                        }

                        if (Settings.Default.AutoInspectNewMessages)
                        {
                            InspectMessage(message);
                        }
                    }
                    else if (!Visible && Settings.Default.BalloonNotifications)
                    {
                        string body =
                            string.Format(
                                "From: {0}\nTo: {1}\nSubject: {2}\n<Click here to view more details>",
                                message.From,
                                message.To,
                                message.Subject);

                        trayIcon.ShowBalloonTip(3000, "Message Recieved", body, ToolTipIcon.Info);
                    }

                    if (Visible && Settings.Default.BringToFrontOnNewMessage)
                    {
                        BringToFront();
                        Activate();
                    }
                }));
            }
        }