public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var folderControl = new FolderControl();

            AddChildViewController(folderControl);
            FolderView.AddSubview(folderControl.View);

            var mailControl = new MailControl();

            AddChildViewController(mailControl);
            MailView.AddSubview(mailControl.View);

            var source = new MvxSimpleTableViewSource(FoldersTable, FolderCellTemplate.Key, FolderCellTemplate.Key);

            FoldersTable.Source = source;

            var set = this.CreateBindingSet <FoldersView, FoldersViewModel>();

            set.Bind(source).To(vm => vm.Folders);
            set.Bind(source).For(s => s.SelectedItem).To(vm => vm.SelectedFolder);
            set.Apply();

            this.Title = "MailApp";

            //As the folder is also showed on this view, we don't wait for the user to select one
            ((FoldersViewModel)ViewModel).SelectedFolder = ((FoldersViewModel)ViewModel).Folders.FirstOrDefault();
        }
Ejemplo n.º 2
0
            Microsoft.Office.Tools.Outlook.IFormRegion Microsoft.Office.Tools.Outlook.IFormRegionFactory.CreateFormRegion(Microsoft.Office.Interop.Outlook.FormRegion formRegion)
            {
                MailView form = new MailView(formRegion);

                form.Factory = this;
                return(form);
            }
Ejemplo n.º 3
0
        public async Task SetMailView(ISourceInfo source)
        {
            MailView.Source = source;
            if (source == null || source.AccountSource == null)
            {
                MailView.Reset();
                MailView.CanSend = mSendAccounts.Count > 0;
                return;
            }

            await((Account)source.AccountSource).LoadMailView(source.LabelSource);
        }
Ejemplo n.º 4
0
        //  _mailViewForm.SomeEvent += new EventHandler(this.HandleSomeEvent);
        //public void HandleSomeEvent(object sender, EventArgs e)
        //{
        //}

        private void PopUpMail()
        {
            if (MailTab_Inbox)
            {
                if (gridviewMails.SelectedRows.Count > 0)
                {
                    string FromMail = gridviewMails.SelectedRows[0].Cells["ColFrom"].Value.ToString();
                    string Subject  = gridviewMails.SelectedRows[0].Cells["ColSubject"].Value.ToString();
                    string Msg      = gridviewMails.SelectedRows[0].Cells["ColMsg"].Value.ToString();
                    int    MsgId    = (int)gridviewMails.SelectedRows[0].Cells["ColMsgId"].Value;
                    string FileName = gridviewMails.SelectedRows[0].Cells["ColFileName"].Value.ToString();
                    MakeMailAsRead();
                    MailView _mailViewForm = new MailView(MsgId, false, FromMail, Subject, Msg, FileName, false);
                    _mailViewForm.ShowDialog();
                    LoadInboxMails();
                }
            }
            else if (MailTab_Draft)
            {
                if (gridviewMails.SelectedRows.Count > 0)
                {
                    string      FromMail     = gridviewMails.SelectedRows[0].Cells["ColTo"].Value.ToString();
                    string      Subject      = gridviewMails.SelectedRows[0].Cells["ColSubject"].Value.ToString();
                    string      Msg          = gridviewMails.SelectedRows[0].Cells["ColMsg"].Value.ToString();
                    int         MsgId        = (int)gridviewMails.SelectedRows[0].Cells["ColMsgId"].Value;
                    ComposeMail _composeMail = new ComposeMail(ComposeMail.Mailtype.DraftMail, FromMail, Subject, Msg, MsgId);
                    _composeMail.ShowDialog();
                }
            }
            else if (MailTab_SentMails)
            {
                if (gridviewMails.SelectedRows.Count > 0)
                {
                    string   FromMail      = gridviewMails.SelectedRows[0].Cells["ColTo"].Value.ToString();
                    string   Subject       = gridviewMails.SelectedRows[0].Cells["ColSubject"].Value.ToString();
                    string   Msg           = gridviewMails.SelectedRows[0].Cells["ColMsg"].Value.ToString();
                    int      MsgId         = (int)gridviewMails.SelectedRows[0].Cells["ColMsgId"].Value;
                    string   FileName      = gridviewMails.SelectedRows[0].Cells["ColFileName"].Value.ToString();
                    MailView _mailViewForm = new MailView(MsgId, true, FromMail, Subject, Msg, FileName, false);
                    _mailViewForm.ShowDialog();
                    LoadSentMails();
                }
            }
            else if (MailTab_Recycle)
            {
                this.Size = new System.Drawing.Size(1202, 757);
            }
        }
