async void AuthButtonClicked(object sender, EventArgs e) { await btnAuthenticate.FadeTo(0, App.AnimationSpeed, Easing.SinIn); btnAuthenticate.IsVisible = false; LoadingIndicator.IsVisible = true; LoadingIndicator.IsRunning = true; LodingLabel.IsVisible = true; if (LabPicker.SelectedIndex == App.labs.Count - 1) { JsonRequests.labID = 99; } else { JsonRequests.labID = LabPicker.SelectedIndex; } JsonRequests.password = PassEntry.Text; if (!await JsonRequests.getUsers()) { System.Diagnostics.Debug.WriteLine("Connection Error!"); LoadingIndicator.IsVisible = false; LoadingIndicator.IsRunning = false; LodingLabel.IsVisible = false; btnAuthenticate.IsVisible = true; await btnAuthenticate.FadeTo(1, App.AnimationSpeed, Easing.SinIn); return; } LoadingIndicator.IsVisible = false; LoadingIndicator.IsRunning = false; LodingLabel.IsVisible = false; await label1.FadeTo(0, App.AnimationSpeed, Easing.SinIn); await LabPicker.FadeTo(0, App.AnimationSpeed, Easing.SinIn); await PassEntry.FadeTo(0, App.AnimationSpeed, Easing.SinIn); await Navigation.PushAsync(new MainPage()); }
private bool Refresh() { System.Diagnostics.Debug.WriteLine("Refresh"); Task.Run(async() => await JsonRequests.getUsers()) .ContinueWith((end) => { Device.BeginInvokeOnMainThread(() => { if (SearchBar.Text != "" && SearchBar.Text != null) { InfoList.ItemsSource = getItems().AsEnumerable().Where(i => i.name.ToLower().Contains(SearchBar.Text.ToLower())); } else { InfoList.ItemsSource = getItems(); } InfoList.EndRefresh(); }); }); return(App.Foreground); }