Beispiel #1
0
        private void SaveToDB()
        {
            if (allMail.Count <= 0)
                return;
            try
            {
                IContentManage MailContentMng = new ContentManage();
                IAttachmentManage MailAttachMng = new AttachmentManage();
                int mailId;
                int mailCount = hmail.MailCount - currMailCount;
                allMail.ToList().ForEach(s =>
                {
                    mailId = MailMng.CreateMail(HMConvert.ConvertMailEntity.ConvertToDbMailEntity((int)AppMain.currUser.Id, s));
                    HMConvert.ConvertMailEntity.ConvertToDbContentEntity(mailId, s).ToList().ForEach(v =>
                    {
                        MailContentMng.CreateContent(v);
                    });
                    HMConvert.ConvertMailEntity.ConvertToDbAttachEntity(mailId, s).ToList().ForEach(n =>
                    {
                        MailAttachMng.CreateAttactment(n);
                    });
                    this.Invoke(new MethodInvoker(() =>
                    {
                        this.progressBar1.Value--;
                        TestLaber.Text = mailCount.ToString();
                        mailCount--;
                    }));
                });

            }
            catch (Exception e)
            {
                AppLog.SysLog(e.ToString());
            }
        }
Beispiel #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            base._SetLanguage(this);
            HXMail.App_Code.HotKey.RegisterHotKey(this.Handle, 100100, App_Code.HotKey.KeyModifiers.Ctrl, Keys.X);
            this.listBox1.ItemHeight = 30;
            this.listBox1.Font = new Font(new FontFamily("宋体"), 10);
            IContentManage contentMng = new ContentManage();
            StringBuilder sb = new StringBuilder();
            this.listBox1.Click += new EventHandler((object obj, EventArgs ev) =>
            {
                IList<ContentInfo> all = contentMng.GetByMailId((int)allMail[this.listBox1.SelectedIndex].Id);
                foreach (ContentInfo v in all)
                {
                    sb.Append(v.Content);
                }

                try
                {
                    webBrowser1.Document.InvokeScript("removeEditor");
                    webBrowser1.Document.Body.Style = string.Format("height:{1};width:{0}", webBrowser1.Width, webBrowser1.Height);
                    webBrowser1.Document.GetElementById("content").Style = string.Format("height:{1};width:{0}", webBrowser1.Width, webBrowser1.Height);
                    webBrowser1.Document.GetElementById("content").SetAttribute("value", sb.ToString());
                    webBrowser1.Document.InvokeScript("showEditor");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                sb.Clear();
            });
            this.listView1.DoubleClick += new EventHandler((object obj, EventArgs ex) =>
            {
                currUser = allUser[((ListView)obj).SelectedItems[0].Index];

                this.listBox1.Items.Clear();
                thread1 = new System.Threading.Thread(new System.Threading.ThreadStart(() =>
                {
                    LoadMail();
                }));

                thread1.Start();
            });
            LoadUser();
        }