private async void LoadOperations() { propertyOperations = await PropertiesOperations.getList(); txtOperation.ItemsSource = propertyOperations; txtOperation.DisplayMemberPath = "Nombre"; txtOperation.SelectedValuePath = "Id"; txtOperation.SelectedValue = 1; }
private async void BtnLogin_Clicked(object sender, EventArgs e) { try { if (UserLg.Text != null && UserLg.Text.Trim() != string.Empty) { if (PassLg.Text != null && PassLg.Text != string.Empty) { BtnLogin.IsEnabled = false; actLoading.IsRunning = true; Services.UserServices postUer = new Services.UserServices(); Model.Login data = new Model.Login(UserLg.Text.Trim(), PassLg.Text); Token token = await postUer.PostUserAsync(data); //App.Current.Properties["token"] = token; PropertiesOperations.SetTokenProperties(token); await this.RemoveLogin(); //await Navigation.PushAsync(new Menu()); actLoading.IsRunning = false; BtnLogin.IsEnabled = true; App.Current.Properties["logged"] = true; } else { await DisplayAlert("Error", "Ingresa contraseña", "OK"); } } else { await DisplayAlert("Error", "Ingresa usuario", "OK"); } } catch (Exception ex) { await DisplayAlert("Error", ex.Message, "OK"); actLoading.IsRunning = false; BtnLogin.IsEnabled = true; } }
public Menu() { InitializeComponent(); this.token = PropertiesOperations.GetTokenProperties(); //show Name if (this.token.FullName != null) { lblFullName.Text = "Ing. " + this.token.FullName; } //if users checked in, redirect to activies page so that can check out if (App.Current.Properties.ContainsKey("checkIn") && ((bool)App.Current.Properties["checkIn"]) && App.Current.Properties.ContainsKey("numProy")) { Device.BeginInvokeOnMainThread(async() => { await Navigation.PushAsync(new Tareas((string)App.Current.Properties["numProy"], token)); }); } }
private async void Logout_Clicked(object sender, EventArgs e) { PropertiesOperations.RemoveProperties(); Navigation.InsertPageBefore(new MainPage(), this); await Navigation.PopAsync().ConfigureAwait(false); }