Ejemplo n.º 5
0
    /// <summary>
    /// 初始化邮件
    /// </summary>
    /// <param name="_mailData"></param>
    public void Init(List <MailDatas> _mailData)
    {
        //if (_mailData.Count > 3)
        //{
        //    show_trf.GetComponent<RectTransform>().offsetMin = new Vector2(0, -(_mailData.Count - 3) * 150);
        //    show_trf.GetComponent<RectTransform>().offsetMax = new Vector2(0, 0);
        //}
        //else
        //{
        //    show_trf.GetComponent<RectTransform>().offsetMin = new Vector2(0, 0);
        //    show_trf.GetComponent<RectTransform>().offsetMax = new Vector2(0, 0);
        //}

        if (_mailData.Count > 0)
        {
            for (int idx = 0; idx < _mailData.Count; idx++)
            {
                if (_mailData.Count > MailList.Count)
                {
                    MailView mailView = InitItemInfo(Mail, show_trf).GetComponent <MailView>();
                    mailView.Init();
                    MailList.Add(mailView);
                    // Found(_mailData[idx]);
                }
                //else
                //{
                //    for (int idx1 = 0; idx1 < MailList.Count; idx1++)
                //    {

                //        if (idx1 >= _mailData.Count)
                //        {
                //            MailList[idx1].gameObject.SetActive(false);
                //            MailList[idx1].Close();
                //        }
                //        else
                //        {
                //            MailList[idx1].gameObject.SetActive(true);
                //        }
                //    }
                //    return;
                //}
            }
            totala_tog.isOn = true;
            GetMail(MailTyper.zero);
        }
    }
Ejemplo n.º 6
0
        public void speechRecognitionWithDictationGrammar_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            SpeechSynthesizer synth = new SpeechSynthesizer();

            synth.SetOutputToDefaultAudioDevice();

            // MessageBox.Show(string.Format("you just told {0}",e.Result.Text));
            if (e.Result.Text.Trim().Contains("compose mail") ||
                e.Result.Text.Trim().Contains("Open compose Window") ||
                e.Result.Text.Trim().Contains("Open compose Window"))
            {
                ComposeMail composeMail = new ComposeMail(SpeechToText.ComposeMail.Mailtype.ComposeMail, "", "", "", 0);
                composeMail.ShowDialog();
                //DoAction(e.Result.Text);
            }
            else if (e.Result.Text.Trim().Contains("ok vmail can you read"))
            {
                DoAction(e.Result.Text);
            }
            else if (e.Result.Text.Trim().Contains("Open the draft"))
            {
                // DraftMailLoad();
            }
            else if (e.Result.Text.ToLower().Contains("Reply to this mail".ToLower()))
            {
                if (ChooseMail)
                {
                    MailView _mailViewForm = new MailView(FilterMail.MsgId, false, FilterMail.FromEmailId, FilterMail.Subject, FilterMail.Message, FilterMail.FileName, true);
                    _mailViewForm.Show();
                }
                else
                {
                    synth.Speak("Please read a mail before reply");
                }
            }
            else if (e.Result.Text.Trim().Contains("signout") || e.Result.Text.Trim().Contains("seven"))
            {
                Signout();
            }
            else
            {
                txtSearch.Text = e.Result.Text;
            }
        }
Ejemplo n.º 7
0
        private async Task DeleteMailAsync(IEnumerable <ViewMailItem> items)
        {
            foreach (var i in items)
            {
                if (i.Draft != null)
                {
                    DraftMessageSource draft = i.Draft as DraftMessageSource;
                    await DeleteDraft(draft);

                    continue;
                }
                var account = i.Source.AccountSource as Account;

                await account.DeleteMail(i);
            }


            MailView.UpdateWorkingItems(items);
        }
Ejemplo n.º 8
0
        async Task SaveMailMetaDataAsync(IEnumerable <ViewMailItem> items)
        {
            foreach (var item in items)
            {
                Account account = item.Source.AccountSource as Account;
                if (!await account.SaveMailMetaData(item))
                {
                    item.RollbackChanges();
                }
                else
                {
                    account.UpdateAccountCounts(item);
                    item.ClearChanges();
                }
            }

            MailView.UpdateWorkingItems(items);
            //await UpdateAccountAsync(account, true);
        }
