// Evènement de MouseDoubleClick pour le champs TXT_ClientName private void TXT_ClientName_MouseDoubleClick(object sender, MouseButtonEventArgs e) { // Préparation et affichage du formulaire de recherhces WPF_SearchClient wpf_SC = new WPF_SearchClient(); wpf_SC.ShowDialog(); // Récupération du client retrouvé Class.C_Client cli = wpf_SC.Client; // Vérification si un client à été retrouve if (cli != null) { // Remplissage par rapport au client trouvé et fermeture du bouton d'ajout. this.TXT_ClientCity.Text = cli.City; this.TXT_ClientFax.Text = cli.Fax; this.TXT_ClientMail.Text = cli.Mail; this.TXT_ClientName.Text = cli.Name; this.TXT_ClientStreet.Text = cli.Street; this.TXT_ClientStreetBox.Text = cli.StreetBox; this.TXT_ClientStreetNB.Text = cli.StreetNumber; this.TXT_ClientTel.Text = cli.Telephone; this.TXT_ClientZipCode.Text = cli.ZipCode; this.BTN_AddClient.IsEnabled = false; // Mise à null de la var utilisée cli = null; } else { // Mise à vide des champs et ouverture du bouton d'ajout. this.TXT_ClientCity.Text = null; this.TXT_ClientFax.Text = null; this.TXT_ClientMail.Text = null; this.TXT_ClientName.Text = null; this.TXT_ClientStreet.Text = null; this.TXT_ClientStreetBox.Text = null; this.TXT_ClientStreetNB.Text = null; this.TXT_ClientTel.Text = null; this.TXT_ClientZipCode.Text = null; this.BTN_AddClient.IsEnabled = true; } // Préparation des variables pour le GC wpf_SC = null; }
// Evènement de MouseDoubleCLick sur le champs TXT_Name private void TXT_Name_MouseDoubleClick(object sender, MouseButtonEventArgs e) { // Préparation et affichage de l'écran de recherche de client WPF_SearchClient wpf_SC = new WPF_SearchClient(); wpf_SC.ShowDialog(); // Vérification que l'on a choisi un client if (wpf_SC.Client != null) { // Remplissage des champs this.TXT_City.Text = wpf_SC.Client.City; this.TXT_eMail.Text = wpf_SC.Client.Mail; this.TXT_Fax.Text = wpf_SC.Client.Fax; this.TXT_Name.Text = wpf_SC.Client.Name; this.TXT_Street.Text = wpf_SC.Client.Street; this.TXT_StreetBox.Text = wpf_SC.Client.StreetBox; this.TXT_StreetNB.Text = wpf_SC.Client.StreetNumber; this.TXT_Telephone.Text = wpf_SC.Client.Telephone; this.TXT_ZipCode.Text = wpf_SC.Client.ZipCode; // Ouverture des champs this.TXT_City.IsEnabled = true; this.TXT_eMail.IsEnabled = true; this.TXT_Fax.IsEnabled = true; this.TXT_Street.IsEnabled = true; this.TXT_StreetBox.IsEnabled = true; this.TXT_StreetNB.IsEnabled = true; this.TXT_Telephone.IsEnabled = true; this.TXT_ZipCode.IsEnabled = true; // Récupération du client cli = wpf_SC.Client; // Fermeture du bouton d'encodage this.BTN_Accept.IsEnabled = true; } else { // Remet à zéro tout le formulaire this.TXT_City.Text = null; this.TXT_eMail.Text = null; this.TXT_Fax.Text = null; this.TXT_Name.Text = null; this.TXT_Street.Text = null; this.TXT_StreetBox.Text = null; this.TXT_StreetNB.Text = null; this.TXT_Telephone.Text = null; this.TXT_ZipCode.Text = null; // Fermeture des champs this.TXT_City.IsEnabled = false; this.TXT_eMail.IsEnabled = false; this.TXT_Fax.IsEnabled = false; this.TXT_Street.IsEnabled = false; this.TXT_StreetBox.IsEnabled = false; this.TXT_StreetNB.IsEnabled = false; this.TXT_Telephone.IsEnabled = false; this.TXT_ZipCode.IsEnabled = false; // Fermeture du bouton d'encodage this.BTN_Accept.IsEnabled = false; } }