Exemple #1
0
        /// <summary>
        /// Action lors du clic sur le bouton "cmd_save".
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmd_save_Click(object sender, RoutedEventArgs e)
        {
            string cpxFactor        = lbl_cpxFactor.Content.ToString();
            string selectedCategory = cbo_category.SelectedItem.ToString();
            bool   bookmarkSatut    = Convert.ToBoolean(chk_bmk.IsChecked);

            lbl_message.Content = string.Empty;

            // Assigne à des propriétés, des entrées utilisateurs.
            AuthenCard.SaveIputs(txt_name.Text, txt_shortcut.Text, txt_username.Text, txt_password.Text, cpxFactor, txt_scrNote.Text, selectedCategory, bookmarkSatut);

            // Vérifie les données de la fiche d'authentification.
            if (AuthenCard.IsAuthenCardDataEmpty())
            {
                lbl_message.Content = Data_AuthenCard.Default.IsACardDataNull;
                return;
            }

            // Assigne à une liste des données à enregistrer.
            List <string> aCardData = AuthenCard.GetAuthenCardData();

            // Vérifie le contenu d'une propriété pour la modification.
            if (AuthenCard.ACardData != null)
            {
                // Assignement de données pour la modification d'une fiche d'authentification.
                aCardData.Add(AuthenCard.ACardData[9]);
                VaultDatabase.UpdateAuthenCardData(aCardData);

                // Affiche l'interface d'accueil.
                usc_home usc_homeAuthenCard = new usc_home();
                Switcher.Switch(usc_homeAuthenCard);
                return;
            }

            // Vérifie l'existance du nom de la fiche d'authentification.
            if (AuthenCard.IsAuthenCardExist())
            {
                lbl_message.Content = Data_AuthenCard.Default.IsAuthenCardExist;
                return;
            }

            // Vérifie le chiffrement des données de la fiche d'authentification.
            if (AuthenCard.IsCipheredACardDataEmpty(aCardData))
            {
                System.Windows.Forms.MessageBox.Show(Data_AES.Default.EncryptData);
                return;
            }

            // Vérifie l'enregistrement de la fiche d'authentification chiffrée.
            if (AuthenCard.IsSaveAuthenCard(aCardData))
            {
                // Affiche l'interface d'accueil.
                usc_home usc_homeNote = new usc_home();
                Switcher.Switch(usc_homeNote);
                return;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(Data_VaultDatabase.Default.SaveAuthenCard);
                return;
            }
        }