Ejemplo n.º 9
0
        private async Task <bool> LoadDrafts(MailView view)
        {
            view.CanDelete   = view.CanSend = DBAccount.Permissions.HasFlag(Auth.AccessFlag.MailSend);
            view.CanDownload = false;

            view.IsDraft = true;

            List <MailRecipient> recipients = new List <MailRecipient>();

            foreach (var i in mClient.GetDraftsForAccount(this))
            {
                ViewMailItem item = new ViewMailItem(-1, true);
                item.Draft       = i;
                item.MailSubject = i.Subject;
                item.Body        = i.Body;
                item.Timestamp   = i.LastModified;
                item.From        = new MailRecipient(EntityType.Character, DBAccount.CharacterId);
                await mClient.AddLookupAsync(item.From);

                recipients.Clear();

                foreach (var j in i.Recipients)
                {
                    MailRecipient recipient = new MailRecipient(j.EntityType, j.EntityID);
                    await mClient.AddLookupAsync(recipient);

                    recipients.Add(recipient);
                }

                item.Recipients = recipients.ToArray();
                item.Source     = view.Source;
                view.MailItems.Add(item);
            }

            await mClient.FinishLookupsAsync();

            view.HasItems  = true;
            view.IsLoading = false;

            return(true);
        }
Ejemplo n.º 10
0
    public void OpenMail(MailView _mail)
    {
        if (MailList.Count == 0)
        {
            return;
        }
        Close(true, null);
        for (int idx = 0; idx < PostBoxMgr.Instance.MailData.Count; idx++)
        {
            if (PostBoxMgr.Instance.MailData[idx].mail_id == _mail.MailId)
            {
                MailWardName_txt.text    = PostBoxMgr.Instance.MailData[idx].mailname;
                MailWardContent_txt.text = PostBoxMgr.Instance.MailData[idx].content;
                Addresser_txt.text       = PostBoxMgr.Instance.MailData[idx].addresser;
                if (PostBoxMgr.Instance.MailData[idx].mailitem.Count > 0)
                {
                    Found(PostBoxMgr.Instance.MailData[idx].mail_id, PostBoxMgr.Instance.MailData[idx].mailitem);
                    Adjunct_obj.SetActive(true);
                    Get_btn.gameObject.SetActive(true);
                    Draw_btn.gameObject.SetActive(false);
                    deletea_btn.gameObject.SetActive(false);
                }
                else
                {
                    deletea_btn.gameObject.SetActive(true);
                    Draw_btn.gameObject.SetActive(true);
                    Get_btn.gameObject.SetActive(false);
                    _mail.Shade.SetActive(true);
                    _mail.RedDot.SetActive(false);
                    Adjunct_obj.SetActive(false);
                    InitMail(0, MailWardContent_txt);
                    PostBoxMgr.Instance.MailData[idx].isRead = -1;
                }

                MailaWard_btn.gameObject.SetActive(true);
                ZEventSystem.Dispatch(EventConst.OnMailItemIncident, true, PostBoxMgr.Instance.MailData[idx]);
            }
        }
    }
