private async Task ConnectToRelay() { bool connected = false; var waitIndicator = new MTMBProgressHUD (View) { LabelText = "Connecting...", DimBackground = true, AnimationType = MBProgressHUDAnimation.MBProgressHUDAnimationZoomIn, Mode = MBProgressHUDMode.Indeterminate, MinShowTime = 0, RemoveFromSuperViewOnHide = true }; View.AddSubview(waitIndicator); waitIndicator.Show(animated: true); try { var prefs = NSUserDefaults.StandardUserDefaults; connected = await _remote.Connect(prefs.StringForKey("RelayServerUrl"), prefs.StringForKey("RemoteGroup"), prefs.StringForKey("HubName")); } catch (Exception) { } finally { waitIndicator.Hide(animated: true); } ShowMessage(connected ? "Connected!" : "Unable to connect"); }
public override void ViewDidLoad() { base.ViewDidLoad(); _MainSection = new Section() { new ActivityElement() }; Root = new RootElement("Markers") { _MainSection }; // Simple demo of a progress HUD. Doesn't actually do anything useful. // Added after question from audience. MTMBProgressHUD progress = new MTMBProgressHUD() { DimBackground = true, LabelText = "Doing something.", }; View.Add(progress); progress.Show(animated: true); Task.Factory.StartNew(() => { Thread.Sleep(2000); InvokeOnMainThread(() => { progress.Hide(animated: true); }); }); mapController = new MapViewController(); mapController.NewMarkerCreated += (object sender, MarkerAddedEventArgs e) => { InvokeOnMainThread(() => { _Database.SaveMarker(e.MarkerInfo); RefreshMarkers(); }); }; RefreshMarkers(); }
public override async void ViewDidLoad () { base.ViewDidLoad (); View.BackgroundColor = UIColor.White; Title = "Qualifications"; if (_apiController == null) { _apiController = new ApiController (); } var hud = new MTMBProgressHUD (View) { LabelText = "Loading...", RemoveFromSuperViewOnHide = true }; View.AddSubview (hud); hud.Show (animated: true); // Retrieve list of Qualifications List<string> listOfQualifications = await _apiController.GetQualifications (); hud.Hide (animated: true, delay: 0); TableView.Source = new TableSource (listOfQualifications.ToArray(), this); // Remove extraneous blank rows TableView.TableFooterView = new UIView (); // Shorten separator line TableView.SeparatorInset = new UIEdgeInsets(0, 3, 0, 20); }
public void Start(UIView View,string caption) { hud = new MTMBProgressHUD (View) { LabelText = caption, RemoveFromSuperViewOnHide = true }; View.AddSubview (hud); hud.Show (animated: true); }
//IBActions async partial void RegisterButtonClicked(Foundation.NSObject sender) { hideKeyboard(null); if (EmailImageView.Tag != 1 || UsernameImageView.Tag != 1 || PasswordImageView.Tag != 1 || ConfirmPasswordImageView.Tag != 1) { return; } string username = StringUtils.TrimWhiteSpaceAndNewLine(UsernameTextField.Text); string password = StringUtils.TrimWhiteSpaceAndNewLine(PasswordTextField.Text); string email = StringUtils.TrimWhiteSpaceAndNewLine(EmailTextField.Text); var hud = new MTMBProgressHUD(View) { LabelText = Strings.signing_up, RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(true); try { bool result = await TenServices.Register(username, password, email); if (!result) { UIAlertController AlertController = UIAlertController.Create(Strings.invalid_login, Strings.invalid_login, UIAlertControllerStyle.Alert); AlertController.AddAction(UIAlertAction.Create(Strings.ok, UIAlertActionStyle.Default, null)); PresentViewController(AlertController, true, null); return; } NSUserDefaults.StandardUserDefaults.SetInt((nint)Globe.SharedInstance.User.idUser, "iduser"); NSUserDefaults.StandardUserDefaults.SetString(Globe.SharedInstance.User.username, "username"); NSUserDefaults.StandardUserDefaults.SetString(Globe.SharedInstance.User.password, "password");//todo wtf ((AppDelegate)UIApplication.SharedApplication.Delegate).createTabBarController(); ((AppDelegate)UIApplication.SharedApplication.Delegate).Window.RootViewController = ((AppDelegate)UIApplication.SharedApplication.Delegate).TabBarController; ((AppDelegate)UIApplication.SharedApplication.Delegate).Window.MakeKeyAndVisible(); } catch (RESTError error) { UIAlertController AlertController = UIAlertController.Create(error.Message, null, UIAlertControllerStyle.Alert); AlertController.AddAction(UIAlertAction.Create(Strings.ok, UIAlertActionStyle.Default, null)); PresentViewController(AlertController, true, null); } catch (Exception e) { Console.WriteLine(e.Message); } finally { hud.Hide(true); } }
void ShowSimple () { // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) hud = new MTMBProgressHUD(this.navController.View); navController.View.AddSubview(hud); // Regiser for DidHide Event so we can remove it from the window at the right time hud.DidHide += HandleDidHide; // Show the HUD while the provided method executes in a new thread hud.Show(new MonoTouch.ObjCRuntime.Selector("MyTask"), this, null, true); }
async partial void LoginButtonClicked (Foundation.NSObject sender){ View.EndEditing(true); string username = StringUtils.TrimWhiteSpaceAndNewLine(UsernameTextField.Text); string password = StringUtils.TrimWhiteSpaceAndNewLine(PasswordTextField.Text); if(!StringUtils.IsValidUsername(username) || !StringUtils.IsValidPassword(password)){ FailBecuaseInvalidInput(); return; } var hud = new MTMBProgressHUD (View) { LabelText = Strings.signing_in, RemoveFromSuperViewOnHide = true }; View.AddSubview (hud); hud.Show (true); try{ bool result = await TenServices.Login(username, password); if(!result){ UIAlertController AlertController = UIAlertController.Create(Strings.invalid_login, Strings.invalid_login, UIAlertControllerStyle.Alert); AlertController.AddAction(UIAlertAction.Create(Strings.ok, UIAlertActionStyle.Default, null)); PresentViewController(AlertController, true, null); return; } NSUserDefaults.StandardUserDefaults.SetInt((nint)Globe.SharedInstance.User.idUser, "iduser"); NSUserDefaults.StandardUserDefaults.SetString(Globe.SharedInstance.User.username, "username"); NSUserDefaults.StandardUserDefaults.SetString(Globe.SharedInstance.User.password, "password"); ((AppDelegate)UIApplication.SharedApplication.Delegate).createTabBarController(); ((AppDelegate)UIApplication.SharedApplication.Delegate).Window.RootViewController = ((AppDelegate)UIApplication.SharedApplication.Delegate).TabBarController; ((AppDelegate)UIApplication.SharedApplication.Delegate).Window.MakeKeyAndVisible(); } catch(RESTError error){ Console.WriteLine(error.Message); if(error.StatusCode == 400 || error.StatusCode == -1){ UIAlertController AlertController = UIAlertController.Create(Strings.invalid_login, error.Message, UIAlertControllerStyle.Alert); AlertController.AddAction(UIAlertAction.Create(Strings.ok, UIAlertActionStyle.Default, null)); PresentViewController(AlertController, true, null); return; } UIAlertController AlertController2 = UIAlertController.Create(Strings.invalid_login, Strings.invalid_login, UIAlertControllerStyle.Alert); AlertController2.AddAction(UIAlertAction.Create(Strings.ok, UIAlertActionStyle.Default, null)); PresentViewController(AlertController2, true, null); return; } finally { hud.Hide(true); } }
private void Foo() { var hud = new MTMBProgressHUD(View) { LabelText = "Waiting...", RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(animated: true); hud.Hide(animated: true, delay: 5); }
private void ShowClearButton() { if (NavigationItem.LeftBarButtonItem == null) { NavigationItem.SetLeftBarButtonItem( new UIBarButtonItem(UIBarButtonSystemItem.Trash, (sender, args) => { UIAlertController AlertController = UIAlertController.Create(Strings.clear_notificaitons, Strings.clear_notificaions_confirm, UIAlertControllerStyle.Alert); AlertController.AddAction(UIAlertAction.Create(Strings.yes, UIAlertActionStyle.Cancel, async delegate (UIAlertAction obj) { var hud = new MTMBProgressHUD(View) { LabelText = Strings.clearing_notifications, RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(true); bool result = false; try { await System.Threading.Tasks.Task.Run(() => { result = TenServices.MarkAllNotificatiosAsRead(new List<Notification>(notificationFeedTableViewController.TableItems)).Result; }); } catch (Exception) { } finally { notificationFeedTableViewController.TableItems.Clear(); notificationFeedTableViewController.TableView.ReloadData(); HideClearButton(); notificationFeedTableViewController.IfEmpty(); await notificationFeedTableViewController.FetchTableData(); ViewUtils.RemoveDotFromTabBarAtIndex(1); TenServiceHelper.CheckForNewNotifications(); hud.Hide(true); } })); AlertController.AddAction(UIAlertAction.Create(Strings.cancel, UIAlertActionStyle.Default, null)); PresentViewController(AlertController, true, null); }) , true); } }
public static void ShowMessage(this UIView parentView, string message) { var hud = new MTMBProgressHUD (parentView) { DetailsLabelText = message, RemoveFromSuperViewOnHide = true, DimBackground = false, AnimationType = MBProgressHUDAnimation.MBProgressHUDAnimationZoomIn, Mode = MBProgressHUDMode.Text, UserInteractionEnabled = true }; parentView.AddSubview (hud); hud.Show (true); hud.Hide (true, 1.5); }
async partial void sendButtonClicked(Foundation.NSObject sender) { email = StringUtils.TrimWhiteSpaceAndNewLine(emailTextField.Text); if (String.IsNullOrEmpty(email)) { return; } var hud = new MTMBProgressHUD(View) { LabelText = Strings.loading, RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(true); try { bool result = await TenServices.ForgotPassword(email); if (!result) { UIAlertController AlertController = UIAlertController.Create(Strings.error, Strings.invalid_email, UIAlertControllerStyle.Alert); AlertController.AddAction(UIAlertAction.Create(Strings.ok, UIAlertActionStyle.Default, null)); PresentViewController(AlertController, true, null); return; } SendCodeViewController vc = (SendCodeViewController)NavigationController.Storyboard.InstantiateViewController("SendCodeViewController"); vc.email = email; NavigationController.PushViewController(vc, true); } catch (RESTError error) { UIAlertController AlertController = UIAlertController.Create(error.Message, null, UIAlertControllerStyle.Alert); AlertController.AddAction(UIAlertAction.Create(Strings.ok, UIAlertActionStyle.Default, null)); PresentViewController(AlertController, true, null); } finally { hud.Hide(true); } }
public override void ViewDidLoad () { base.ViewDidLoad (); //create waiting hud var hud = new MTMBProgressHUD (View) { LabelText = "Loading high res image...", RemoveFromSuperViewOnHide = true }; View.AddSubview (hud); hud.Show (animated: true); //load app content InitiateHttp (); //hide hud hud.Hide (animated: true, delay: 5); }
private async Task ReloadMovieTable() { string url = this.TabBarItem.Title == "Movie" ? $"http://api.rottentomatoes.com/api/public/v1.0/lists/movies/box_office.json?apikey={apikey}&limit=20" : $"http://api.rottentomatoes.com/api/public/v1.0/lists/dvds/top_rentals.json?apikey={apikey}&limit=20"; var hud = new MTMBProgressHUD (View) { LabelText = "Loading...", RemoveFromSuperViewOnHide = true }; View.AddSubview (hud); hud.Show (true); List<Movie> movies = await Utility.GetMovieData (url); this.MovieTable.Source = new MovieTableController(movies, this); this.MovieTable.ReloadData (); SearchCollectionView searchview = (SearchCollectionView)this.TabBarController.ViewControllers [2]; searchview.allData = movies; hud.Hide (true); }
public static void ShowMessage(UIView view , string message) { hud = new MTMBProgressHUD (view){ LabelText = message}; view.AddSubview (hud); hud.Mode = MBProgressHUDMode.CustomView; hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); // Register for DidHide Event so we can remove it from the window at the right time hud.DidHide += HandleDidHide; // Add information to your HUD hud.LabelText = message; // Show the HUD hud.Show(true); // Hide the HUD after 2 seconds hud.Hide (true,2); }
async partial void sendButtonClicked (Foundation.NSObject sender) { if (String.IsNullOrEmpty (codeTextField.Text) || String.IsNullOrEmpty (passwordTextField.Text) || String.IsNullOrEmpty (confirmPasswordTextField.Text) || passwordImageView.Tag != 1 || confirmPasswordImageView.Tag != 1) { return; } var hud = new MTMBProgressHUD (View) { LabelText = Strings.loading, RemoveFromSuperViewOnHide = true }; View.AddSubview (hud); hud.Show (true); try { bool result = await TenServices.ResetPassword (email, codeTextField.Text, passwordTextField.Text); if (!result) { UIAlertController AlertController = UIAlertController.Create (Strings.error, Strings.invalid_email, UIAlertControllerStyle.Alert); AlertController.AddAction (UIAlertAction.Create (Strings.ok, UIAlertActionStyle.Default, null)); PresentViewController (AlertController, true, null); return; } NSUserDefaults.StandardUserDefaults.SetInt ((nint)Globe.SharedInstance.User.idUser, "iduser"); NSUserDefaults.StandardUserDefaults.SetString (Globe.SharedInstance.User.username, "username"); NSUserDefaults.StandardUserDefaults.SetString (Globe.SharedInstance.User.password, "password");//todo wtf ((AppDelegate)UIApplication.SharedApplication.Delegate).createTabBarController (); ((AppDelegate)UIApplication.SharedApplication.Delegate).Window.RootViewController = ((AppDelegate)UIApplication.SharedApplication.Delegate).TabBarController; ((AppDelegate)UIApplication.SharedApplication.Delegate).Window.MakeKeyAndVisible (); } catch (RESTError error) { if (error.StatusCode == 400 || error.StatusCode == -1) { UIAlertController AlertController = UIAlertController.Create (error.Message, null, UIAlertControllerStyle.Alert); AlertController.AddAction (UIAlertAction.Create (Strings.ok, UIAlertActionStyle.Default, null)); PresentViewController (AlertController, true, null); } } finally { hud.Hide (true); } }
void ShowOnWindow () { // The hud will dispable all input on the window hud = new MTMBProgressHUD (this.window); this.window.AddSubview(hud); // Regiser for DidHide Event so we can remove it from the window at the right time hud.DidHide += HandleDidHide; // Add information to your HUD hud.LabelText = "Loading"; // Show the HUD while the provided method executes in a new thread hud.Show (new MonoTouch.ObjCRuntime.Selector("MyTask"), this, null, true); }
void ShowWithLabelMixed () { // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) hud = new MTMBProgressHUD (this.navController.View); navController.View.AddSubview (hud); // Regiser for DidHide Event so we can remove it from the window at the right time hud.DidHide += HandleDidHide; // Add information to your HUD hud.LabelText = "Connecting"; hud.MinSize = new System.Drawing.SizeF(135f, 135f); // Show the HUD while the provided method executes in a new thread hud.Show (new MonoTouch.ObjCRuntime.Selector("MyMixedTask"), this, null, true); }
void ShowWithCustomView () { // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) hud = new MTMBProgressHUD (this.navController.View); navController.View.AddSubview (hud); // Set custom view mode hud.Mode = MBProgressHUDMode.CustomView; // The sample image is based on the work by http://www.pixelpressicons.com, http://creativecommons.org/licenses/by/2.5/ca/ // Make the customViews 37 by 37 pixels for best results (those are the bounds of the build-in progress indicators) hud.CustomView = new UIImageView (UIImage.FromBundle ("37x-Checkmark.png")); // Regiser for DidHide Event so we can remove it from the window at the right time hud.DidHide += HandleDidHide; // Add information to your HUD hud.LabelText = "Completed"; // Show the HUD hud.Show(true); // Hide the HUD after 3 seconds hud.Hide (true, 3); }
private void ShowMessage(string message) { var hud = new MTMBProgressHUD (View) { DetailsLabelText = message, RemoveFromSuperViewOnHide = true, DimBackground = false, AnimationType = MBProgressHUDAnimation.MBProgressHUDAnimationZoomIn, Mode = MBProgressHUDMode.Text }; View.AddSubview (hud); hud.Show (animated: true); hud.Hide (animated: true, delay: 1.5); }
/// <summary> /// All the configurations and event settings are handled here /// !!! This must be checked when the setting view controller is implemented !!! /// </summary> public override void ViewDidLoad() { Console.WriteLine("VCLieferantenDetails ViewDidLoad called " + this.ToString()); base.ViewDidLoad(); // Any additional setup after loading the view, typically from a nib. ConfigureView(); // Set the childcontroller that is selected according to the button that was selected // By default the GENERAL Button is clicked childController = _Storyboard.InstantiateViewController("TBGeneral") as TBGeneral; DisplayContentController(childController); // Create the UIManager Application._UIManager = new UIManager(this, childController); // Set it as an observer to the main Tableview, so that it is notified when a new row is clicked // and it is able to display the person's info in its title bar Application._mainModulePersonTableView.RegisterObserver(this); // Here the event of the button is managed MainSegmentedButtons.ValueChanged += async(object sender, EventArgs e) => { try { // Run the progressbar hud = new MTMBProgressHUD(this.TabBarController.View){ DimBackground = true, LabelText = LocalString.GetString("Loading") }; this.TabBarController.View.AddSubview(hud); hud.Show(true); UIViewController oldViewController = childController; switch ((int)MainSegmentedButtons.SelectedSegment) { case (int)IOS_Utilities.ViewButtons.General: { // General Button is clicked // First set the childcontroller // Then display it // Then manage the acions via UIManager childController = _Storyboard.InstantiateViewController("TBGeneral") as TBGeneral; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); await Application._UIManager.BtnGeneralFragmentClickAsync(childController); break; } case (int)IOS_Utilities.ViewButtons.Ansprechpartner: { // Ansprechpartner Button is clicked // First set the childcontroller // Then display the childcontroller // Then manage the actions via UIManager childController = _Storyboard.InstantiateViewController("TBAnsprechpartner") as TBAnsprechpartner; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); await Application._UIManager.BtnAnsprechpartnerFragmentClickAsync(childController); break; } case (int)IOS_Utilities.ViewButtons.Chart: { // Chart Button is clicked childController = _Storyboard.InstantiateViewController("TBChart") as TBChart; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); await Application._UIManager.BtnChartFragmentClickAsync(childController); break; } case (int)IOS_Utilities.ViewButtons.Map: { childController = _Storyboard.InstantiateViewController("TBMap") as TBMap; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); await Application._UIManager.BtnMapClickAsync(childController); // Map break; } case (int)IOS_Utilities.ViewButtons.Task: { // Tasks childController = _Storyboard.InstantiateViewController("TBTask") as TBTask; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); Console.WriteLine("Running Task Async"); await Application._UIManager.BtnTaskFragmentClickAsync(childController); Console.WriteLine("Finished Async"); break; } case (int)IOS_Utilities.ViewButtons.Angebot: { // Tasks childController = _Storyboard.InstantiateViewController("TBAngebot") as TBAngebot; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); Console.WriteLine("Running Angebot Async"); await Application._UIManager.BtnAngebotFragmentClickAsync(childController); Console.WriteLine("Finished Async"); break; } case (int)IOS_Utilities.ViewButtons.Auftrag: { // Tasks childController = _Storyboard.InstantiateViewController("TBAuftrag") as TBAuftrag; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); Console.WriteLine("Running Auftrag Async"); await Application._UIManager.BtnAuftragFragmentClickAsync(childController); Console.WriteLine("Finished Async"); break; } default: { return; } } } catch (Exception ex) { DataAccessLayer.ExceptionWriter.WriteLogFile(ex); } finally { // finallize the progressbar hud.RemoveFromSuperview(); hud = null; } }; // Create the satellite buttons that are visible on all views var temp = CreateMenuButton(); this.ButtonContainerView.Add(temp); }
/// <summary> /// Create the satellite buttons of the main view and assign the events to them /// Sets also the events for every menu button /// </summary> /// <returns>The menu button.</returns> public override SatelliteMenuButton CreateMenuButton() { int tag; var frame = new CGRect(10, 156, 44, 44); button1 = new SatelliteMenuButtonItem(UIImage.FromFile("Images/NewPage.png"), tag = 0, "New"); button2 = new SatelliteMenuButtonItem(UIImage.FromFile("Images/EditPage.png"), ++tag, "Edit"); button3 = new SatelliteMenuButtonItem(UIImage.FromFile("Images/DeletePage.png"), ++tag, "Delete"); button4 = new SatelliteMenuButtonItem(UIImage.FromFile("Images/DownloadPage.png"), ++tag, "Offline"); button5 = new SatelliteMenuButtonItem(UIImage.FromFile("Images/SavePage.png"), ++tag, "Save"); // Reset the MenuButton if there is something inside of it if (menu == null) menu = new SatelliteMenuButton(this.ButtonContainerView, UIImage.FromFile("Image/menu.png"), frame); else if (menu.Items.Length != 5) { foreach (SatelliteMenuButtonItem item in menu.Items) { menu.RemoveItem(item); } } //var frame = new RectangleF (MARGIN, View.Frame.Height - MARGIN - BUTTON_SIZE, BUTTON_SIZE, BUTTON_SIZE); menu = new SatelliteMenuButton(this.ButtonContainerView, UIImage.FromFile("Images/menu.png"), new [] { button1, button2, button3, button4, button5 }, frame); menu.Radius = 120; menu.RotateToSide = false; menu.MenuItemClick += async (_, args) => { bool result = false; try { // Run the progressbar switch (args.MenuItem.Name) { case "New": hud = new MTMBProgressHUD(this.TabBarController.View){ DimBackground = true, LabelText = LocalString.GetString("SavingData") }; this.TabBarController.View.AddSubview(hud); hud.Show(true); Application._UIManager.BtnNewClick(); break; case "Edit": hud = new MTMBProgressHUD(this.TabBarController.View){ DimBackground = true, LabelText = LocalString.GetString("SavingData") }; this.TabBarController.View.AddSubview(hud); hud.Show(true); Application._UIManager.BtnEditClick(); break; case "Delete": hud = new MTMBProgressHUD(this.TabBarController.View){ DimBackground = true, LabelText = LocalString.GetString("SavingData") }; this.TabBarController.View.AddSubview(hud); hud.Show(true); result = await Application._UIManager.BtnDeleteClickAsync(); if (result == true) MessageBox.ShowSavedSuccessfully(this.TabBarController.View, LocalString.GetString("DeletedSuccessfully")); break; case "Offline": if (Application._user.NetworkStatus == DataAccessLayer.NetworkState.Disconnected) return; progress = 0; hud = new MTMBProgressHUD(this.TabBarController.View) { Mode = MBProgressHUDMode.DeterminateHorizontalBar, LabelText = LocalString.GetString("DownloadingOffline") }; this.TabBarController.View.AddSubview(hud); hud.Progress = 0; hud.Show(true, MyProgressTask); result = await Application._UIManager.BtnOfflineClickAsync(); hud.Progress = 0.99f; await System.Threading.Tasks.Task.Delay(500); hud.Progress = 1.1f; if (result == true) MessageBox.ShowSavedSuccessfully(this.TabBarController.View, LocalString.GetString("SavedOfflineSuccessfully")); break; case "Save": result = await Application._UIManager.BtnSaveClickAsync(); if (result == true) MessageBox.ShowSavedSuccessfully(this.TabBarController.View, LocalString.GetString("SavedSuccessfully")); break; default: break; } } catch (Exception ex) { DataAccessLayer.ExceptionWriter.WriteLogFile(ex); } finally { Console.WriteLine("finally entered"); // finallize the progressbar if (hud != null) { hud.RemoveFromSuperview(); hud = null; } Console.WriteLine("finally finished"); } }; this.ButtonContainerView.Add(menu); return menu; }
/// <summary> /// Get the lieferanten according to the search text -> set it as the source for the tableview -> hide the keyboard /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">EventArgs.</param> private async void MainSearchBarClicked (object sender, EventArgs e ) { try { // Run the progressbar MainSearchBar.ResignFirstResponder(); hud = new MTMBProgressHUD (this.TabBarController.View){DimBackground = true, LabelText = LocalString.GetString("Loading")}; this.TabBarController.View.AddSubview (hud); hud.Show(true); // First let the UIManager manager the story and get the values _lieferanten = await Application._UIManager.BtnSearchLieferantenClickAsync (MainSearchBar.Text.Trim()); // Then fill the datasource and tableview dataSource.SetSource(_lieferanten); TableView.ReloadData(); // hide the keyboard MainSearchBar.ResignFirstResponder(); } catch (Exception ex) { DataAccessLayer.ExceptionWriter.WriteLogFile(ex); } finally { // finallize the progressbar hud.RemoveFromSuperview(); hud = null; } }
void ShowWithLabelDeterminateHorizontalBar () { // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) hud = new MTMBProgressHUD (navController.View); navController.View.AddSubview(hud); // Set determinate mode hud.Mode = MBProgressHUDMode.DeterminateHorizontalBar; // Regiser for DidHide Event so we can remove it from the window at the right time hud.DidHide += HandleDidHide; // Add information to your HUD hud.LabelText = "Loading"; // Show the HUD while the provided method executes in a new thread hud.Show (new MonoTouch.ObjCRuntime.Selector ("MyProgressTask"), this, null, true); }
async void MainSearchBar_Clicked(object sender, EventArgs e) { MainSearchBar.ResignFirstResponder(); TxtDummy.BecomeFirstResponder(); TxtDummy.ResignFirstResponder(); try { // Run the progressbar MainSearchBar.ResignFirstResponder(); hud = new MTMBProgressHUD (this.View){DimBackground = true, LabelText = LocalString.GetString("Loading")}; this.View.AddSubview (hud); hud.Show(true); // First let the UIManager manager the story and get the values _artikeln = await BusinessLayer.Artikel.GetArtikelnAsync (MainSearchBar.Text,Language.GetLanguageCode(), Application._user); // Then fill the datasource and tableview dataSource.SetSource(_artikeln); tableView.ReloadData(); // hide the keyboard MainSearchBar.ResignFirstResponder(); TxtDummy.BecomeFirstResponder(); TxtDummy.ResignFirstResponder(); } catch (Exception ex) { DataAccessLayer.ExceptionWriter.WriteLogFile(ex); } finally { // finallize the progressbar hud.RemoveFromSuperview(); hud = null; } }
async private void ReportPost() { var hud = new MTMBProgressHUD(View) { LabelText = Strings.reporting, RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(animated: true); try { bool result = await TenServices.ReportPost(post); FeedUtils.DeletePostFromAllFeedsIfExists(post); if (result) { NavigationController.PopViewController(true); } else { FailForUnknownReportPost(); } } catch (RESTError) { FailForUnknownReportPost(); } finally { hud.Hide(true); } }
/// <summary> /// All the configurations and event settings are handled here /// !!! This must be checked when the setting view controller is implemented !!! /// </summary> public override void ViewDidLoad () { Console.WriteLine("VCArtikelDetails ViewDidLoad called " + this.ToString()); base.ViewDidLoad (); // Any additional setup after loading the view, typically from a nib. ConfigureView (); // Set the childcontroller that is selected according to the button that was selected // By default the GENERAL Button is clicked childController = _Storyboard.InstantiateViewController ("TBGeneral") as TBGeneral; DisplayContentController(childController); // Create the UIManager Application._UIManager.ArtikelTabClick(this,(CustomUITableViewController)childController); // Set it as an observer to the main Tableview, so that it is notified when a new row is clicked // and it is able to display the person's info in its title bar Application._mainModuleArtikelTableView.RegisterObserver(this); // Here the event of the button is managed MainSegmentedButtons.ValueChanged += async(object sender, EventArgs e) => { try { // Run the progressbar hud = new MTMBProgressHUD (this.TabBarController.View){DimBackground = true, LabelText = LocalString.GetString("Loading")}; this.TabBarController.View.AddSubview (hud); hud.Show(true); UIViewController oldViewController = childController; switch((int) MainSegmentedButtons.SelectedSegment) { case (int)IOS_Utilities.ViewButtons.General: { // General Button is clicked // First set the childcontroller // Then display it // Then manage the acions via UIManager childController = _Storyboard.InstantiateViewController ("TBGeneralArtikel") as TBGeneralArtikel; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); await Application._UIManager.BtnGeneralFragmentClickAsync((CustomUITableViewController)childController); break; } case (int)IOS_Utilities.ViewButtons.Ansprechpartner: { childController = _Storyboard.InstantiateViewController ("TBVerfuegbarkeitArtikel") as TBVerfuegbarkeitArtikel; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); await Application._UIManager.BtnVerfuegbarkeitFragmentClickAsync((CustomUITableViewController)childController); break; } case (int)IOS_Utilities.ViewButtons.Chart: { childController = _Storyboard.InstantiateViewController ("VCArtikelPreisInfo") as VCArtikelPreisInfo; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); await Application._UIManager.BtnPreisInfoFragmentClickAsync((VCArtikelPreisInfo)childController); break; } case (int)IOS_Utilities.ViewButtons.Map : { childController = _Storyboard.InstantiateViewController ("TBCrossSelling") as TBCrossSelling; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); await Application._UIManager.BtnCrossSellingFragmentClickAsync((CustomUITableViewController)childController); break; } case (int)IOS_Utilities.ViewButtons.Task : { childController = _Storyboard.InstantiateViewController ("TBZubehoer") as TBZubehoer; DisplayContentController(childController); CycleFromViewControllerToViewController(oldViewController, childController); await Application._UIManager.BtnZubehoerFragmentClickAsync((CustomUITableViewController)childController); break; } // Here I have to declare different segmented buttons default: break; } } catch (Exception ex) { DataAccessLayer.ExceptionWriter.WriteLogFile(ex); } finally { // finallize the progressbar hud.RemoveFromSuperview(); hud = null; } }; }
void ShowWithDetailsLabel () { // The hud will dispable all input on the view (use the higest view possible in the view hierarchy) hud = new MTMBProgressHUD(this.navController.View); navController.View.AddSubview(hud); // Regiser for DidHide Event so we can remove it from the window at the right time hud.DidHide += HandleDidHide; // Add information to your HUD hud.LabelText = "Loading"; hud.DetailsLabelText = "updating data"; hud.Square = true; // Show the HUD while the provided method executes in a new thread hud.Show(new MonoTouch.ObjCRuntime.Selector("MyTask"), this, null, true); }
async private void ReportUser() { var hud = new MTMBProgressHUD(View) { LabelText = Strings.reporting, RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(true); try { bool flagged = await TenServices.ReportUser(Guest); if (flagged) { UIAlertController AlertController = UIAlertController.Create(Strings.sucess, null, UIAlertControllerStyle.ActionSheet); AlertController.AddAction(UIAlertAction.Create(Strings.ok, UIAlertActionStyle.Default, (UIAlertAction obj) => { hud.Hide(false); this.NavigationController.PopViewController(true); })); PresentViewController(AlertController, true, null); } } catch (RESTError e) { } hud.Hide(true); }
//IBActions async partial void addComment(Foundation.NSObject sender) { string text = StringUtils.TrimWhiteSpaceAndNewLine(inputField.Text); if (!String.IsNullOrEmpty(text) && text != Strings.add_a_comment_placeholder) { addCommentButton.Enabled = false; hideKeyboard(); var hud = new MTMBProgressHUD(View) { LabelText = Strings.adding_comment, RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(animated: true); try { Comment res = await TenServices.AddComment(post, text); if (res != null) { TableItems.Add(res); tableView.ReloadData(); IfEmpty(); inputField.Text = Strings.add_a_comment_placeholder; View.EndEditing(true); HeaderViewController.HighlightCommentButton(); } } catch (RESTError e) { if (e.Message == "Invalid comment length") { FailBecauseCommentLength(); } } finally { addCommentButton.Enabled = true; hud.Hide(true); } } }
async private void BlockOrUnblockUser() { var hud = new MTMBProgressHUD(View) { LabelText = (Guest.blocked) ? "Unblocking" : "Blocking", RemoveFromSuperViewOnHide = true }; View.AddSubview(hud); hud.Show(true); if (Guest.blocked) { try { bool unblocked = await TenServices.UnblockUser(Guest); if (unblocked) { Guest.blocked = false; await HeaderViewController.FetchHeaderData(); await postFeedTableViewController.FetchTableData(); } else { } } catch (RESTError) { } } else { try { bool blocked = await TenServices.BlockUser(Guest); if (blocked) { Guest.blocked = true; HeaderViewController.TopTimersUserFeedCollectionViewController.CollectionItems = null; HeaderViewController.TopTimersUserFeedCollectionViewController.CollectionView.ReloadData(); await HeaderViewController.FetchHeaderData(); await postFeedTableViewController.FetchTableData(); } } catch (RESTError) { } } hud.Hide(true); }