Пример #1
0
 private void apply_Click(object sender, RoutedEventArgs e)
 {
     if (tbEmail.Text == "")
     {
         MessageBox.Show("Podaj adres e-mail", "Info");
     }
     else
     {
         if (!tbEmail.Text.Contains("@"))
         {
             MessageBox.Show("Niepoprawny adres email", "Info");
         }
         else
         {
             if (!tbEmail.Text.Contains("."))
             {
                 MessageBox.Show("Niepoprawny adres email", "Info");
             }
             else
             {
                 if (tbSmtpServer.Text == "")
                 {
                     MessageBox.Show("Podaj adress serwera SMTP", "Info");
                 }
                 else
                 {
                     if (!tbSmtpServer.Text.Contains("."))
                     {
                         MessageBox.Show("Niepoprawny adres", "Info");
                     }
                     else
                     {
                         if (!Directory.Exists(apacheSelect.fileName.Text))
                         {
                             try
                             {
                                 Directory.CreateDirectory(apacheSelect.fileName.Text);
                             }
                             catch { MessageBox.Show("Niepoprawna lokalizacja Apacha!", "ERROR"); }
                         }
                         if (Directory.Exists(apacheSelect.fileName.Text))
                         {
                             if (!Directory.Exists(logsSelect.fileName.Text))
                             {
                                 try
                                 {
                                     Directory.CreateDirectory(logsSelect.fileName.Text);
                                 }
                                 catch { MessageBox.Show("Niepoprawna lokalizacja logów!", "ERROR"); }
                             }
                             if (Directory.Exists(logsSelect.fileName.Text))
                             {
                                 if (!Directory.Exists(backupSelect.fileName.Text))
                                 {
                                     try
                                     {
                                         Directory.CreateDirectory(backupSelect.fileName.Text);
                                     }
                                     catch { MessageBox.Show("Niepoprawna lokalizacja kopi zapasowej!", "ERROR"); }
                                 }
                                 if (Directory.Exists(backupSelect.fileName.Text))
                                 {
                                     if (tbServiceName.Text == "")
                                     {
                                         MessageBox.Show("Brak Service name!", "ERROR");
                                     }
                                     else
                                     {
                                         if (pbMasterPass.Password.Length < 5)
                                         {
                                             MessageBox.Show("Kopia zapasowa: Zbyt krótkie hasło!", "ERROR");
                                         }
                                         else
                                         {
                                             if (pbMasterPass.Password != pbMasterPassCheck.Password)
                                             {
                                                 MessageBox.Show("Ustawienia programu: Podane hasła różnią się!", "ERROR");
                                             }
                                             else
                                             {
                                                 rc.setValue("SO_email", tbEmail.Text);
                                                 rc.setValue("backupLocation", backupSelect.fileName.Text);
                                                 rc.setValue("auditSMTP", tbSmtpServer.Text);
                                                 rc.setValue("apacheLocation", apacheSelect.fileName.Text);
                                                 rc.setValue("logLocation", logsSelect.fileName.Text);
                                                 rc.setValue("serviceName", tbServiceName.Text);
                                                 aut.registerAccess("masterAccess", pbMasterPass.Password);
                                                 rc.setValue("Configured", "true"); //ustawia klucz na cokolwiek, oznacza to że jest skonfigurowane
                                                 mw.Content.Children.Clear();
                                                 //mw.Content.Children.Add(new COS TAM PO ZAKONCZENIU KONFIGURACJI);
                                                 MessageBox.Show("Konfiguracja została zmieniona.", "INFO");
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #2
0
 private void btnSaveSettings_Click(object sender, RoutedEventArgs e)
 {
     if (this.checkSave.IsChecked == true)
     {
         this.rc.setValue("Configured", "true");
     }
     if (this.SO_Email.Text != this.rc.getValue("SO_EMAIL") || this.SO_Email.Text != String.Empty)
     {
         if (this.SO_Email.Text.Trim() != String.Empty && this.SO_Email.Text.Length > 0 && this.SO_Email.Text.Contains("@"))
         {
             rc.setValue("SO_EMAIL", this.SO_Email.Text);
         }
         else
         {
             MessageBox.Show("Niepoprawny format adresu email! Adres musi mieć formę : [email protected] ", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     if (this.SMTP_Address.Text != this.rc.getValue("AUDITSMTP") || this.SMTP_Address.Text != String.Empty)
     {
         if (this.SMTP_Address.Text.Trim() != String.Empty && this.SMTP_Address.Text.Contains(".") && this.SMTP_Address.Text.Length > 0)
         {
             this.rc.setValue("AUDITSMTP", this.SMTP_Address.Text);
         }
         else
         {
             MessageBox.Show("Niepoprawny format adresu serwera SMTP!", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     if (this.Server_Email.Text != this.rc.getValue("EMAIL") || this.Server_Email.Text != String.Empty)
     {
         if (this.Server_Email.Text.Trim() != String.Empty && this.Server_Email.Text.Length > 0 && this.Server_Email.Text.Contains("@"))
         {
             rc.setValue("EMAIL", this.Server_Email.Text);
         }
         else
         {
             MessageBox.Show("Niepoprawny format adresu email! Adres musi mieć formę : [email protected] ", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     if (this.SMTP_Username.Text != rc.getValue("emailUname") || this.SMTP_Username.Text != String.Empty)
     {
         if (this.SMTP_Username.Text.Trim() != String.Empty && this.SMTP_Username.Text.Length > 0)
         {
             rc.setValue("emailUname", this.SMTP_Username.Text);
         }
         else
         {
             MessageBox.Show("Podaj nazwę użytkownika SMTP!", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     if (this.SMTP_Password.Password != rc.getValue("emailPassword") && this.SMTP_Password.Password != String.Empty)
     {
         if (this.SMTP_Password.Password.Trim() != String.Empty && this.SMTP_Password.Password.Length > 0)
         {
             rc.setValue("emailPassword", this.SMTP_Password.Password);
         }
         else
         {
             MessageBox.Show("Podaj hasło użytkownika SMTP!", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     if (this.serviceName.Text != this.rc.getValue("SERVICENAME") || this.serviceName.Text != String.Empty)
     {
         if (this.serviceName.Text.Trim() != String.Empty && this.serviceName.Text.Length > 0)
         {
             rc.setValue("SERVICENAME", this.serviceName.Text);
         }
         else
         {
             MessageBox.Show("Podaj nazwę usługi Apache", "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }