public EmailNotifications()
 {
     InitializeComponent();
     if (!authCB.Checked)
     {
         usernameTB.Enabled = false;
         usernameTB.Text    = "";
         passwordTB.Enabled = false;
         passwordTB.Text    = "";
     }
     else
     {
         usernameTB.Enabled = true;
         passwordTB.Enabled = true;
     }
     Work.EmailNotifications email = BinarySerialization.DeserializeEmailNotifications(BinarySerialization.EMAIL_SETTINGS);
     if (email != null)
     {
         providerCB.SelectedIndex = email.GetProvider();
         serverAddressTB.Text     = email.GetServer();
         usernameTB.Text          = email.GetUsername();
         portNUD.Value            = email.GetPort();
         authCB.Checked           = email.GetAuth();
         sslCB.Checked            = email.GetSsl();
         emailTB.Text             = email.GetAddress();
         passwordTB.Text          = email.GetPassword();
     }
     else
     {
         providerCB.SelectedIndex = 0;
         serverAddressTB.Text     = "smtp-mail.outlook.com";
         usernameTB.Text          = "";
         portNUD.Value            = 587;
         authCB.Checked           = true;
         sslCB.Checked            = true;
         emailTB.Text             = "";
         passwordTB.Text          = "";
     }
     backupOKCB.Checked   = MySQLBackUpFTP_ADOPSE.Properties.Settings.Default.notifyOnBackupOK;
     backupFAILCB.Checked = MySQLBackUpFTP_ADOPSE.Properties.Settings.Default.notifyOnBackupFAIL;
     ftpOKCB.Checked      = MySQLBackUpFTP_ADOPSE.Properties.Settings.Default.notifyOnFTPOK;
     ftpFAILCB.Checked    = MySQLBackUpFTP_ADOPSE.Properties.Settings.Default.notifyOnFTPFAIL;
     this.Visible         = true;
 }
Пример #2
0
        private void emailCB_CheckedChanged(object sender, EventArgs e)
        {
            int l = 0;

            Work.EmailNotifications email = BinarySerialization.DeserializeEmailNotifications(BinarySerialization.EMAIL_SETTINGS);
            try
            {
                l = email.GetAddress().Length;
            }
            catch (Exception) { }
            if (l == 0 && emailCB.Checked == true && !isEmailNotoficationsOpen)
            {
                emailCB.Checked = false;
                MessageBox.Show("You need to set up a valid server connection first!", "MySQLBackUpFTP_ADOPSE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                new EmailNotifications();
                isEmailNotoficationsOpen = true;
            }
            MySQLBackUpFTP_ADOPSE.Properties.Settings.Default.notify = emailCB.Checked;
            MySQLBackUpFTP_ADOPSE.Properties.Settings.Default.Save();
        }