protected override void OnClosing(CancelEventArgs e) { f = null; MainPage.mp.Show(); base.OnClosing(e); }
private async void connexion_Click(object sender, RoutedEventArgs e) { HttpClient http = new HttpClient(); HttpResponseMessage msg = await http.GetAsync(Data.dbserver + "user/user?email=" + cemail.Text + "&password="******"&machineName=" + Methods.identifiant()); string webresponse = await msg.Content.ReadAsStringAsync(); User root = null; try { root = JsonConvert.DeserializeObject <User>(webresponse); if (root.configuration != null && root.machineName != null) { Data.config = root.configuration; Data.user = new User(); Data.user.email = root.email; Data.user.machineName = root.machineName; Data.user.nom = root.nom; Data.user.prenom = root.prenom; MessageBox.Show("Bienvenue " + root.prenom, "OK"); MainPage.mp.Hide(); fermer f = new fermer(); if (!(Service1.th.ThreadState == System.Threading.ThreadState.Running)) { Service1.th = new Thread(new ThreadStart(Service1.getUser)); } f.Show(); } else { throw new Exception(); } } catch (Exception e1) { MessageBox.Show("il faut s'inscrire", "ERREUR"); //Environment.Exit(0); //MainPage.mp.Hide(); Console.WriteLine("User Not Found"); } }
public fermer() { InitializeComponent(); f = this; }