Beispiel #1
0
        public void ProcessContentSearchRequest(NSNotification obj)
        {
            var hud = new MTMBProgressHUD(View)
            {
                LabelText = "Loading",
                RemoveFromSuperViewOnHide = true
            };

            View.AddSubview(hud);
            hud.Show(animated: true);

            string       keyword = SearchBar.Text;
            SearchResult res     = SearchUtil.Search(AppDataUtil.Instance.GetCurrentPublication().BookId, AppDataUtil.Instance.GetOpendTOC().ID, keyword);

            if (AppDisplayUtil.Instance.ContentSearchResController != null)
            {
                AppDisplayUtil.Instance.ContentSearchResController.View.RemoveFromSuperview();
            }
            AppDisplayUtil.Instance.ContentSearchResController = new ResultViewController(res);
            AppDisplayUtil.Instance.ContentSearchResController.View.TranslatesAutoresizingMaskIntoConstraints = false;
            ContainerView.AddSubview(AppDisplayUtil.Instance.ContentSearchResController.View);
            ContainerView.AddConstraints(new NSLayoutConstraint[] {
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Top, 1, 0),
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Bottom, 1, 0),
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Leading, 1, 0),
                NSLayoutConstraint.Create(AppDisplayUtil.Instance.ContentSearchResController.View, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, ContainerView, NSLayoutAttribute.Trailing, 1, 0)
            });

            hud.Hide(animated: true, delay: 0.2);
        }
Beispiel #2
0
        public AppLoadingHUD(UIViewController controller)
        {
            UIView view = UIViewControllersUtils.GetPresentedViewController().View;

            view.BackgroundColor = UIColor.Black;

            _hud = new MTMBProgressHUD(view)
            {
                RemoveFromSuperViewOnHide = true,
                BackgroundColor           = UIColor.Black.ColorWithAlpha((float)0.7)
            };

            _hud.Mode          = MBProgressHUDMode.CustomView;
            _hud.DimBackground = false;

            _hud.Square     = true;
            _hud.LabelText  = @"";
            _hud.Color      = UIColor.Clear;
            _hud.LabelColor = UIColor.Clear;


            view.AddSubview(_hud);

            UIImageView imageView = new UIImageView(CGRect.FromLTRB(0, 0, 45, 45));
            var         url       = NSBundle.MainBundle.GetUrlForResource("loading", "gif", "Loading");

            imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            imageView.SetImage(url);
            _hud.CustomView = imageView;



            _hud.Show(animated: true);
        }
        private async void saveRecord()
        {
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;

            //Assign user set values back to object, and persist back to cloud
            detailItem.Title       = txtName.Text;
            detailItem.Description = txtDescription.Text;
            detailItem.Quantity    = int.Parse(txtQuantity.Text);

            _hud.Show(animated: true);

            if (!string.IsNullOrEmpty(detailItem.id))
            {
                await GroceryService.UpdateGroceryItemAsync(detailItem);
            }
            else
            {
                await GroceryService.CreateGroceryItemAsync(detailItem);
            }

            _hud.Hide(animated: true, delay: 5);

            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;

            NavigationController.PopViewControllerAnimated(true);
        }
Beispiel #4
0
        void ShowWithCustomView()
        {
            // 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 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);
        }
Beispiel #5
0
        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");
        }
Beispiel #6
0
 /// <summary>
 /// This function show progress view over window.
 /// </summary>
 /// <param name="text">Text.</param>
 public static void showProgressHud(String text)
 {
     if (hud == null)
     {
         hud = new MTMBProgressHUD(AppDelegate.GetSharedInstance().Window);
         AppDelegate.GetMainWindow().AddSubview(hud);
         hud.Show(true);
         hud.LabelText = text;
     }
 }
 public static void ShowProgress(UIView View)
 {
     hud = new MTMBProgressHUD(View)
     {
         LabelText = "Waiting...",
         RemoveFromSuperViewOnHide = true
     };
     View.AddSubview(hud);
     hud.Show(animated: true);
 }
