async void LoginBtnClick (object sender, EventArgs e) { bool x = false; String username = txtUsername.Text; String password = txtPassword.Text; LoadSpinner loadingOverlay = new LoadSpinner (UIScreen.MainScreen.Bounds); View.Add (loadingOverlay); await Task.Run (() => { x = Application.engine.login(username, password); }); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; if (!x) { loadingOverlay.Hide (); UIAlertView err = new UIAlertView ("Login failed", Application.engine.CurrentError, null, "OK", null); err.Show (); } else { x = await DoGetRooms (); loadingOverlay.Hide (); if (x) { this.NavigationController.PopViewControllerAnimated (false); RoomSelectController roomView = Storyboard.InstantiateViewController ("RoomSelectController") as RoomSelectController; roomView.classList = new List<ClassItem> (Application.engine.classAvailable); this.NavigationController.PushViewController (roomView, true); } } }
async void ConnectToServer () { bool x = false; while (!x) { LoadSpinner loadingOverlay = new LoadSpinner (UIScreen.MainScreen.Bounds); View.Add (loadingOverlay); await Task.Run (() => { x = Application.engine.ConnectTo ("hysw.org"); Console.WriteLine("Connection established!"); }); loadingOverlay.Hide (); if (!x) { new UIAlertView ("Unable to connect to server!", "Please check your connection.", null, "Retry", null); } } }
async void ConnectToServer() { bool x = false; while (!x) { LoadSpinner loadingOverlay = new LoadSpinner(UIScreen.MainScreen.Bounds); View.Add(loadingOverlay); await Task.Run(() => { x = Application.engine.ConnectTo("hysw.org"); Console.WriteLine("Connection established!"); }); loadingOverlay.Hide(); if (!x) { new UIAlertView("Unable to connect to server!", "Please check your connection.", null, "Retry", null); } } }
async void LoginBtnClick(object sender, EventArgs e) { bool x = false; String username = txtUsername.Text; String password = txtPassword.Text; LoadSpinner loadingOverlay = new LoadSpinner(UIScreen.MainScreen.Bounds); View.Add(loadingOverlay); await Task.Run(() => { x = Application.engine.login(username, password); }); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; if (!x) { loadingOverlay.Hide(); UIAlertView err = new UIAlertView("Login failed", Application.engine.CurrentError, null, "OK", null); err.Show(); } else { x = await DoGetRooms(); loadingOverlay.Hide(); if (x) { this.NavigationController.PopViewControllerAnimated(false); RoomSelectController roomView = Storyboard.InstantiateViewController("RoomSelectController") as RoomSelectController; roomView.classList = new List <ClassItem> (Application.engine.classAvailable); this.NavigationController.PushViewController(roomView, true); } } }