public static void dismissGlobalHUD() { UIWindow window = UIApplication.SharedApplication.KeyWindow; MBProgressHUD.HideAllHUDsForView(window, true); CATransaction.Commit(); }
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 void stophud() { /* * if (_hud == null) * return; * _hud.StopAnimating (); * _hud.RemoveFromSuperview (); * _hud.Dispose (); * _hud = null; */ if (hud == null) { return; } hud.Hide(true); hud.RemoveFromSuperview(); // hud.Dispose (); hud = null; this.NavigationItem.LeftBarButtonItem = null; this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Search, delegate { showSearchBox(); }); }
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)); }
public static void showGlobalProgressHUDWithTitle(string title) { UIWindow window = UIApplication.SharedApplication.KeyWindow; MBProgressHUD hud = MBProgressHUD.ShowHUDAddedTo(window, true); hud.LabelText = title; CATransaction.Commit(); }
public void HideProgressDialog() { UIViewController rootVC = ((AppDelegate)UIApplication.SharedApplication.Delegate).Presenter.MasterNavigationController; UIApplication.SharedApplication.InvokeOnMainThread(() => { MBProgressHUD.HideHUDForView(rootVC.View, 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 override void ShowHUDInView(UIKit.UIView view, string message, Interactor interactor) { if (Instance == null) { Instance = MBProgressHUD.ShowHUDAddedTo(view, true); } ConfigureAndShowHUD(Instance, NSBundle.FromPath(NSBundle.MainBundle.PathForResource(LanguageHelper.Language, "lproj")).LocalizedString("Loading...", null), ProgressCloseMode.ManualClose, ProgressSpinnerMode.IndeterminateSpinner); }
private void SubmitAndCreate(object sender, EventArgs e) { var cloudName = CloudNameBox.Text; var deviceName = DeviceNameBox.Text; var invalidCharHit = false; foreach (var character in PathConsts.InvalidCharacters) { if (deviceName?.Contains(character) == true) { invalidCharHit = true; } } if (string.IsNullOrWhiteSpace(deviceName) || invalidCharHit) { this.ShowWarning(this.Localize("Settings.BadDeviceName"), this.Localize("Settings.NoSpecialCharacters")); return; } if (string.IsNullOrWhiteSpace(cloudName)) { this.ShowError(this.Localize("Settings.BadCloudName"), this.Localize("Settings.CloudNameCannotBeEmpty")); return; } var hud = MBProgressHUD.ShowHUD(NavigationController.View, true); hud.Label.Text = this.Localize("Welcome.Creating"); Task.Run(async() => { try { Globals.CloudManager.CreatePersonalCloud(cloudName, deviceName); Globals.Database.SaveSetting(UserSettings.DeviceName, deviceName); InvokeOnMainThread(() => { hud.Hide(true); this.ShowConfirmation(this.Localize("Welcome.Created"), string.Format(CultureInfo.InvariantCulture, this.Localize("Welcome.CreatedCloud.Formattable"), cloudName), () => { NavigationController.DismissViewController(true, null); }); }); } catch { InvokeOnMainThread(() => { hud.Hide(true); this.ShowError(this.Localize("Error.CreateCloud")); }); } }); }
public void ShowProgressDialog(string message = "") { UIViewController rootVC = ((AppDelegate)UIApplication.SharedApplication.Delegate).Presenter.MasterNavigationController; UIApplication.SharedApplication.InvokeOnMainThread(() => { MBProgressHUD hud = MBProgressHUD.HUDForView(rootVC.View); if (hud == null) { hud = MBProgressHUD.ShowHUDAddedTo(rootVC.View, true); } hud.UserInteractionEnabled = true; hud.DetailsLabel.Text = message; }); }
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 override void HideHUDFromView(UIKit.UIView view, string message, Interactor interactor, Foundation.NSError error) { if (message != null) { if (Instance == null) { Instance = MBProgressHUD.ShowHUDAddedTo(view, true); } ConfigureAndShowHUD(Instance, NSBundle.MainBundle.LocalizedString("Loading...", null), (error == null ? ProgressCloseMode.Autoclose_TouchClosable : ProgressCloseMode.ManualClose_TouchClosable), ProgressSpinnerMode.IndeterminateSpinner); } else { HideHud(); } }
public void stophud(bool sw) { /* * if (_hud == null) * return; * _hud.StopAnimating (); * _hud.RemoveFromSuperview (); * _hud.Dispose (); * _hud = null; */ if (hud == null) { return; } hud.Hide(true); hud.RemoveFromSuperview(); // hud.Dispose (); hud = null; }
public void ShowToast(string message, int timeoutMs = 1500) { UIWindow window = ((AppDelegate)UIApplication.SharedApplication.Delegate).Window; UIApplication.SharedApplication.InvokeOnMainThread(() => { MBProgressHUD hud = MBProgressHUD.ShowHUDAddedTo(window, true); hud.Mode = MBProgressHUDMode.Text; hud.DetailsLabel.Text = message; hud.RemoveFromSuperViewOnHide = true; hud.Margin = 10f; hud.BezelView.BackgroundColor = UIColor.Black; hud.DetailsLabel.TextColor = UIColor.White; hud.HideAnimated(true, timeoutMs * 1.0 / 1000); }); }
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); }
private void VerifyCredentials(object sender, EventArgs e) { var name = ServiceName.Text; var invalidCharHit = false; foreach (var character in PathConsts.InvalidCharacters) { #pragma warning disable CA1307 // Specify StringComparison if (name?.Contains(character) == true) { invalidCharHit = true; } #pragma warning restore CA1307 // Specify StringComparison } if (string.IsNullOrEmpty(name) || invalidCharHit) { this.ShowWarning(this.Localize("Online.BadName"), this.Localize("Online.IllegalName"), () => { ServiceName.BecomeFirstResponder(); }); return; } var endpoint = Endpoint.Text; if (string.IsNullOrEmpty(endpoint)) { this.ShowWarning(this.Localize("Online.BadCredential"), this.Localize("AliYun.BadEndpoint"), () => { Endpoint.BecomeFirstResponder(); }); return; } var bucket = BucketName.Text; if (string.IsNullOrEmpty(bucket)) { this.ShowWarning(this.Localize("Online.BadCredential"), this.Localize("AliYun.BadBucket"), () => { BucketName.BecomeFirstResponder(); }); return; } var accessId = AccessKeyID.Text; if (string.IsNullOrEmpty(accessId)) { this.ShowWarning(this.Localize("Online.BadCredential"), this.Localize("AliYun.BadUserID"), () => { AccessKeyID.BecomeFirstResponder(); }); return; } var accessSecret = AccessKeySecret.Text; if (string.IsNullOrEmpty(accessSecret)) { this.ShowWarning(this.Localize("Online.BadCredential"), this.Localize("AliYun.BadUserSecret"), () => { AccessKeySecret.BecomeFirstResponder(); }); return; } if (!Globals.Database.IsStorageNameUnique(name)) { this.ShowWarning(this.Localize("Online.ServiceAlreadyExists"), this.Localize("Online.ChooseADifferentName"), () => { ServiceName.BecomeFirstResponder(); }); return; } var hud = MBProgressHUD.ShowHUD(NavigationController.View, true); hud.Label.Text = this.Localize("Online.Verifying"); Task.Run(() => { var config = new OssConfig { OssEndpoint = endpoint, BucketName = bucket, AccessKeyId = accessId, AccessKeySecret = accessSecret }; if (config.Verify()) { try { Globals.CloudManager.AddStorageProvider(Globals.CloudManager.PersonalClouds[0].Id, Guid.NewGuid(), name, config, visibility); InvokeOnMainThread(() => { hud.Hide(true); NavigationController.DismissViewController(true, null); }); } catch { InvokeOnMainThread(() => { hud.Hide(true); this.ShowError(this.Localize("AliYun.CannotAddService"), this.Localize("Error.Internal")); }); } } else { InvokeOnMainThread(() => { hud.Hide(true); this.ShowError(this.Localize("Error.Authentication"), this.Localize("AliYun.Unauthorized")); }); } }); }
private void VerifyInvite(object sender, EventArgs e) { var deviceName = DeviceNameBox.Text; var inviteCode = InviteCodeBox.Text; var invalidCharHit = false; foreach (var character in PathConsts.InvalidCharacters) { if (deviceName?.Contains(character) == true) { invalidCharHit = true; } } if (string.IsNullOrWhiteSpace(deviceName) || invalidCharHit) { this.ShowWarning(this.Localize("Settings.BadDeviceName"), this.Localize("Settings.NoSpecialCharacters")); return; } if (inviteCode?.Length != 4) { this.ShowError(this.Localize("Settings.BadInvitation"), this.Localize("Settings.EnterValidInvitation")); return; } var hud = MBProgressHUD.ShowHUD(NavigationController.View, true); hud.Label.Text = this.Localize("Welcome.Verifying"); Task.Run(async() => { try { var result = await Globals.CloudManager.JoinPersonalCloud(int.Parse(inviteCode, CultureInfo.InvariantCulture), deviceName).ConfigureAwait(false); Globals.Database.SaveSetting(UserSettings.DeviceName, deviceName); InvokeOnMainThread(() => { hud.Hide(true); this.ShowConfirmation(this.Localize("Welcome.Accepted"), string.Format(CultureInfo.InvariantCulture, this.Localize("Welcome.AcceptedByCloud.Formattable"), result.DisplayName), () => { NavigationController.DismissViewController(true, null); }); }); } catch (NoDeviceResponseException) { InvokeOnMainThread(() => { hud.Hide(true); this.ShowError(this.Localize("Error.EnrollDevice"), this.Localize("Error.NoCloudInNetwork")); }); } catch (InviteNotAcceptedException) { InvokeOnMainThread(() => { hud.Hide(true); this.ShowError(this.Localize("Error.EnrollDevice"), this.Localize("Settings.EnterValidInvitation")); }); } catch { InvokeOnMainThread(() => { hud.Hide(true); this.ShowError(this.Localize("Error.EnrollDevice")); }); } }); }
public DialogCarregamentoiOS() { _progressDialog = new MBProgressHUD(); }
/// <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); } }); }
public static bool HideHUDForView(UIView view, bool animated) { return(MBProgressHUD.HideHUDForView(view, animated)); }
public static MBProgressHUD HUDForView(UIView view) { return(MBProgressHUD.HUDForView(view)); }
public void DisposeHUD() { hud.Hide(true, 3.0f); hud = null; }
public static MBProgressHUD ShowHUDAddedTo(UIView view, bool animated) { return(MBProgressHUD.ShowHUDAddedTo(view, animated)); }
public DefaultProgressDialog(UIApplication app, ProgressConfig config, MBProgressHUD hub) { _app = app; _config = config; _hub = hub; }
private void VerifyCredentials(object sender, EventArgs e) { var name = ServiceName.Text; var invalidCharHit = false; foreach (var character in PathConsts.InvalidCharacters) { if (name?.Contains(character) == true) { invalidCharHit = true; } } if (string.IsNullOrEmpty(name) || invalidCharHit) { this.ShowWarning(this.Localize("Online.BadName"), this.Localize("Online.IllegalName"), () => { ServiceName.BecomeFirstResponder(); }); return; } var endpoint = EndpointSuffix.Text; if (string.IsNullOrEmpty(endpoint)) { this.ShowWarning(this.Localize("Online.BadCredential"), this.Localize("Azure.BadEndpoint"), () => { EndpointSuffix.BecomeFirstResponder(); }); return; } var accountName = AccountName.Text; var accessKey = AccountKey.Text; if (string.IsNullOrEmpty(accessKey)) { this.ShowWarning(this.Localize("Online.BadCredential"), this.Localize("Azure.BadAccountKey"), () => { AccountKey.BecomeFirstResponder(); }); return; } var container = Container.Text; if (string.IsNullOrEmpty(container)) { this.ShowWarning(this.Localize("Online.BadCredential"), this.Localize("Azure.BadContainer"), () => { Container.BecomeFirstResponder(); }); return; } if (!Globals.Database.IsStorageNameUnique(name)) { this.ShowWarning(this.Localize("Online.ServiceAlreadyExists"), this.Localize("Online.ChooseADifferentName"), () => { ServiceName.BecomeFirstResponder(); }); return; } string connection; if (endpoint.Contains(accountName, StringComparison.Ordinal)) { accountName = null; } if (endpoint.StartsWith("http://", StringComparison.Ordinal)) { endpoint = endpoint.Replace("http://", "https://"); } if (endpoint.StartsWith("https://", StringComparison.Ordinal)) { if (string.IsNullOrEmpty(accountName)) { if (string.IsNullOrEmpty(accessKey)) { connection = endpoint; } else { connection = $"BlobEndpoint={endpoint};SharedAccessSignature={accessKey}"; } } else { this.ShowError(this.Localize("Azure.BadAccount"), this.Localize("Azure.EndpointAndNameMismatch")); return; } } else { if (string.IsNullOrEmpty(accountName)) { this.ShowError(this.Localize("Online.BadCredential"), this.Localize("Azure.BadAccountName")); return; } else { connection = $"DefaultEndpointsProtocol=https;AccountName={accountName};AccountKey={accessKey};EndpointSuffix={endpoint}"; } } var hud = MBProgressHUD.ShowHUD(NavigationController.View, true); hud.Label.Text = this.Localize("Online.Verifying"); Task.Run(() => { var config = new AzureBlobConfig { ConnectionString = connection, BlobName = container }; if (config.Verify()) { try { Globals.CloudManager.AddStorageProvider(Globals.CloudManager.PersonalClouds[0].Id, Guid.NewGuid(), name, config, visibility); InvokeOnMainThread(() => { hud.Hide(true); NavigationController.DismissViewController(true, null); }); } catch { InvokeOnMainThread(() => { hud.Hide(true); this.ShowError(this.Localize("Azure.CannotAddService"), this.Localize("Error.Internal")); }); } } else { InvokeOnMainThread(() => { hud.Hide(true); this.ShowError(this.Localize("Error.Authentication"), this.Localize("Azure.Unauthorized")); }); } }); }