public MainWindow() { InitializeComponent(); dOnuts_InterfaceTablette.Properties.Settings.Default.connectionInformationProvided = true; InitializeUsersControls(); InitializeTimerHorloge(); InitializeTimerUpdateSuperviseur(); InitializeConnectivityMonitoring(); GestionConnection.InitializeConnectionStatus(); if (PremiereUtilisation()) { this.window.IsEnabled = false; FenetreOptions maFenetreOption = new FenetreOptions(); maFenetreOption.ShowDialog(); } else { if (App._connectionToServerStatus) { if (String.IsNullOrEmpty(Properties.Settings.Default.pathToDataServeurFichier)) { Parametre pathToFileOnServer = new Parametre("pathToFileOnServer"); Properties.Settings.Default.pathToDataServeurFichier = pathToFileOnServer.GetValue(); Properties.Settings.Default.Save(); } } } RefreshMenuSuperviseurs(); this.Closing += MainWindow_Closing; }
/// <summary> /// Permet la validation du formulaire par la fenêtre option de controle. /// </summary> /// <returns> /// Instance de : UC_ELEMENT_InformationPanel si un problème est détecté, sinon null si tout va bien. /// </returns> public UC_ELEMENT_InformationPanel CheckFormValidation() { #region Validation des champs if (String.IsNullOrWhiteSpace(this.txtboxAdresseIPServeurMySQL.Text)) { return new UC_ELEMENT_InformationPanel("error", "Formulaire incomplet", "L'adresse IP du serveur MySQL (ou MariaDB) n'a pas été renseignée."); } else { Properties.Settings.Default.adresseIPServeurMySQL = this.txtboxAdresseIPServeurMySQL.Text; Properties.Settings.Default.Save(); } if (String.IsNullOrWhiteSpace(this.txtboxNomBDDMySQL.Text)) { return new UC_ELEMENT_InformationPanel("error", "Formulaire incomplet", "Le nom de la base de donnée MySQL (ou MariaDB) n'a pas été renseigné."); } else { Properties.Settings.Default.nomBDD = this.txtboxNomBDDMySQL.Text; Properties.Settings.Default.Save(); } if (String.IsNullOrWhiteSpace(this.txtboxUserMySQL.Text)) { return new UC_ELEMENT_InformationPanel("error", "Formulaire incomplet", "Le nom d'utilisateur de la base de donnée MySQL (ou MariaDB) n'a pas été renseigné."); } else { Properties.Settings.Default.loginMySQL = this.txtboxUserMySQL.Text; Properties.Settings.Default.Save(); } if (String.IsNullOrWhiteSpace(this.txtboxAdresseIPServeurFichiers.Text)) { return new UC_ELEMENT_InformationPanel("error", "Formulaire incomplet", "L'adresse IP du serveur de fichier n'a pas été renseignée."); } else { Properties.Settings.Default.adresseIPServeurFichier = this.txtboxAdresseIPServeurFichiers.Text; Properties.Settings.Default.Save(); } #endregion #region Sauvegarde des champs simples Properties.Settings.Default.passwordMySQL = this.txtboxPasswordMySQL.Password; #endregion #region Verification de la connexion if (!GestionConnection.CheckConnectionIpInformations(this.txtboxAdresseIPServeurMySQL.Text)) { return new UC_ELEMENT_InformationPanel("error", "Adresse IP injoignable", "L'adresse IP du serveur MySQL."); } if (!ConnectorMySql.TryToConnect()) { return new UC_ELEMENT_InformationPanel("error", "Connexion impossible", "La tablette n'a pas été capable de se connecter à la BDD."); } #endregion #region Récupération de paramètre dans la BDD Parametre pathToFileOnServer = new Parametre("pathToFileOnServer"); if (pathToFileOnServer.GetValue() == null) { return new UC_ELEMENT_InformationPanel("error", "Récupération paramètre impossible", "La tablette n'est pas parvenue à récupérer le paramètre pathToFileOnServer dans le serveur MySQL (ou MariaDB)."); } else { Properties.Settings.Default.pathToDataServeurFichier = pathToFileOnServer.GetValue(); Properties.Settings.Default.Save(); } Parametre subdivisions = new Parametre("subdivisions"); if (subdivisions.GetValue() == null) { return new UC_ELEMENT_InformationPanel("error", "Récupération paramètre impossible", "La tablette n'est pas parvenue à récupérer les subdivisions dans le serveur MySQL (ou MariaDB)."); } else { Properties.Settings.Default.subdivisionList = subdivisions.GetValue(); Properties.Settings.Default.Save(); } #endregion return null; }