Exemple #1
0
        private void BtnDeconnexion_Click(object sender, EventArgs e)
        {
            this.Alert("Deconnexion en cours..", FrmNotification.AlertTypeEnum.Warning);

            try
            {
                using (var tw = new StreamWriter(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Security Manager", "Logs", "Historique connexion", DateTime.Now.ToString("dd-MM-yyyy") + "- Historique.txt"), true))
                {
                    tw.WriteLine("[" + DateTime.Now + "] - Deconnexion de l'agent: " + LblUtilisateur.Text);
                }
                FrmConnexion FormConnexion = new FrmConnexion();

                this.Hide();
                FormConnexion.Show();
            }
            catch (DirectoryNotFoundException)
            {
                this.Alert("Erreur: 0x1", FrmNotification.AlertTypeEnum.Error);
            }
            catch (Exception ex)
            {
                this.Alert("Erreur: Voir fichier Exceptions.log.", FrmNotification.AlertTypeEnum.Error);

                using (var tw = new StreamWriter(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Security Manager", "Logs", "Exceptions", DateTime.Now.ToString("dd-MM-yyyy") + "- Exceptions.log"), true))
                {
                    tw.WriteLine("[" + DateTime.Now + "] - Erreur: " + ex.Message);
                }
            }
        }
Exemple #2
0
        private async void Verification()
        {
            try
            {
                LblStatus.Text = "Vérification et mise à jour de Security Manager [1/7]";
                //Faire système de mise à jour + lbl qui montre version actuelle
                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Security Manager", "Update"));
                await Task.Delay(1000);

                LblStatus.Text = "Parametrage de Security Manager [2/7]";
                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Security Manager"));
                await Task.Delay(750);

                LblStatus.Text = "Vérification et création des fichiers requis [3/7]";
                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Security Manager", "Logs"));
                await Task.Delay(750);

                LblStatus.Text = "Vérification et création des dossiers de sauvegarde [4/7]";
                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Security Manager", "Logs", "Main Courante"));
                await Task.Delay(750);

                LblStatus.Text = "Vérification et création de la main courante électronique [5/7]";
                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Security Manager", "Logs", "Controle Boutique"));
                await Task.Delay(750);

                LblStatus.Text = "Optimisation et finalisation.. [6/7]";
                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Security Manager", "Logs", "Prises de service"));
                await Task.Delay(1050);

                LblStatus.Text = "L'équipe de Security Manager vous remercie! [7/7]";
                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Security Manager", "Logs", "Historique connexion"));
                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Security Manager", "Logs", "Exceptions"));

                await Task.Delay(1050);

                FrmConnexion F1 = new FrmConnexion();
                this.Hide();
                await Task.Delay(550);

                F1.Show();
            }
            catch (Exception ex)
            {
                LblStatus.ForeColor = Color.Red;
                LblStatus.Text      = "Erreur: " + ex.Message;
            }
        }