Example #1
0
 public POP3Ssl(EMailModal eMailModal)
 {
     base.EMailModal = eMailModal;
     base.POPServer = eMailModal.Server;
     base.User = eMailModal.MailID;
     base.Pwd = eMailModal.PWD;
 }
Example #2
0
 public POP3Normal(EMailModal eMailModal)
 {
     base.EMailModal = eMailModal;
     base.POPServer = base.EMailModal.Server;
     base.User = base.EMailModal.MailID;
     base.Pwd = base.EMailModal.PWD;
     if (eMailModal.Server == "mail.idkin.net")
     {
         base.User = base.EMailModal.MailID.Substring(0, eMailModal.MailID.IndexOf('@'));
     }
 }
 public static POP3 GetPopMail(EMailModal modal)
 {
     string text = modal.Text;
     POP3 pop;
     if (text != null)
     {
         if (text == "126.com" || text == "sunupcg.com" || text == "jbcidu.com" || text == "yahoo.com.cn")
         {
             pop = new POP3Normal(modal);
             return pop;
         }
         if (text == "gmail.com")
         {
             pop = new POP3Ssl(modal);
             return pop;
         }
     }
     pop = new POP3Normal(modal);
     return pop;
 }
        private System.DateTime TestConnectAndReturnDateTime(EMailModal modal)
        {
            POP3 pop3 = PopMailFactory.GetPopMail(modal);

            System.DateTime time = System.DateTime.MinValue;
            string          str  = pop3.TestConnect();

            this.strMsg = str;
            if (string.IsNullOrEmpty(str))
            {
                pop3.GetAll();
            }
            else
            {
                //base.Dispatcher.BeginInvoke(delegate
                //{
                //    this.tbkMsg.Text = str;
                //    this.btnOpen.IsEnabled = false;
                //}, new object[0]);
            }
            return(time);
        }
 private System.DateTime TestConnectAndReturnDateTime(EMailModal modal)
 {
     POP3 pop3 = PopMailFactory.GetPopMail(modal);
     System.DateTime time = System.DateTime.MinValue;
     if (pop3 != null)
     {
         string str = pop3.TestConnect();
         this.strMsg = str;
         if (string.IsNullOrEmpty(str))
         {
             pop3.GetAll();
         }
         else
         {
             //base.Dispatcher.BeginInvoke(delegate
             //{
             //    this.tbkMsg.Text = str;
             //    this.btnOpen.IsEnabled = false;
             //}, new object[0]);
         }
     }
     else
     {
         //base.Dispatcher.BeginInvoke(delegate
         //{
         //    this.tbkMsg.Text = "邮件服务地址出错";
         //    this.btnOpen.IsEnabled = false;
         //}, new object[0]);
     }
     return time;
 }
 private void InitialModel(string mailId)
 {
     this.item = new EmailAccountItem(EmailAccountItemType.type2);
     this.item.tbkAccount.Text = mailId;
     this.item.Tag = mailId;
     this.modal = new EMailModal();
     this.modal.MailID = mailId;
     this.modal.Url = (this.cbxEmailService.SelectedItem as EmailServerInfo).URL;
     this.modal.PWD = this.txtPwd.Password;
     this.modal.EMailType = EmailType.EnterpriseEmail;
     this.modal.UID = ServiceUtil.Instance.SessionService.Uid;
     this.modal.Server = (this.cbxEmailService.SelectedItem as EmailServerInfo).Server;
     this.modal.Text = this.promptServer.Text.Trim();
     this.modal.Span = 1;
 }
Example #7
0
 public Setting(EMailModal modal)
 {
     this.Modal    = modal;
     this.iNWindow = (ServiceUtil.Instance.DataService.INWindow as INWindow);
 }
 private void UpdateMailCount(EmailAccountItem item)
 {
     this.eMailModal = (item.DataContext as EMailModal);
     if (this.eMailModal != null)
     {
         System.Action<EmailAccountItem> a = new System.Action<EmailAccountItem>(this.OpenExplorer);
         a.BeginInvoke(item, delegate(System.IAsyncResult ar)
         {
             a.EndInvoke(ar);
             this.Setmail(this.eMailModal);
         }, null);
     }
 }
 private void Setmail(EMailModal eMailModal)
 {
     POP3 pop3 = PopMailFactory.GetPopMail(eMailModal);
     pop3.GetAll();
     EmailManagerViewModel viewModel = new EmailManagerViewModel();
     viewModel.UpdateEmail(ServiceUtil.Instance.SessionService.Uid, eMailModal.MailID, (int)eMailModal.EMailType, eMailModal.Span.ToString(), "");
 }
 private System.DateTime TestConnectAndReturnDateTime(EMailModal modal)
 {
     return System.DateTime.Now;
 }
Example #11
0
 public Setting(EMailModal modal)
 {
     this.Modal = modal;
     this.iNWindow = (ServiceUtil.Instance.DataService.INWindow as INWindow);
 }
Example #12
0
 private void GetEmailList(EmailTimeResponse response)
 {
     DataModel.Instance.EmailList.Clear();
     if (response != null && response.emailTime.Count > 0)
     {
         System.Collections.Generic.List<EMailModal> localModals = this.GetEmailModals();
         foreach (EmailTime emailTime in response.emailTime)
         {
             EMailModal modal = new EMailModal();
             modal.MailID = emailTime.email;
             modal.EMailType = (EmailType)emailTime.emailType;
             if (localModals != null && localModals.Count > 0)
             {
                 EMailModal modalTmp = localModals.Find((EMailModal m) => m.MailID == modal.MailID);
                 if (modalTmp != null)
                 {
                     modal.PWD = modalTmp.PWD;
                     modal.Server = modalTmp.Server;
                     modal.Text = modalTmp.Text;
                     modal.NewCount = modalTmp.NewCount;
                     modal.Url = modalTmp.Url;
                     modal.UID = modalTmp.UID;
                 }
             }
             int time = 0;
             if (int.TryParse(emailTime.spanTime, out time))
             {
                 modal.Span = time;
             }
             else
             {
                 modal.Span = 5;
             }
             modal.Url = emailTime.url;
             modal.Server = emailTime.host;
             System.DateTime dt;
             if (System.DateTime.TryParse(emailTime.lastTime, out dt))
             {
                 modal.LastUpdateTime = dt;
             }
             else
             {
                 this.logger.Error(string.Format("邮件帐户:{0} 邮件ID:{1} 时间信息异常:{2}", modal.UID, modal.MailID, emailTime.lastTime));
             }
             modal.HasError = string.IsNullOrEmpty(modal.PWD);
             DataModel.Instance.EmailList.Add(modal);
         }
         this.InitialEmail();
     }
 }
 private System.DateTime TestConnectAndReturnDateTime(EMailModal modal)
 {
     return System.DateTime.Now;
 }