Beispiel #8
0
        /// <summary>
        /// Shows the toast message.
        /// </summary>
        /// <param name="msg">Message to display.</param>
        public static void showToast(string msg)
        {
            //show message for activation/deactivation hero mode
            MTMBProgressHUD toast = new MTMBProgressHUD(AppDelegate.GetSharedInstance().Window);

            AppDelegate.GetMainWindow().AddSubview(toast);
            toast.Mode = MBProgressHUDMode.Text;
            toast.Show(true);
            toast.DetailsLabelText          = msg;
            toast.RemoveFromSuperViewOnHide = true;
            toast.Hide(true, 1);
        }
Beispiel #9
0
        void ShowSimple()
        {
            // 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);

            // 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 Selector("MyTask"), this, null, true);
        }
Beispiel #10
0
 private void DisplayProgress(string details)
 {
     hud = new MTMBProgressHUD(View)
     {
         LabelText                 = "Updating",
         DetailsLabelText          = details,
         RemoveFromSuperViewOnHide = true,
         DimBackground             = true
     };
     View.AddSubview(hud);
     hud.Show(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);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            ConfigureView();

            txtDescription.EditingDidEnd += HandleEditingDidEnd;
            txtDescription.Delegate       = new CatchEnterDelegate();

            txtQuantity.EditingDidEnd += HandleEditingDidEnd;
            txtQuantity.Delegate       = new CatchEnterDelegate();

            txtName.EditingDidEnd += HandleEditingDidEnd;
            txtName.Delegate       = new CatchEnterDelegate();

            _hud = new MTMBProgressHUD(View)
            {
                LabelText = "Saving...",
                RemoveFromSuperViewOnHide = true
            };

            View.AddSubview(_hud);

            btnSave.TouchUpInside += (object sender, EventArgs e) => {
                //Assign user set values back to object, and persist back to cloud
                detailItem.Title       = txtName.Text;
                detailItem.Description = txtDescription.Text;
                detailItem.Quantity    = int.Parse(txtQuantity.Text);

                _hud.Show(animated: true);

                //Use Task Parallel Library (TPL) to show a status message while the data is saving
                Task.Factory.StartNew(() => {
                    if (!string.IsNullOrEmpty(detailItem.ObjectId))
                    {
                        GroceryService.UpdateGroceryItem(detailItem);
                    }
                    else
                    {
                        GroceryService.CreateGroceryItem(detailItem);
                    }

                    System.Threading.Thread.Sleep(new TimeSpan(0, 0, 5));
                }).ContinueWith((prevTask) => {
                    _hud.Hide(animated: true, delay: 5);
                    NavigationController.PopViewControllerAnimated(true);
                }, TaskScheduler.FromCurrentSynchronizationContext());
            };
        }
        void HandlePeripheralSelected(object sender, PeripheralSelectedEventArgs e)
        {
            StopScanning();

            // show our connecting... overlay
            connectingDialog.LabelText = string.Format("Connecting to {0}", e.SelectedPeripheral.Name);
            connectingDialog.Show(true);

            // when the peripheral connects, load our details screen
            BluetoothLEManager.Current.DeviceConnected += HandleDeviceConnected;

            // try and connect to the peripheral
            BluetoothLEManager.Current.CentralBleManager.ConnectPeripheral(e.SelectedPeripheral, new PeripheralConnectionOptions());
        }
        public void ShowLoading()
        {
            HideLoading();
            var view = ((AppDelegate)UIApplication.SharedApplication.Delegate).Window;

            progressDialog = new MTMBProgressHUD(view)
            {
                RemoveFromSuperViewOnHide = true,
                TintColor = Colors.White,
            };

            view.AddSubview(progressDialog);
            view.BringSubviewToFront(progressDialog);
            progressDialog.Show(true);
        }
Beispiel #15
0
        void ShowOnWindow()
        {
            // The hud will dispable all input on the window
            hud = new MTMBProgressHUD(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 Selector("MyTask"), this, null, true);
        }
Beispiel #16
0
        void ShowWithLabel()
        {
            // 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);

            // 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);
        }
Beispiel #17
0
        void ShowWithColor()
        {
            // 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 the hud to display with a color
            hud.Color = new UIColor(0.23f, 0.5f, 0.82f, 0.90f);

            // 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);
        }
        void ShowWithGradient()
        {
            // 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 HUD to dim Background
            hud.DimBackground = true;

            // 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);
        }
