Ejemplo n.º 1
0
        // Region for Construcor
        #region Constructor

        /// <summary>
        /// Constructor for Facade class.
        /// Use GetInstance() instead.
        /// </summary>
        private Facade()
        {
            // Load Account Settings.
            this._accSettings = AccountSettings.Load("Account.Settings");

            // Load Client Settings.
            this._clientSettings = ClientSettings.Load("Client.Settings");

            // Setup Message Server.
            this._store = new MessageStore();

            // Setup Message Server Sent Items.
            this._storeSent = new MessageStore();

            // Setup Message Server Deleted Items.
            this._storeDelete = new MessageStore();

            // Setup Message Server Custom Folders.
            this._storeCustom = new MessageStore();

            // Imap4 controller instance.
            this._imap4Controller = new Imap4Controller(this.GetDefaultAccountInfo());

            // Pop3 controller instance.
            this._pop3Controller = new Pop3Controller(this.GetDefaultAccountInfo());

            // Smtp controller instance.
            this._smtpController = new SmtpController();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method for try to connect
        /// </summary>
        /// <returns>The string return.</returns>
        public string TryConnect()
        {
            this.progressBar.Visible = true;
            this.btnNext.Enabled     = false;

            this.labelStatus.Text = "Verifying email configurations...";

            bool   success = true;
            string msg     = "You have just successfully completed adding a new account." +
                             Environment.NewLine + "Please select finish to save the changes or cancel to discard them.";

            // verify incoming server email configurations.

            try
            {
                if (this._accInfo.MailAccountType == AccountType.POP3)
                {
                    Pop3Controller pop3Controller = new Pop3Controller(this._accInfo);
                    pop3Controller.Disconnect();
                }
                else if (this._accInfo.MailAccountType == AccountType.IMAP)
                {
                    Imap4Controller imap4Controller = new Imap4Controller(this._accInfo);
                    imap4Controller.Disconnect();
                }
            }
            catch (Exception)
            {
                success = false;
                msg     = "The incoming server email configuration is not valid.";
            }

            // verify outcoming server email configurations.

            if (success)
            {
                this.labelStatus.Text = "Sending test e-mail...";

                try
                {
                    SmtpController            smtpController = new SmtpController();
                    ActiveUp.Net.Mail.Message message        = smtpController.SendMessage(this._accInfo,
                                                                                          this._accInfo.EmailAddress, "ActiveUp Test", "ActiveUp Test", new string[0]);
                }
                catch (Exception)
                {
                    success = false;
                    msg     = "The outcoming server email configuration is not valid.";
                }
            }

            if (success)
            {
                this.btnNext.Enabled = true;
            }

            this.labelStatus.Text    = msg;
            this.progressBar.Visible = false;

            return(string.Empty);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Method for try to connect
        /// </summary>
        /// <returns>The string return.</returns>
        public string TryConnect()
        {
            this.progressBar.Visible = true;
            this.btnNext.Enabled = false;

            this.labelStatus.Text = "Verifying email configurations...";

            bool success = true;
            string msg = "You have just successfully completed adding a new account." + 
                Environment.NewLine + "Please select finish to save the changes or cancel to discard them.";

            // verify incoming server email configurations.

            try
            {
                if (this._accInfo.MailAccountType == AccountType.POP3)
                {
                    Pop3Controller pop3Controller = new Pop3Controller(this._accInfo);
                    pop3Controller.Disconnect();
                }
                else if (this._accInfo.MailAccountType == AccountType.POP3)
                {
                    Imap4Controller imap4Controller = new Imap4Controller(this._accInfo);
                    imap4Controller.Disconnect();
                }
            }
            catch (Exception)
            {
                success = false;
                msg = "The incoming server email configuration is not valid.";
            }

            // verify outcoming server email configurations.

            if (success)
            {
                this.labelStatus.Text = "Sending test e-mail...";

                try
                {
                    SmtpController smtpController = new SmtpController();
                    ActiveUp.Net.Mail.Message message = smtpController.SendMessage(this._accInfo,
                        this._accInfo.EmailAddress, "ActiveUp Test", "ActiveUp Test", new string[0]);
                }
                catch (Exception)
                {
                    success = false;
                    msg = "The outcoming server email configuration is not valid.";
                }
            }
            
            if (success)
            {
                this.btnNext.Enabled = true;
            }

            this.labelStatus.Text = msg;
            this.progressBar.Visible = false;

            return string.Empty;
        }
Ejemplo n.º 4
0
        // Region for Construcor
        #region Constructor
        
        /// <summary>
        /// Constructor for Facade class.
        /// Use GetInstance() instead.
        /// </summary>
        private Facade()
        {
            // Load Account Settings.
            this._accSettings = AccountSettings.Load("Account.Settings");

            // Load Client Settings.
            this._clientSettings = ClientSettings.Load("Client.Settings");

            // Setup Message Server.
            this._store = new MessageStore();

            // Setup Message Server Sent Items.
            this._storeSent = new MessageStore();

            // Setup Message Server Deleted Items.
            this._storeDelete = new MessageStore();

            // Setup Message Server Custom Folders.
            this._storeCustom = new MessageStore();

            // Imap4 controller instance.
            this._imap4Controller = new Imap4Controller(this.GetDefaultAccountInfo());

            // Pop3 controller instance.
            this._pop3Controller = new Pop3Controller(this.GetDefaultAccountInfo());

            // Smtp controller instance.
            this._smtpController = new SmtpController();
        }