public static IProgressDialog Progress(UIApplication app, UIView view, ProgressConfig config) { app.SafeInvokeOnMainThread(() => { _progressHub = MBProgressHUD.ShowHUD(view, true); //_progressHub.Mode = MBProgressHUDMode.DeterminateHorizontalBar; _progressHub.Mode = MBProgressHUDMode.Determinate; _progressHub.Label.Text = config.Text; _progressHub.Label.LineBreakMode = UILineBreakMode.WordWrap; _progressHub.Label.Lines = int.MaxValue; _progressHub.MinShowTime = 1; // The minimum time (in seconds) that the HUD is shown. if (config.MarkType == MarkType.Black) { _progressHub.BackgroundView.Style = MBProgressHUDBackgroundStyle.SolidColor; _progressHub.BackgroundView.Color = UIColor.Black.ColorWithAlpha(0.5f); } if (config.Cancellable) { _progressHub.Button.SetTitle(config.CancelText, UIControlState.Normal); _progressHub.Button.AddTarget((_1, _2) => { config.CancelAction?.Invoke(); _progressHub.Hide(true); }, UIControlEvent.TouchUpInside); } _progressHub.Show(true); }); return(new DefaultProgressDialog(app, config, _progressHub)); }
void insertPeople(int numberOfPeople) { hud = new MBProgressHUD(); hud.Show(true); NameGenerator.GetPeopleAsync(numberOfPeople).ContinueWith(t => { if (t.Exception == null) { Database.Main.InsertPeople(t.Result).ContinueWith(t2 => { Database.Main.UpdateInstant <Person>(); this.BeginInvokeOnMainThread(delegate { if (t2.Exception != null) { Console.WriteLine(t2.Exception); (new UIAlertView("Error", "There was an error inserting people.", null, "Ok")).Show(); } hud.Hide(true); }); }); } else { Console.WriteLine(t.Exception); this.BeginInvokeOnMainThread(delegate { (new UIAlertView("Error", "There was an error generating names.", null, "Ok")).Show(); hud.Hide(true); }); } }); }
public override void ViewDidLoad() { base.ViewDidLoad(); MBProgressHUD hud = MBProgressHUD.ShowHUD(View, true); hud.Label.Text = "Loading..."; hud.Show(true); hud.Hide(true, 3.0f); }
public void starthud() { /* * _hud = new LoadingHUDView ("", ""); * this.View.AddSubview (_hud); * _hud.StartAnimating (); */ hud = new MBProgressHUD(base.View); hud.Mode = MBProgressHUDMode.Indeterminate; hud.TitleText = "iPortogruaro"; hud.DetailText = "Loading..."; this.View.AddSubview(hud); hud.Show(true); }
public static void DoWork(this UIViewController controller, Action work, Action <Exception> error = null, Action final = null) { MBProgressHUD hud = null; hud = new MBProgressHUD(controller.View.Superview) { Mode = MBProgressHUDMode.Indeterminate, TitleText = "Loading..." }; controller.View.Superview.AddSubview(hud); hud.Show(true); ThreadPool.QueueUserWorkItem(delegate { try { Utilities.PushNetworkActive(); work(); } catch (Exception e) { if (error != null) { error(e); } controller.InvokeOnMainThread(delegate { Utilities.ShowAlert("Error", e.Message); }); } finally { Utilities.PopNetworkActive(); if (final != null) { controller.InvokeOnMainThread(() => final()); } } if (hud != null) { controller.InvokeOnMainThread(delegate { hud.Hide(true); hud.RemoveFromSuperview(); }); } }); }
public static IDisposable Loading(UIApplication app, UIView view, LoadingConfig config) { app.SafeInvokeOnMainThread(() => { _loadingHub = MBProgressHUD.ShowHUD(view, true); _loadingHub.Mode = MBProgressHUDMode.Indeterminate; _loadingHub.Label.Text = config.Text; _loadingHub.Label.LineBreakMode = UILineBreakMode.WordWrap; _loadingHub.Label.Lines = int.MaxValue; _loadingHub.MinShowTime = 1; // The minimum time (in seconds) that the HUD is shown. if (config.MarkType == MarkType.Black) { _loadingHub.BackgroundView.Style = MBProgressHUDBackgroundStyle.SolidColor; _loadingHub.BackgroundView.Color = UIColor.Black.ColorWithAlpha(0.5f); } if (config.Cancellable) { _loadingHub.Button.SetTitle(config.CancelText, UIControlState.Normal); _loadingHub.Button.AddTarget((_1, _2) => { config.CancelAction?.Invoke(); _loadingHub.Hide(true); }, UIControlEvent.TouchUpInside); } _loadingHub.Show(true); if (config.Duration.HasValue) { _loadingHub.Hide(true, config.Duration.Value.TotalSeconds); } //_loadingHub.Hide(true, 3); // seconds }); return(new DisposableAction(() => _loadingHub.Hide(true))); }
public void starthud() { /* * _hud = new LoadingHUDView ("", ""); * this.View.AddSubview (_hud); * _hud.StartAnimating (); */ hud = new MBProgressHUD(base.View); hud.Mode = MBProgressHUDMode.Indeterminate; hud.TitleText = "iPortogruaro"; hud.DetailText = "Loading..."; this.View.AddSubview(hud); hud.Show(true); var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(indicator); indicator.StartAnimating(); this.NavigationItem.RightBarButtonItem = null; }
public static void Build(UIApplication app, UIView view, ToastConfig config) { app.SafeInvokeOnMainThread(() => { _hub = MBProgressHUD.ShowHUD(view, true); _hub.Mode = MBProgressHUDMode.Text; _hub.Label.Text = config.Message; _hub.Label.LineBreakMode = UILineBreakMode.WordWrap; _hub.Label.Lines = int.MaxValue; _hub.MinShowTime = 1; // The minimum time (in seconds) that the HUD is shown. _hub.UserInteractionEnabled = false; if (config.TextColor.HasValue) { _hub.Label.TextColor = config.TextColor.Value.ToNative(); } if (config.BackgroundColor.HasValue) { _hub.BezelView.BackgroundColor = config.BackgroundColor.Value.ToNative(); } if (config.Position == ToastPosition.Top) { _hub.Offset = new CoreGraphics.CGPoint(0, 0); } else if (config.Position == ToastPosition.Bottom || config.Position == ToastPosition.Default) { _hub.Offset = new CoreGraphics.CGPoint(0, 10000); } _hub.Show(true); _hub.Hide(true, config.Duration.TotalSeconds); }); }
public void StartHUD(string message) { UIViewController controller = UIApplication.SharedApplication.KeyWindow.RootViewController; hud = new MBProgressHUD(controller.View); controller.View.AddSubview(hud); // 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) UIImageView gif = AnimatedImageView.GetAnimatedImageView("https://i.stack.imgur.com/naLBK.gif"); hud.CustomView = gif; // Add information to your HUD hud.Label.Text = message; hud.BezelView.Color = UIColor.Clear; hud.BezelView.TintColor = UIColor.Clear; hud.BezelView.Style = MBProgressHUDBackgroundStyle.SolidColor; hud.BezelView.BlurEffectStyle = UIBlurEffectStyle.Dark; // Set custom view mode hud.Mode = MBProgressHUDMode.CustomView; hud.Show(true); }
public void Inicia(string mensagem, bool cancelavel) { _progressDialog.DetailsLabel.Text = mensagem; _progressDialog.UserInteractionEnabled = cancelavel; _progressDialog.Show(true); }
/// <summary> /// Begins the login process. /// </summary> private void BeginLogin() { MBProgressHUD hud = null; string username = null, password = null; Account loggedInAccount = null; //The nice hud InvokeOnMainThread(delegate { username = User.Text; password = Password.Text; hud = new MBProgressHUD(View) { Mode = MBProgressHUDMode.Indeterminate, TitleText = "Logging In..." }; View.AddSubview(hud); hud.Show(true); }); try { loggedInAccount = Login(username, password); } catch (Exception e) { Console.WriteLine("Error = " + e.Message); } InvokeOnMainThread(delegate { //Dismiss the hud hud.Hide(true); hud.RemoveFromSuperview(); if (loggedInAccount == null) { Utilities.ShowAlert("Unable to Authenticate", "Unable to login as user " + username + ". Please check your credentials and try again."); return; } var account = Application.Accounts.Find(loggedInAccount.Username); //Account does not exist! Add it! if (account == null) { account = loggedInAccount; Application.Accounts.Insert(account); } //Account already exists. Update the password just incase it changed... else { account.Password = Password.Text; account.Update(); Application.SetUser(account); } if (LoginComplete != null) { LoginComplete(account); } }); }