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;
        }
Ejemplo n.º 2
0
        public static void ExecCommande(string monEntree)
        {
            if (String.IsNullOrEmpty(monEntree))
            {
                return;
            }
            string maCommande = monEntree.Trim().ToLower();
            if (maCommande == "test")
            {
                Notifier.ShowMessage("Blablabla blabla\n ablablabla ablablab blbalba\n Blablabla blabla ablablabla ablablab\n blbalbaBlablabla blabla ablablabla ablablab blbalba Blablabla blabla ablablabla ablablab blbalba Blablabla blabla ablablabla ablablab blbalba Blablabla blabla ablablabla ablablab blbalbaBlablabla blabla ablablabla ablablab blbalba Blablabla blabla ablablabla ablablab blbalba", "Titre", "information", 4);
                return;
            }
            if (maCommande == "reset")
            {
                Properties.Settings.Default.lastIdCheckDocLog = 0;
                Properties.Settings.Default.Save();
                Notifier.ShowMessage("Remise à zéro de l'index DocLogs", "Commande", "information", 3);
                return;
            }
            if (maCommande == "options" || maCommande == "option")
            {
                //((MainWindow)App.Current.MainWindow).IsEnabled = false;
                FenetreOptions myOptionWindow = new FenetreOptions();
                myOptionWindow.ShowDialog();
                return;
            }
            if (maCommande == "update")
            {
                ((MainWindow)App.Current.MainWindow).myProgressBar.Value = 1;
                ((MainWindow)App.Current.MainWindow).myProgressBar.Minimum = 1;
                ((MainWindow)App.Current.MainWindow).myProgressBar.Maximum = 100;

                using (BackgroundWorker bw = new BackgroundWorker())
                {
                    bw.WorkerReportsProgress = true;
                    bw.DoWork += new DoWorkEventHandler(GestionDocuments.Do_Work_UpdateDocuments);
                    bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
                    if (bw.IsBusy != true)
                    {
                        bw.RunWorkerAsync();
                    }
                }
                Notifier.ShowMessage("Mise à jour manuelle des documents.", "Commande", "information", 3);
                return;
            }
            if (maCommande == "updatesupverviseurs" || maCommande=="superviseurs" || maCommande == "updatesuperviseur" || maCommande == "superviseur")
            {
                ((MainWindow)App.Current.MainWindow).myProgressBar.Value = 1;
                ((MainWindow)App.Current.MainWindow).myProgressBar.Minimum = 1;
                ((MainWindow)App.Current.MainWindow).myProgressBar.Maximum = 100;

                using (BackgroundWorker bw = new BackgroundWorker())
                {
                    bw.WorkerReportsProgress = true;
                    bw.DoWork += new DoWorkEventHandler(Superviseurs.Do_Work_UpdateSuperviseurs);
                    bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
                    if (bw.IsBusy != true)
                    {
                        bw.RunWorkerAsync();
                    }
                }
                Notifier.ShowMessage("Mise à jour manuelle des superviseurs.", "Commande", "information", 3);
                return;
            }
            if (maCommande == "fullupdate")
            {
                ((MainWindow)App.Current.MainWindow).myProgressBar.Value = 1;
                ((MainWindow)App.Current.MainWindow).myProgressBar.Minimum = 1;
                ((MainWindow)App.Current.MainWindow).myProgressBar.Maximum = 100;

                using (BackgroundWorker bw = new BackgroundWorker())
                {
                    bw.WorkerReportsProgress = true;
                    bw.DoWork += new DoWorkEventHandler(GestionDocuments.Do_Work_GetAllDocuments);
                    bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
                    if (bw.IsBusy != true)
                    {
                        bw.RunWorkerAsync();
                    }
                }
                Notifier.ShowMessage("Mise à jour manuelle complète de l'ensemble des documents.", "Commande", "information", 3);
                return;
            }
            if (maCommande == "exit" || maCommande == "quit")
            {
                App._myDocumentViewerWindow.Close();
                //App._myOptionWindow.Close();
                MainWindow wind = App.Current.MainWindow as MainWindow;
                ConnectorMySql.CloseAllConnections();
                wind.Close();
                return;
            }
            if (maCommande == "apropos" || maCommande == "about" || maCommande == "infos" || maCommande == "info")
            {
                MainWindow wind = App.Current.MainWindow as MainWindow;
                wind.AjouterElementSurPage(App._myControleInformations);
                return;
            }
            if (maCommande == "changes" || maCommande == "changelogs" || maCommande == "version" || maCommande == "logs" || maCommande == "log")
            {
                MainWindow wind = App.Current.MainWindow as MainWindow;
                UC_CONTROLE_ChangeLogs myUC_ChangeLogs = new UC_CONTROLE_ChangeLogs();
                wind.AjouterElementSurPage(myUC_ChangeLogs);
                return;
            }
            Notifier.ShowMessage("La commande saisie n'a pas été reconnue...","Erreur", "error", 3);
        }