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 void ViewDidLoad () { base.ViewDidLoad (); userPro = new UserProcess (); hud = new MTMBProgressHUD (this.View) { LabelText = "Waiting...", RemoveFromSuperViewOnHide = true, DimBackground = true }; this.View.AddSubview (hud); this.NavigationController.NavigationBarHidden = true; this.View.BackgroundColor = UIColor.FromRGB (230, 236, 245); imgView = new UIImageView (new CoreGraphics.CGRect (0, 0, this.View.Frame.Width, this.View.Frame.Height)); imgView.Image = UIImage.FromFile ("System/bg.png"); btnGoMain = new UIButton (UIButtonType.System); btnGoMain.Frame = new CoreGraphics.CGRect (this.View.Frame.Width / 2 - 100, this.View.Frame.Height / 2 + 150, 200, 50); btnGoMain.SetTitle ("开启DIY定制", UIControlState.Normal); btnGoMain.SetTitleColor (UIColor.White, UIControlState.Normal); btnGoMain.Font = UIFont.FromName ("Helvetica-Bold", 30f); btnGoMain.TouchUpInside += btnGoMain_TouchUpInside; btnLogout = new UIButton (UIButtonType.System); btnLogout.SetImage (UIImage.FromFile ("System/椭圆 1.png"), UIControlState.Normal); btnLogout.Frame = new CoreGraphics.CGRect (980, 25, 30, 30); btnLogout.BackgroundColor = UIColor.White; btnLogout.TouchUpInside += BtnLogout_TouchUpInside; this.View.AddSubviews (imgView, btnGoMain, btnLogout); }
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 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); } }
public static MTMBProgressHUD CreateLoaderForView(UIView view) { var hud = new MTMBProgressHUD (view) { LabelText = "Recognising text in image...", RemoveFromSuperViewOnHide = true }; view.AddSubview (hud); return hud; }
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); }
public override void ViewDidLoad() { base.ViewDidLoad(); var refreshControl = new UIRefreshControl(); this.RefreshControl = refreshControl; this.RefreshControl.ValueChanged += this.OnRefreshControlValueChanged; this.progressHud = new MTMBProgressHUD(View) { LabelText = "Loading...", RemoveFromSuperViewOnHide = true }; View.AddSubview(this.progressHud); this.progressHud.Show(animated: true); this.facilityService.LoginCompletedAction = this.RetrieveRequests; this.facilityService.LoginAsync(true, ConfigurationHub.ReadConfigurationValue("AadAuthority"), ConfigurationHub.ReadConfigurationValue("AppRedirectLocation"), ConfigurationHub.ReadConfigurationValue("AadRedirectResourceURI"), ConfigurationHub.ReadConfigurationValue("AadClientID")); }
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); } }
public void Display(string body) { UIView view = UIApplication.SharedApplication.KeyWindow.RootViewController.View; UIView finalView = new UIView(); List<UIView> subviews = view.Subviews.ToList(); if(subviews.Count > 0) { finalView = subviews[subviews.Count - 1]; }else { finalView = view; } if (Hud == null) { Hud = new MTMBProgressHUD(finalView) { LabelText = body, RemoveFromSuperViewOnHide = true, Mode = MBProgressHUDMode.Text }; } finalView.AddSubview(Hud); Hud.Show(animated: true); }
public virtual void HudWasHidden (MTMBProgressHUD hud) { throw new You_Should_Not_Call_base_In_This_Method (); }
public static void HudWasHidden (this IMBProgressHUDDelegate This, MTMBProgressHUD hud) { if (hud == null) throw new ArgumentNullException ("hud"); ApiDefinition.Messaging.void_objc_msgSend_IntPtr (This.Handle, Selector.GetHandle ("hudWasHidden:"), hud.Handle); }
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); }
public MyNSUrlConnectionDelegete (AppDelegate del, MTMBProgressHUD hud) { this.del = del; this.hud = hud; }
void HandleDidHide (object sender, EventArgs e) { hud.RemoveFromSuperview(); hud = null; }
void ShowUrl () { // Show the hud on top most view hud = MTMBProgressHUD.ShowHUD(this.navController.View, true); // Regiser for DidHide Event so we can remove it from the window at the right time hud.DidHide += HandleDidHide; NSUrl url = new NSUrl("https://github.com/matej/MBProgressHUD/zipball/master"); NSUrlRequest request = new NSUrlRequest(url); NSUrlConnection connection = new NSUrlConnection(request, new MyNSUrlConnectionDelegete(this, hud)); connection.Start(); }
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 ShowUsingHandlers () { // 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); // Add information to your HUD hud.LabelText = "With a handler"; // We show the hud while executing MyTask, and then we clean up hud.Show (true, () => { MyTask(); }, () => { 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); } }
//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); } } }
void ShowTextOnly () { // Show the hud on top most view hud = MTMBProgressHUD.ShowHUD(this.navController.View, true); // Configure for text only and offset down hud.Mode = MBProgressHUDMode.Text; hud.LabelText = "Some message..."; hud.Margin = 10f; hud.YOffset = 150f; hud.RemoveFromSuperViewOnHide = true; hud.Hide(true, 3); }