Beispiel #19
0
        public static void ShowSimpleHUD(this UIViewController vc, string message)
        {
            vc.HideHUD();

            var hud = new MTMBProgressHUD(vc.NavigationController.View)
            {
                LabelText = message,
                Mode      = MBProgressHUDMode.Text,
                RemoveFromSuperViewOnHide = true
            };

            vc.NavigationController.View.AddSubview(hud);
            hud.Show(true);
            hud.Hide(true, 1.5);
        }
Beispiel #20
0
        public static void ShowHUD(this UIViewController vc, string message)
        {
            vc.HideHUD();

            var hud = new MTMBProgressHUD(vc.NavigationController.View)
            {
                LabelText = message,
                RemoveFromSuperViewOnHide = true
            };

            vc.NavigationController.View.AddSubview(hud);
            hud.Show(true);

            currentHud = hud;
        }
Beispiel #21
0
        void ShowWithLabelMixed()
        {
            // 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);

            // 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 Selector("MyMixedTask"), this, null, true);
        }
Beispiel #22
0
        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);
        }
Beispiel #23
0
        public void ShowHud(String message)
        {
            if (Hud == null)
            {
                Hud = new MTMBProgressHUD(View);
            }

            MTMBProgressHUD.Appearance.TintColor = UIColor.Red;

            Hud.RemoveFromSuperViewOnHide = true;
            Hud.Color         = ColorUtils.GetColor(Slink.ColorUtils.ColorType.Theme);
            Hud.LabelText     = message;
            Hud.LabelColor    = UIColor.White;
            Hud.DimBackground = true;
            View.AddSubview(Hud);
            Hud.Show(true);
        }
Beispiel #24
0
        /// <summary>
        /// refresh the publication list which displayed in scroll view
        /// invoked when user delete or sorting publication
        /// </summary>
        public void ReloadPublicationList()
        {
            var hud = new MTMBProgressHUD(View)
            {
                LabelText = "Loading",
                RemoveFromSuperViewOnHide = true
            };

            View.AddSubview(hud);
            hud.Show(animated: true);


            UpdatePublicationViewList();
            ShowPublicationViews();

            hud.Hide(animated: true, delay: 0.2);
        }
Beispiel #25
0
        void ShowUsingHandlers()
        {
            // 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);

            // 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;
            });
        }
    public async Task LoginButton_click(UIButton sender)
    {
        hud = new MTMBProgressHUD(View)
        {
            LabelText = "Waiting...",
            RemoveFromSuperViewOnHide = true,
        };

        View.AddSubview(hud);
        hud.Show(animated: true);


        APIClient ApiClient   = new APIClient();
        TestAPI   cd          = new TestAPI(ApiClient);
        var       apiResponse = await cd.ExecuteAsync <YourType>();

        hud.Hide(animated: true);
    }
        public void Show(string text = null)
        {
            if (_hud == null)
            {
                _hud = new MTMBProgressHUD(_currentView)
                {
                    RemoveFromSuperViewOnHide = true,
                    DimBackground             = true
                };
            }

            if (string.IsNullOrEmpty(text) == false)
            {
                _hud.LabelText = text;
            }

            _currentView.AddSubview(_hud);
            _hud.Show(true);
        }
Beispiel #28
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            bearerToken = "";
            var appDlg = (AppDelegate)UIApplication.SharedApplication.Delegate;

            searchManager = new SearchManager(appDlg.conn);

            hud = new MTMBProgressHUD(View)
            {
                LabelText = "Searching Twitter...",
                RemoveFromSuperViewOnHide = true
            };
            View.AddSubview(hud);
            hud.Show(animated: true);
            loadTweets();
        }
        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();
        }
Beispiel #30
0
        public async override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            var hud = new MTMBProgressHUD(View)
            {
                LabelText = "Loading",
                RemoveFromSuperViewOnHide = true
            };

            View.AddSubview(hud);
            hud.Show(animated: true);
            hud.Hide(animated: true, delay: 0.5);

            var onlinePublicationList = await  GetLatestPublicationList();

            if (onlinePublicationList != null)
            {
                publicationList = onlinePublicationList;
                UpdatePublicationViewList();
                ShowPublicationViews();
            }
        }