private async void Button_Login(object sender, RoutedEventArgs e) { string email = txtEmail.Text; string password = txtPassword.Password; var errors = validateLogin(email, password); if (errors.Count > 0) { Erremail.Text = errors.ContainsKey("email") ? errors["email"] : ""; Errpassword.Text = errors.ContainsKey("password") ? errors["password"] : ""; } else { string token = await _service.Login(email, password); if (!token.Equals("error")) { var write = Task.Run(async() => await HandlerFileService.WriteFile("token.txt", token)).Result; App.token = Task.Run(async() => await HandlerFileService.ReadFile("token.txt")).Result; Navigatior.GetCurrent().SetSelectedNavigationItem(2); } else { this.status = true; statusLogin.Text = "Invalid Infomation"; Erremail.Text = ""; Errpassword.Text = ""; } } }
private void NavigationViewItem_Tapped(object sender, TappedRoutedEventArgs e) { if (App.token.Length > 0) { var write = Task.Run(async() => await HandlerFileService.WriteFile("token.txt", "")).Result; App.token = ""; } contentFrame.Navigate(typeof(Pages.Login)); }