Ejemplo n.º 11
0
        private async void OpenAsPdfButton_Click(object sender, RoutedEventArgs e)
        {
            string printheader =
                "<b>FROM:</b> " + HttpUtility.HtmlEncode(message.From.ToString()) + "</br>" +
                "<b>DATE:</b> " + HttpUtility.HtmlEncode(message.Date.ToString()) + "</br>" +
                "<b>TO:</b> " + HttpUtility.HtmlEncode(message.To.ToString()) + "</br>" +
                "<b>CC:</b> " + HttpUtility.HtmlEncode(message.Cc.ToString()) + "</br>" +
                "<b>SUBJECT:</b> " + HttpUtility.HtmlEncode(message.Subject.ToString()) + "</br>" +
                " </br>";

            Progress.IsActive         = true;
            OpenAsPdfButton.IsEnabled = false;

            await MailView.EnsureCoreWebView2Async();

            try
            {
                // Insert header
                await MailView.ExecuteScriptAsync($"document.getElementById(\"emlReaderPrintHeader\").innerHTML = \"{printheader}\";");

                // Get header height
                var _height = await MailView.ExecuteScriptAsync("(function(){var h = document.getElementById(\"emlReaderPrintHeader\").clientHeight; return h;})()");

                double height;
                _ = double.TryParse(_height, out height);
                // Set margin of webview
                MailView.Margin = new Thickness(28, 0 - height, 28, 0);

                // Print PDF document to temp folder
                string temppath = $"{ApplicationData.Current.TemporaryFolder.Path}\\{this.filename}.pdf";
                bool   success  = await MailView.CoreWebView2.PrintToPdfAsync(temppath, default);

                // Load temp file as StorageFile
                StorageFile tempfile = await StorageFile.GetFileFromPathAsync(temppath);

                if (success && tempfile != null)
                {
                    // Launch the retrieved file
                    _ = await Launcher.LaunchFileAsync(tempfile);
                }
                else
                {
                    NotificationBar.IsOpen = true;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                NotificationBar.IsOpen = true;
            }
            finally
            {
                // Remove header
                await MailView.ExecuteScriptAsync($"document.getElementById(\"emlReaderPrintHeader\").innerHTML = \"\";");

                // Reset margin of webview
                MailView.Margin = new Thickness(28, 12, 28, 0);

                Progress.IsActive         = false;
                OpenAsPdfButton.IsEnabled = true;
            }
        }
Ejemplo n.º 12
0
        private void ForwardSelectedMessage()
        {
            try
            {
                // create a new mail message
                Outlook.MailItem ForwardingMessage = (Outlook.MailItem) this.Application.CreateItem(Outlook.OlItemType.olMailItem);
                // In case you want to implement the custom outlook form you have use following commented 2 lines of code
                //Outlook.MAPIFolder templateFolder = this.Application.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
                //ForwardingMessage = (Outlook.MailItem)templateFolder.Items.Add("IPM.Note.OutlookCustomForm1");

                // get the currently selected message (the message on which the user right-clicked)
                Outlook.MailItem SelectedMessage;
                SelectedMessage = (Outlook.MailItem) this.Application.ActiveExplorer().Selection[1];
                var cf = this.Application.ActiveExplorer().CurrentFolder;
                Console.WriteLine(cf.Name);
                var n = this.Application.ActiveExplorer().CurrentFolder.Name;
                Console.WriteLine(n);
                //using (var f = new SelectContact(SelectedMessage))
                //{
                //    f.ShowDialog();

                //}

                var x = new MailView(SelectedMessage);
                x.ShowDialog();


                return;


                if (SelectedMessage != null)
                {
                    if (ForwardingMessage != null)
                    {
                        //Subject
                        ForwardingMessage.Subject = "FW: " + SelectedMessage.Subject;

                        #region Attahment
                        // Get the count of Attachments
                        int attachCount = SelectedMessage.Attachments.Count;
                        if (attachCount > 0)
                        {
                            // loop through each attachment
                            for (int idx = 1; idx <= attachCount; idx++)
                            {
                                string sysPath = System.IO.Path.GetTempPath();

                                if (!System.IO.Directory.Exists(sysPath + "~test"))
                                {
                                    System.IO.Directory.CreateDirectory(sysPath + "~test");
                                }

                                // get attached file and save in temp folder
                                string strSourceFileName = sysPath + "~test\\" + SelectedMessage.Attachments[idx].FileName;
                                SelectedMessage.Attachments[idx].SaveAsFile(strSourceFileName);
                                string strDisplayName = "Attachment";
                                int    intPosition    = 1;
                                int    intAttachType  = (int)Outlook.OlAttachmentType.olEmbeddeditem;

                                // Add the current attachment
                                ForwardingMessage.Attachments.Add(strSourceFileName, intAttachType, intPosition, strDisplayName);
                            }
                        }
                        #endregion

                        #region Body

                        string strHeader = "<p><br><br>" + "-----Original Message-----" + "<br>";
                        strHeader += "From: " + SelectedMessage.SenderName + "<br>";
                        strHeader += "Sent: " + SelectedMessage.SentOn.ToString() + "<br>";
                        strHeader += "To: " + SelectedMessage.To + "<br>";
                        strHeader += "Subject: " + SelectedMessage.Subject + "<br><br>";

                        ForwardingMessage.HTMLBody = strHeader + GetTrimmedBodyText(SelectedMessage.HTMLBody);

                        #endregion

                        ForwardingMessage.Display(false);
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.ToLower().StartsWith("unable to cast com object"))
                {
                    MessageBox.Show("This is not a valid message and it can not be sent.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("ForwardSelectedMessage - " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        public ActionResult SendMail(MailView data)
        {
            bool sonuc = new MailSender().SendEmail(data);

            return(Json(sonuc, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 14
0
 public MailViewFactory()
 {
     this._Manifest = Globals.Factory.CreateFormRegionManifest();
     MailView.InitializeManifest(this._Manifest, Globals.Factory);
     this.FormRegionInitializing += new Microsoft.Office.Tools.Outlook.FormRegionInitializingEventHandler(this.MailViewFactory_FormRegionInitializing);
 }