private async void btn_Connection_Click(object sender, EventArgs e) { oSTG = new STG(); oSTG.data = new Hashtable(); CUT user_CUT = new CUT(); CUC user_CUC = new CUC(); if(string.IsNullOrEmpty(txt_Login.Text) || string.IsNullOrEmpty(txt_PWD.Text)) { MessageBox.Show("Veuillez remplir tous les champs.", "Erreur", MessageBoxButtons.OK); } else { STG stg_logging = await user_CUC.sendMessage(user_CUT.login(oSTG, txt_Login.Text, txt_PWD.Text)); bool user_logged = stg_logging.Status_op; if (user_logged) { Form form1 = new frm_Generator(); form1.Show(); } else if (CUC.oSTG.Info == null) { MessageBox.Show("Impossible de se connecter au serveur", "Erreur", MessageBoxButtons.OK); } else { MessageBox.Show(CUC.oSTG.Info, "Erreur", MessageBoxButtons.OK); } } }
private async void btn_Dechiffrer_Click(object sender, EventArgs e) { CUT user_CUT = new CUT(); CUC user_CUC = new CUC(); CUC.oSTG.files = new Hashtable(); if (lst_Files.Items.Count > 0) { btn_Annuler.Visible = true; btn_Dechiffrer.Enabled = false; btn_Delete_File.Enabled = false; btn_Parcourir.Enabled = false; } foreach (string filename in openFileDialog1.FileNames) { CUC.oSTG.files.Add(filename, System.IO.File.ReadAllText(filename)); } STG STG_Dechiffre = await user_CUC.sendMessage(user_CUT.dechiffrer(CUC.oSTG, Convert.ToInt16(txt_SampleSize.Text))); btn_Annuler.Visible = false; btn_Dechiffrer.Enabled = true; btn_Delete_File.Enabled = true; btn_Parcourir.Enabled = true; General General_Functions = new General(); General_Functions.sendEmail(STG_Dechiffre); }