//Auto Back up Update Click
 private void AutoBackupButtonUpdateClick(object sender, System.Windows.RoutedEventArgs e)
 {
     this.AutoBackupButtonUpdate.IsEnabled = false;
     this.Cursor = Cursors.Wait;
     ProcestaNecessaryFunction.NecessaryFunction necessaryFunctionElement = new ProcestaNecessaryFunction.NecessaryFunction();
     bool timeEmptyError=true;
     if (this.AutoBackupSettingRadioButtonHourly.IsChecked.Equals(true))
     {
         Properties.Settings.Default.AutoBackupKind = 1;
         Properties.Settings.Default.AutoBackupSchedular = this.AutobackUpComboBoxHourly.Text;
         Properties.Settings.Default.AutoBackupTime = DateTime.Now;
         Properties.Settings.Default.Save();
     }
     else if (this.AutoBackupSettingRadioButtonDaily.IsChecked.Equals(true))
     {
         if (!this.AutobackUpTimeDaily.SelectedTime.Equals(string.Empty))
         {
             Properties.Settings.Default.AutoBackupKind = 2;
             Properties.Settings.Default.AutoBackupSchedular = this.AutobackUpComboBoxDaily.Text;
             Properties.Settings.Default.AutoBackupTime = Convert.ToDateTime(string.Format("{0} {1}",DateTime.Now.ToShortDateString() , necessaryFunctionElement.TwelveHourClock(this.AutobackUpTimeDaily.SelectedTime.ToString())));
             Properties.Settings.Default.Save();
         }
         else
         {
             timeEmptyError = false;
         }
     }
     else if (this.AutoBackupSettingRadioButtonWeekly.IsChecked.Equals(true))
     {
         if (!this.AutoBackupTimeWeekly.SelectedTime.Equals(string.Empty))
         {
             Properties.Settings.Default.AutoBackupKind = 3;
             Properties.Settings.Default.AutoBackupSchedular = this.AutobackUpComboBoxWeekly.Text;
             Properties.Settings.Default.AutoBackupTime = Convert.ToDateTime(string.Format("{0} {1}",DateTime.Now.ToShortDateString() , necessaryFunctionElement.TwelveHourClock(this.AutoBackupTimeWeekly.SelectedTime.ToString())));
             Properties.Settings.Default.Save();
         }
         else
         {
             timeEmptyError = false;
         }
     }
     else if (this.AutoBackupSettingRadioButtonMonthely.IsChecked.Equals(true))
     {
         if (!this.AutoBackupTimeBoxMonthely.SelectedTime.Equals(string.Empty))
         {
             Properties.Settings.Default.AutoBackupKind = 4;
             Properties.Settings.Default.AutoBackupSchedular = this.AutoBackupComboBoxMonthly.Text;
             Properties.Settings.Default.AutoBackupTime = Convert.ToDateTime(string.Format("{0} {1}",DateTime.Now.ToShortDateString() , necessaryFunctionElement.TwelveHourClock(this.AutoBackupTimeBoxMonthely.SelectedTime.ToString())));
             Properties.Settings.Default.Save();
         }
         else
         {
             timeEmptyError = false;
         }
     }
     new NecessaryClass().AutobackupSchedular();
     if (timeEmptyError)
     {
         Microsoft.Windows.Controls.MessageBox.Show(VariableClass.ERROR_MESSAGES[0, 5], VariableClass.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
     else
     {
         Microsoft.Windows.Controls.MessageBox.Show(VariableClass.ERROR_MESSAGES[0,4],VariableClass.ERROR_MESSAGES[0,0],MessageBoxButton.OK,MessageBoxImage.Stop);
     }
     this.AutoBackupButtonUpdate.IsEnabled =true;
     this.Cursor = Cursors.Arrow;
 }
Exemplo n.º 2
0
        //Auto Back up Update Click
        private void AutoBackupButtonUpdateClick(object sender, System.Windows.RoutedEventArgs e)
        {
            this.AutoBackupButtonUpdate.IsEnabled = false;
            this.Cursor = Cursors.Wait;
            ProcestaNecessaryFunction.NecessaryFunction necessaryFunctionElement = new ProcestaNecessaryFunction.NecessaryFunction();
            bool timeEmptyError = true;

            if (this.AutoBackupSettingRadioButtonHourly.IsChecked.Equals(true))
            {
                Properties.Settings.Default.AutoBackupKind      = 1;
                Properties.Settings.Default.AutoBackupSchedular = this.AutobackUpComboBoxHourly.Text;
                Properties.Settings.Default.AutoBackupTime      = DateTime.Now;
                Properties.Settings.Default.Save();
            }
            else if (this.AutoBackupSettingRadioButtonDaily.IsChecked.Equals(true))
            {
                if (!this.AutobackUpTimeDaily.SelectedTime.Equals(string.Empty))
                {
                    Properties.Settings.Default.AutoBackupKind      = 2;
                    Properties.Settings.Default.AutoBackupSchedular = this.AutobackUpComboBoxDaily.Text;
                    Properties.Settings.Default.AutoBackupTime      = Convert.ToDateTime(string.Format("{0} {1}", DateTime.Now.ToShortDateString(), necessaryFunctionElement.TwelveHourClock(this.AutobackUpTimeDaily.SelectedTime.ToString())));
                    Properties.Settings.Default.Save();
                }
                else
                {
                    timeEmptyError = false;
                }
            }
            else if (this.AutoBackupSettingRadioButtonWeekly.IsChecked.Equals(true))
            {
                if (!this.AutoBackupTimeWeekly.SelectedTime.Equals(string.Empty))
                {
                    Properties.Settings.Default.AutoBackupKind      = 3;
                    Properties.Settings.Default.AutoBackupSchedular = this.AutobackUpComboBoxWeekly.Text;
                    Properties.Settings.Default.AutoBackupTime      = Convert.ToDateTime(string.Format("{0} {1}", DateTime.Now.ToShortDateString(), necessaryFunctionElement.TwelveHourClock(this.AutoBackupTimeWeekly.SelectedTime.ToString())));
                    Properties.Settings.Default.Save();
                }
                else
                {
                    timeEmptyError = false;
                }
            }
            else if (this.AutoBackupSettingRadioButtonMonthely.IsChecked.Equals(true))
            {
                if (!this.AutoBackupTimeBoxMonthely.SelectedTime.Equals(string.Empty))
                {
                    Properties.Settings.Default.AutoBackupKind      = 4;
                    Properties.Settings.Default.AutoBackupSchedular = this.AutoBackupComboBoxMonthly.Text;
                    Properties.Settings.Default.AutoBackupTime      = Convert.ToDateTime(string.Format("{0} {1}", DateTime.Now.ToShortDateString(), necessaryFunctionElement.TwelveHourClock(this.AutoBackupTimeBoxMonthely.SelectedTime.ToString())));
                    Properties.Settings.Default.Save();
                }
                else
                {
                    timeEmptyError = false;
                }
            }
            new NecessaryClass().AutobackupSchedular();
            if (timeEmptyError)
            {
                Microsoft.Windows.Controls.MessageBox.Show(VariableClass.ERROR_MESSAGES[0, 5], VariableClass.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            else
            {
                Microsoft.Windows.Controls.MessageBox.Show(VariableClass.ERROR_MESSAGES[0, 4], VariableClass.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Stop);
            }
            this.AutoBackupButtonUpdate.IsEnabled = true;
            this.Cursor = Cursors.Arrow;
        }