private LoadingIndicator() : base()
		{
			int ScreenWidth = Platform.ScreenWidth;
			int ScreenHeight = Platform.ScreenHeight - 80;
			const int Padding = 10;
			const int TextWidth = 65;
			const int SpinnerSize = 20;
			const int SeparateWidth = 5;
			const int Width = Padding + SpinnerSize + SeparateWidth + TextWidth + Padding;
			const int Height = Padding + SpinnerSize + Padding;
		
			Frame = new RectangleF((ScreenWidth - Width) / 2, ScreenHeight / 2, Width, Height);
			BackgroundColor = UIColor.FromWhiteAlpha(0.5f, 0.5f);
			
			spinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge)
            {
				Frame = new RectangleF(Padding, Padding, SpinnerSize, SpinnerSize)
			};
			
			label = new UILabel
            {
				Frame = new RectangleF(Padding + SpinnerSize + SeparateWidth, Padding, TextWidth, SpinnerSize),
				Text = "Loading...",
				TextColor = StyleExtensions.lightGrayText,
				BackgroundColor = StyleExtensions.transparent,
				AdjustsFontSizeToFitWidth = true
			};
			
			AddSubview(label);
			AddSubview(spinner);
			
			Hidden = true;
		}
		async public override void WillDisplay(UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
		{
			if (cell.RespondsToSelector(new ObjCRuntime.Selector("setSeparatorInset:")))
			{
				cell.SeparatorInset = UIEdgeInsets.Zero;
			}
			if (cell.RespondsToSelector(new ObjCRuntime.Selector("setPreservesSuperviewLayoutMargins:")))
			{
				cell.PreservesSuperviewLayoutMargins = false;
			}
			if (cell.RespondsToSelector(new ObjCRuntime.Selector("setLayoutMargins:")))
			{
				cell.LayoutMargins = UIEdgeInsets.Zero;
			}

			if (Master.TailFetchingEnabled && indexPath.Row == Master.GetTableItemCount() - 1 && !Master.Fetching && Master.GetTableItemCount() > 0 && Master.NextAllowedTailFetch < DateTime.UtcNow)
			{
				UIView FooterLoadingView = new UIView(new CoreGraphics.CGRect(0, 0, UIScreen.MainScreen.Bounds.Size.Width, ((AppDelegate)UIApplication.SharedApplication.Delegate).TabBarController.TabBar.Frame.Size.Height + 60));
				UIActivityIndicatorView ai = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);
				ai.Frame = new CoreGraphics.CGRect(UIScreen.MainScreen.Bounds.Size.Width / 2 - 15, 15, 30, 30);
				ai.StartAnimating();
				FooterLoadingView.AddSubview(ai);
				tableView.TableFooterView = FooterLoadingView;
				Master.Offset = Master.GetTableItemCount();//Master.Offset + Master.Count;
				await Master.FetchTableData();
			}
		}
		public LoadMoreElement (string normalCaption, string loadingCaption, Action<LoadMoreElement> tapped, UIFont font, UIColor textColor) : base ("")
		{
			this.NormalCaption = normalCaption;
			this.LoadingCaption = loadingCaption;
			this.tapped = tapped;
			this.font = font;
			
			cell = new UITableViewCell (UITableViewCellStyle.Default, "loadMoreElement");
			
			activityIndicator = new UIActivityIndicatorView () {
				ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray,
				Hidden = true
			};
			activityIndicator.StopAnimating ();
			
			caption = new UILabel () {
				Font = font,
				Text = this.NormalCaption,
				TextColor = textColor,
				BackgroundColor = UIColor.Clear,
				TextAlignment = UITextAlignment.Center,
				AdjustsFontSizeToFitWidth = false,
			};
			
			Layout ();
			
			cell.ContentView.AddSubview (caption);
			cell.ContentView.AddSubview (activityIndicator);
		}
		public override void ViewDidLoad ()
		{
            loadingBg = new UIView (this.View.Frame) { 
                BackgroundColor = UIColor.Black, 
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight 
            };
            loadingView = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge) {
                AutoresizingMask = UIViewAutoresizing.FlexibleMargins
            };
			loadingView.Frame = new CGRect ((this.View.Frame.Width - loadingView.Frame.Width) / 2, 
				(this.View.Frame.Height - loadingView.Frame.Height) / 2,
				loadingView.Frame.Width, 
				loadingView.Frame.Height);
			
			loadingBg.AddSubview (loadingView);
			View.AddSubview (loadingBg);
			loadingView.StartAnimating ();

			scannerView = new AVCaptureScannerView(new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height));
			scannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			scannerView.UseCustomOverlayView = this.Scanner.UseCustomOverlay;
			scannerView.CustomOverlayView = this.Scanner.CustomOverlay;
			scannerView.TopText = this.Scanner.TopText;
			scannerView.BottomText = this.Scanner.BottomText;
			scannerView.CancelButtonText = this.Scanner.CancelButtonText;
			scannerView.FlashButtonText = this.Scanner.FlashButtonText;
            scannerView.OnCancelButtonPressed += () => {
                Scanner.Cancel ();
            };

			this.View.AddSubview(scannerView);
			this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
		}
示例#5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MySource(VM, TableView,
                GroupCell.Key, GroupCell.Key);
            TableView.RowHeight = 66;
            TableView.Source = source;

            var refreshControl = new MvxUIRefreshControl{Message = "Loading..."};
            this.RefreshControl = refreshControl;

            var set = this.CreateBindingSet<GroupsView, GroupsViewModel>();
            set.Bind(source).To(vm => vm.Groups);
            set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.GoToGroupCommand);
            set.Apply();

            TableView.ReloadData();
            var spinner = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.Gray);
            spinner.Frame = new RectangleF (0, 0, 320, 66);
            //if isn't first time show spinner when busy
            TableView.TableFooterView = spinner;
            VM.IsBusyChanged = (busy) => {
                if(busy && VM.Groups.Count > 0)
                    spinner.StartAnimating();
                else
                    spinner.StopAnimating();
            };
        }
示例#6
0
		public async void SetImage (string url)
		{
			UIImage image = null;

			if (!images.ContainsKey(url)) {

				var spinner = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.Gray);

				spinner.StartAnimating();

				spinner.Center = new CGPoint (PhotoView.Frame.Width / 2f, PhotoView.Frame.Height / 2f);

				ContentView.AddSubview(spinner);

				var imageData = await ResourceLoader.DefaultLoader.GetImageData(url);

				image = UIImage.LoadFromData(NSData.FromArray(imageData));

				spinner.StopAnimating();
				spinner.RemoveFromSuperview();

				images.Add(url, image);
			
			} else {
			
				image = images[url];
			}

			PhotoView.ContentMode = UIViewContentMode.ScaleAspectFill;
			PhotoView.Image = image;
		}
		public ActivityIndicator ()
		{
			Opaque = false;

			var bounds = new CGRect (0, 0, 150, 44);
			Frame = bounds;

			var isDark = DocumentAppDelegate.Shared.Theme.IsDark;
			BackgroundColor = isDark ?
				UIColor.FromWhiteAlpha (1-0.96f, 0.85f) :
				UIColor.FromWhiteAlpha (0.96f, 0.85f);
			Layer.CornerRadius = 12;

			const float margin = 12;

			activity = new UIActivityIndicatorView (isDark ? UIActivityIndicatorViewStyle.White : UIActivityIndicatorViewStyle.Gray) {
				Frame = new CGRect (margin, margin, 21, 21),
				HidesWhenStopped = false,
			};

			titleLabel = new UILabel (new CGRect (activity.Frame.Right+margin, 0, bounds.Width - activity.Frame.Right - 2*margin, 44)) {
				TextAlignment = UITextAlignment.Center,
				TextColor = isDark ? UIColor.FromWhiteAlpha (1-0.33f, 1) : UIColor.FromWhiteAlpha (0.33f, 1),
				BackgroundColor = UIColor.Clear,
			};

			AddSubviews (titleLabel, activity);
		}
		void ReleaseDesignerOutlets ()
		{
			if (busyIndicator != null) {
				busyIndicator.Dispose ();
				busyIndicator = null;
			}
		}
		public BusyIndicatorClass (CGRect frame,string strMsg ) :base(frame)
		{
			BackgroundColor = UIColor.Black;
			Alpha = 0.50f; 
			const float flLabelHeight=22;

			float flWidth=Convert.ToSingle(Frame.Width.ToString());
			float flHeight= Convert.ToSingle(Frame.Height.ToString());

			float flLabelWidth=flWidth-20;
			float flCenterX=flWidth/2;
			float flCenterY=flHeight/2;

			spinner= new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White);
			spinner.Frame= new CGRect(flCenterX - ( spinner.Frame.Width / 2 ) , flCenterY - spinner.Frame.Height - 20 , spinner.Frame.Width , spinner.Frame.Height );
			spinner.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
			AddSubview ( spinner );
			spinner.StartAnimating ();

			lblLoading= new UILabel(new CGRect (flCenterX - ( flLabelWidth / 2 ) , flCenterY + 20 , flLabelWidth , flLabelHeight ) );
			lblLoading.BackgroundColor = UIColor.Clear;
			lblLoading.Text = strMsg;
			lblLoading.TextAlignment = UITextAlignment.Center;
			lblLoading.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
			AddSubview ( lblLoading );
 
		}
示例#10
0
		public ProgressLabel (string text)
			: base (new RectangleF (0, 0, 200, 44))
		{
			BackgroundColor = UIColor.Clear;
			
			activity = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.White) {
				Frame = new RectangleF (0, 11.5f, 21, 21),
				HidesWhenStopped = false,
				Hidden = false,
			};
			AddSubview (activity);
			
			var label = new UILabel () {
				Text = text,
				TextColor = UIColor.White,
				Font = UIFont.BoldSystemFontOfSize (20),
				BackgroundColor = UIColor.Clear,
				Frame = new CGRect (25, 0, Frame.Width - 25, 44),
			};
			AddSubview (label);
			
			var f = Frame;
			f.Width = label.Frame.X + label.Text.StringSize (label.Font).Width;
			Frame = f;
		}
		public override void ViewDidLoad ()
		{
			loadingBg = new UIView (this.View.Frame) { BackgroundColor = UIColor.Black };
			loadingView = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
			loadingView.Frame = new RectangleF ((this.View.Frame.Width - loadingView.Frame.Width) / 2, 
				(this.View.Frame.Height - loadingView.Frame.Height) / 2,
				loadingView.Frame.Width, 
				loadingView.Frame.Height);			

			loadingBg.AddSubview (loadingView);
			View.AddSubview (loadingBg);
			loadingView.StartAnimating ();

			scannerView = new ZXingScannerView(new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height));
			scannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			scannerView.UseCustomOverlayView = this.Scanner.UseCustomOverlay;
			scannerView.CustomOverlayView = this.Scanner.CustomOverlay;
			scannerView.TopText = this.Scanner.TopText;
			scannerView.BottomText = this.Scanner.BottomText;
			scannerView.CancelButtonText = this.Scanner.CancelButtonText;
			scannerView.FlashButtonText = this.Scanner.FlashButtonText;

			//this.View.AddSubview(scannerView);
			this.View.InsertSubviewBelow (scannerView, loadingView);

			this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
		}
		public WebAuthenticatorController (WebAuthenticator authenticator)
		{
			this.authenticator = authenticator;

			authenticator.Error += HandleError;
			authenticator.BrowsingCompleted += HandleBrowsingCompleted;

			//
			// Create the UI
			//
			Title = authenticator.Title;

			NavigationItem.LeftBarButtonItem = new UIBarButtonItem (
				UIBarButtonSystemItem.Cancel,
				delegate {
					Cancel ();
				});

			activity = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.White);
			NavigationItem.RightBarButtonItem = new UIBarButtonItem (activity);

			webView = new UIWebView (View.Bounds) {
				Delegate = new WebViewDelegate (this),
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
			};
			View.AddSubview (webView);
			View.BackgroundColor = UIColor.Black;

			//
			// Locate our initial URL
			//
			BeginLoadingInitialUrl ();
		}
示例#13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MySource(VM, TableView,
                EventCell.Key, EventCell.Key);
            TableView.RowHeight = 66;
            TableView.Source = source;

            var refreshControl = new MvxUIRefreshControl{Message = "Loading..."};
            this.RefreshControl = refreshControl;

            var set = this.CreateBindingSet<EventsView, EventsViewModel>();
            set.Bind(source).To(vm => vm.Events);
            set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.GoToEventCommand);
            set.Apply();
            var spinner = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.Gray);
            spinner.Frame = new RectangleF (0, 0, 320, 66);

            TableView.TableFooterView = spinner;
            //if isn't first load show spinner when busy
            VM.IsBusyChanged = (busy) => {
                if(busy && VM.Events.Count > 0)
                    spinner.StartAnimating();
                else
                    spinner.StopAnimating();
            };
            TableView.ReloadData();
            NavigationItem.RightBarButtonItem = new UIBarButtonItem ("Stats", UIBarButtonItemStyle.Plain, delegate {
                ((EventsViewModel)ViewModel).ExecuteGoToStatsCommand();
            });
        }
示例#14
0
		public async void BeginDownloadingPOC (UIViewController controller, UIImageView imageView, UIActivityIndicatorView acIndicator, string imagePath, bool isCache)
		{
			if (acIndicator != null)
				acIndicator.StartAnimating ();

			UIImage data = null;
			if (imagePath != null)
				data = await GetImageData (imagePath, isCache);
				
			CGPoint center = imageView.Center;

			UIImage finalImage = null;
			if (data != null) {
				finalImage = MUtils.scaledToWidth (data, imageView.Frame.Width * 2);
				imageView.Frame = new CGRect (0.0f, 0.0f, finalImage.Size.Width / 2, finalImage.Size.Height / 2);
			}

			imageView.Image = getImageFrom (finalImage, "noimage.png");
			imageView.Center = center;

			if (acIndicator != null) {
				acIndicator.StopAnimating ();
				acIndicator.Color = UIColor.Clear;
			}
		}
示例#15
0
		public ProgressLabel (string text)
			: base (new RectangleF (0, 0, 200, 44))
		{
			BackgroundColor = UIColor.Clear;
			
			activity = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.White) {
				Frame = new RectangleF (0, 11.5f, 21, 21),
				HidesWhenStopped = false,
				Hidden = false,
			};
			AddSubview (activity);
			
			var label = new UILabel () {
				Text = text,
				TextColor = UIColor.White,
				Font = UIFont.BoldSystemFontOfSize (20),
				BackgroundColor = UIColor.Clear,
				#if ! __UNIFIED__
				Frame = new RectangleF (25f, 0f, Frame.Width - 25, 44f),
				#else
				Frame = new RectangleF (25f, 0f, (float)(Frame.Width - 25), 44f),
				#endif
			};
			AddSubview (label);
			
			var f = Frame;
			f.Width = label.Frame.X + UIStringDrawing.StringSize (label.Text, label.Font).Width;
			Frame = f;
		}
示例#16
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            _loadDataButton = UIButton.FromType(UIButtonType.RoundedRect);
            _loadDataButton.SetTitle("Hent sanntidsdata", UIControlState.Normal);
            _loadDataButton.Frame = new RectangleF(10, 10, View.Bounds.Width - 20, 50);

            _result = new UITextView(new RectangleF(10, 70, View.Bounds.Width - 20, View.Bounds.Height - 80));
            _result.Font = UIFont.FromName("Arial", 14);
            _result.Editable = false;

            _activityIndicator = new UIActivityIndicatorView(new RectangleF(View.Bounds.Width / 2 - 20, View.Bounds.Height / 2 - 20, 40, 40));
            _activityIndicator.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
            _activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;

            View.AddSubview(_activityIndicator);
            View.AddSubview(_loadDataButton);
            View.AddSubview(_result);

            View.BackgroundColor = UIColor.DarkGray;

            _loadDataButton.TouchUpInside += delegate(object sender, EventArgs e) {
                if(_location != null)
                {
                    _activityIndicator.StartAnimating();
                    _result.Text = "Jobber..." + Environment.NewLine + Environment.NewLine;
                    var coordinate = new GeographicCoordinate(_location.Latitude, _location.Longtitude);
                    ThreadPool.QueueUserWorkItem(o => _sanntid.GetNearbyStops(coordinate, BusStopsLoaded));
                }
            };

            _gpsService.LocationChanged = location => _location = location;
            _gpsService.Start();
        }
    public LoadingOverlay (CGRect frame, string text) : base (frame)
		{
			BackgroundColor = UIColor.Black;
			Alpha = 0.75f;
			AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

      nfloat labelHeight = 22;
      nfloat labelWidth = Frame.Width - 20;

      nfloat centerX = Frame.Width / 2;
      nfloat centerY = Frame.Height / 2;

			activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
      activitySpinner.Frame = new CGRect(
				centerX - (activitySpinner.Frame.Width / 2) ,
				centerY - activitySpinner.Frame.Height - 20 ,
				activitySpinner.Frame.Width ,
				activitySpinner.Frame.Height);
			activitySpinner.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
			AddSubview (activitySpinner);
			activitySpinner.StartAnimating ();

      loadingLabel = new UILabel(new CGRect (
				centerX - (labelWidth / 2),
				centerY + 20 ,
				labelWidth ,
				labelHeight
			));
			loadingLabel.BackgroundColor = UIColor.Clear;
			loadingLabel.TextColor = UIColor.White;
			loadingLabel.Text = text;
			loadingLabel.TextAlignment = UITextAlignment.Center;
			loadingLabel.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
			AddSubview (loadingLabel);
		}
示例#18
0
		void SetUpActivityIndicator ()
		{
			activityIndicator = new UIActivityIndicatorView (new CGRect (150f, 220f, 20f, 20f));
			if (AppDelegate.IsPad)
				activityIndicator.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
			activityIndicator.StartAnimating ();
		}
		public static async Task LoadUrl(this UIImageView imageView, string url)
		{	
			if (string.IsNullOrEmpty (url))
				return;
			var progress = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge)
			{
				Center = new PointF(imageView.Bounds.GetMidX(), imageView.Bounds.GetMidY()),
			};
			imageView.AddSubview (progress);

		
			var t = FileCache.Download (url);
			if (t.IsCompleted) {
				imageView.Image = UIImage.FromFile(t.Result);
				progress.RemoveFromSuperview ();
				return;
			}
			progress.StartAnimating ();
			var image = UIImage.FromFile(await t);

			UIView.Animate (.3, 
				() => imageView.Image = image,
				() => {
					progress.StopAnimating ();
					progress.RemoveFromSuperview ();
				});
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var activityIndicator = new UIActivityIndicatorView (new CoreGraphics.CGRect (0, 0, 20, 20));
            activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
            activityIndicator.HidesWhenStopped = true;
            NavigationItem.LeftBarButtonItem = new UIBarButtonItem (activityIndicator);

            var getMonkeysButton = new UIBarButtonItem ();
            getMonkeysButton.Title = "Get";
            getMonkeysButton.Clicked += async (object sender, EventArgs e) => {
                activityIndicator.StartAnimating();
                getMonkeysButton.Enabled = false;

                await ViewModel.GetMonkeysAsync();
                TableViewMonkeys.ReloadData();

                getMonkeysButton.Enabled = true;
                activityIndicator.StopAnimating();
            };
            NavigationItem.RightBarButtonItem = getMonkeysButton;

            TableViewMonkeys.WeakDataSource = this;
        }
        /// <summary>
        /// this is where we do the meat of creating our alert, which includes adding 
        /// controls, etc.
        /// </summary>
        public override void Draw(RectangleF rect)
        {
            // if the control hasn't been setup yet
            if (activityIndicator == null)
            {
                // if we have a message
                if (!string.IsNullOrEmpty (message))
                {
                    lblMessage = new UILabel (new RectangleF (20, 10, rect.Width - 40, 33));
                    lblMessage.BackgroundColor = UIColor.Clear;
                    lblMessage.TextColor = UIColor.LightTextColor;
                    lblMessage.TextAlignment = UITextAlignment.Center;
                    lblMessage.Text = message;
                    this.AddSubview (lblMessage);
                }

                // instantiate a new activity indicator
                activityIndicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.White);
                activityIndicator.Frame = new RectangleF ((rect.Width / 2) - (activityIndicator.Frame.Width / 2)
                    , 50, activityIndicator.Frame.Width, activityIndicator.Frame.Height);
                this.AddSubview (activityIndicator);
                activityIndicator.StartAnimating ();
            }
            base.Draw (rect);
        }
示例#22
0
        public LoadingAlertView(System.Drawing.RectangleF frame)
            : base(frame)
        {
            // configurable bits
            AutoresizingMask = UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleLeftMargin;

            Title = "TwitterBot";
            Message = "Загрузка данных...";

            // derive the center x and y
            float centerX = Frame.Width / 2;
            float centerY = Frame.Height / 2;

            var f = Frame;
            f.Height = Frame.Height;
            Frame = f;

            // create the activity spinner, center it horizontall and put it 5 points above center x
            if (UIDevice.CurrentDevice.CheckSystemVersion (6, 0)) {
                activitySpinner = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
                activitySpinner.Frame = new System.Drawing.RectangleF (
                    centerX - (activitySpinner.Frame.Width / 2),
                    centerY + Frame.Height / 4 - activitySpinner.Frame.Height / 2,
                    activitySpinner.Frame.Width,
                    activitySpinner.Frame.Height);
                activitySpinner.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
                AddSubview (activitySpinner);
                activitySpinner.StartAnimating ();
            }
        }
示例#23
0
        public override void ViewDidAppear(bool animated)
        {
            //			if (_isLoaded)
            //			{
            //				DidRotate(new UIInterfaceOrientation());
            //				return;
            //			}

            base.ViewDidAppear (animated);

            AddComponents ();

            Init ();

            var lbl = new UILabel (new RectangleF(100,0,100,30));
            lbl.Text = "Загрузка";
            lbl.BackgroundColor = UIColor.FromRGBA (0, 0, 0, 0);
            lbl.TextColor = UIColor.White;
            var activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            activitySpinner.Frame = new RectangleF (0,-35,50,50);
            activitySpinner.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
            activitySpinner.StartAnimating ();
            _alert = new UIAlertView();
            _alert.Frame.Size = new SizeF (60, 60);
            _alert.AddSubview(activitySpinner);
            _alert.AddSubview (lbl);
            _alert.Show();
            _twitterConection.GeTwittstByTag(_tag, GetNumberOfRows());
            _isSelected = false;
        }
示例#24
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //this.View.BackgroundColor = UIColor.Black;

            _activityView = new UIActivityIndicatorView(this.View.Frame);
            //Add(_activityView);
            //View.BringSubviewToFront(_activityView);

            _tableView = new FoldingTableViewController(new System.Drawing.RectangleF(0, 0, 320, 367), UITableViewStyle.Plain);
            var source = new TableSource(_tableView.TableView);

            this.AddBindings(new Dictionary<object, string>()
                                 {
                                     {source, "ItemsSource TweetsPlus"},
                                     //{_activityView, "{'Hidden':{'Path':'IsSearching','Converter':'InvertedVisibility'}}"},
				{_tableView, "Refreshing IsSearching;RefreshHeadCommand RefreshCommand;LastUpdatedText WhenLastUpdatedUtc,Converter=SimpleDate"},
                                 });

            _tableView.TableView.RowHeight = 100;
            _tableView.TableView.Source = source;
            _tableView.TableView.ReloadData();
            this.Add(_tableView.View);

            NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Tweet", UIBarButtonItemStyle.Bordered, (sender, e) => ViewModel.DoShareGeneral()), false);
        }
示例#25
0
        static void BuildHud()
        {
            if (hud == null) {
                hud = new UIView (UIApplication.SharedApplication.KeyWindow.RootViewController.View.Frame) {
                    BackgroundColor = UIColor.Black,
                    Alpha = 0.8f,
                    AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
                };

                activity = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge) {
                    Frame = new RectangleF (hud.Frame.Width / 2 - HUD_SIZE / 2, hud.Frame.Height / 2 - HUD_SIZE / 2 - LABEL_HEIGHT / 2 - 5f, HUD_SIZE, HUD_SIZE),
                    AutoresizingMask = UIViewAutoresizing.FlexibleMargins
                };

                label = new UILabel {
                    Frame = new RectangleF (0f, activity.Frame.Bottom + 10f, hud.Frame.Width, LABEL_HEIGHT),
                    TextAlignment = UITextAlignment.Center,
                    Font = UIFont.BoldSystemFontOfSize (18.0f),
                    AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin,
                    TextColor = UIColor.White

                };

                hud.AddSubview (activity);
                hud.AddSubview (label);

                //label = new UILabel (new RectangleF (0,  hud.Frame.Width,
            }
        }
		public ActivityView ()
			: base (new CGRect (0, 0, 88, 88))
		{
			BackgroundColor = UIColor.Black.ColorWithAlpha (0.75f);
			Opaque = false;
			IsRunning = false;
			Layer.CornerRadius = 8;
			AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;

			var b = Bounds;

			label = new UILabel (new CGRect (8, b.Height - 8 - 20, b.Width - 16, 20)) {
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = UIFont.BoldSystemFontOfSize (UIFont.SmallSystemFontSize),
			};
			AddSubview (label);

			activity = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge);
			var af = activity.Frame;
			af.X = (b.Width - af.Width) / 2;
			af.Y = 12;
			activity.Frame = af;
			AddSubview (activity);
		}
    public override void ViewDidLoad()
    {
      base.ViewDidLoad();
      EdgesForExtendedLayout = UIRectEdge.None;
      ExtendedLayoutIncludesOpaqueBars = false;
      AutomaticallyAdjustsScrollViewInsets = false;


      NavigationController.NavigationBar.BarStyle = UIBarStyle.Black;
      this.RefreshControl = new UIRefreshControl();

      activityIndicator = new UIActivityIndicatorView(new CoreGraphics.CGRect(0,0,20,20));
      activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
      activityIndicator.HidesWhenStopped = true;
      NavigationItem.LeftBarButtonItem = new UIBarButtonItem(activityIndicator);


      RefreshControl.ValueChanged += async (sender, args) =>
      {
        if (viewModel.IsBusy)
          return;

        await viewModel.GetContactsAsync();
        TableView.ReloadData();
      };

      viewModel.PropertyChanged += PropertyChanged;

      TableView.Source = new ContactsSource(viewModel, this);
    }
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				_ArrowImage.Dispose();

				if (_Activity != null)
				{
					_Activity.Dispose();
					_Activity = null;
				}

				if (_LastUpdateLabel != null)
				{
					_LastUpdateLabel.Dispose();
					_LastUpdateLabel = null;
				}

				if (_StatusLabel != null)
				{
					_StatusLabel.Dispose();
					_StatusLabel = null;
				}

				if (_ArrowView != null)
				{
					_ArrowView.Dispose();
					_ArrowView = null;
				}
			}

			base.Dispose(disposing);
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            _thread = new Thread(ThreadEntry);

            // Container for the controls
            _containerView = new UIView();
            _containerView.Frame = new RectangleF(0,-20,320,480);

            // The background loading image
            _imageView = new UIImageView();
            _imageView.Image = UIImage.FromFile("Default.png");
            _imageView.Frame = new RectangleF(0,0,320,480);
            _containerView.AddSubview(_imageView);

            // The pulser
            _activityView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White);
            _activityView.Frame = new RectangleF(115,280,20,20);
            _containerView.AddSubview(_activityView);
            _activityView.StartAnimating();

            // Label saying wait
            _label = new UILabel();
            _label.Frame = new RectangleF(140,280,250,20);
            _label.Font = UIFont.SystemFontOfSize(14f);
            _label.BackgroundColor = UIColor.Clear;
            _label.TextColor = UIColor.White;
            _label.ShadowColor = UIColor.Black;
            _label.Text = "Loading...";
            _containerView.AddSubview(_label);

            View.AddSubview(_containerView);
        }
 void CompletedHandler(UIImage image, NSError error, SDImageCacheType cacheType)
 {
     if (activityIndicator != null) {
         activityIndicator.RemoveFromSuperview ();
         activityIndicator = null;
     }
 }
        async void Initialize()
        {
            UIActivityIndicatorView activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);

            activitySpinner.Frame = new CGRect(new CGPoint(View.Center.X - 50, View.Center.Y - 50), new CGSize(100, 100));
            activitySpinner.StartAnimating();

            View.Add(activitySpinner);

            GameDataService dataService = new GameDataService();
            var             gameData    = await dataService.GetGameData();

            Game = new GuessGame(gameData);

            PlayerViews = Game.GetRandomPlayers();

            Add2PlayerViews();
            AddScoreView();

            // We have data, stop showing spinner
            activitySpinner.StopAnimating();
            activitySpinner.RemoveFromSuperview();
        }
示例#32
0
        private void showIndicator()
        {
            if (spinner == null)
            {
                spinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
                spinner.HidesWhenStopped = true;
                spinner.Color            = UIColor.Blue;
            }
            var windows = UIApplication.SharedApplication.Windows;

            Array.Reverse(windows);
            foreach (UIWindow w in windows)
            {
                if (w.WindowLevel == UIWindowLevel.Normal && !w.Hidden)
                {
                    spinner.Frame = new CGRect((float)w.Bounds.GetMidX(), (float)(.66 * w.Bounds.Height), 37, 37);
                    w.AddSubview(spinner);
                    w.BringSubviewToFront(spinner);
                    break;
                }
            }
            spinner.StartAnimating();
        }
        private void ShowLoadingBar()
        {
            InvokeOnMainThread(() => {
                LoadingBar = new UIActivityIndicatorView(new CGRect(0, 0, 100, 100))
                {
                    Center = View.Center,
                    ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White
                };

                LoadingBackgroundView = new UIView {
                    Center = View.Center
                };
                LoadingBackgroundView.Frame           = new CGRect(new CGPoint(View.Frame.Location), new CGSize(View.Frame.Size));
                LoadingBackgroundView.BackgroundColor = ColorManager.progressbar_background;
                LoadingBackgroundView.Alpha           = 0;


                View.AddSubview(LoadingBackgroundView);
                LoadingBar.StartAnimating();
                View.AddSubview(LoadingBar);
                UIView.Animate(0.3, () => LoadingBackgroundView.Alpha = 0.7f);
            });
        }
 public void LoadTable(bool skipRefresh)
 {
     if (!skipRefresh)
     {
         var loading = new UIAlertView("DLoad".t(), "Wait".t(), null, null, null);
         loading.Show();
         var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
         indicator.Center = new PointF(loading.Bounds.Width / 2, loading.Bounds.Size.Height - 40);
         indicator.StartAnimating();
         loading.AddSubview(indicator);
         RefreshTable(loading);
     }
     else if (_fromMenu)
     {
         var publications = _parser.Publications;
         TableView.Source = new PublicationsViewSource(publications, NavigationController);
         TableView.ReloadData();
     }
     else
     {
         RefreshTable();
     }
 }
示例#35
0
        private void RefreshClicked(object sender, EventArgs e)
        {
            iHelper.Rescan();

            UIActivityIndicatorView view = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White);

            view.Frame = new CGRect(0.0f, 0.0f, 25.0f, 25.0f);

            UIBarButtonItem item = new UIBarButtonItem();

            item.CustomView = view;

            iNavigationController.ViewControllers[0].NavigationItem.RightBarButtonItem = item;

            view.StartAnimating();

            new System.Threading.Timer(delegate {
                iButtonRefresh.BeginInvokeOnMainThread(delegate {
                    view.StopAnimating();
                    iNavigationController.ViewControllers[0].NavigationItem.RightBarButtonItem = iButtonRefresh;
                });
            }, null, 3000, System.Threading.Timeout.Infinite);
        }
        void DeleteWarningOKBtnTapped(UIAlertAction obj)
        {
            DeleteBtnWidthConstraint.Constant = DeleteConsentBtn.Frame.Width;
            DeleteBtnWidthConstraint.Active   = true;
            DeleteConsentBtn.SetTitle(string.Empty, UIControlState.Normal);

            UIActivityIndicatorView spinner = ShowSpinner();

            DeviceUtils.StopScanServices();
            DeviceUtils.CleanDataFromDevice();
            spinner.StopAnimating();
            spinner.RemoveFromSuperview();
            DeleteConsentBtn.SetTitle(ConsentViewModel.WITHDRAW_CONSENT_BUTTON_TEXT, UIControlState.Normal);
            DeleteBtnWidthConstraint.Active = false;

            // Show a dialog without any buttons, that way forcing the user to quit the app.
            UIAlertController controller = UIAlertController.Create(
                ConsentViewModel.WITHDRAW_CONSENT_SUCCESS_TITLE,
                ConsentViewModel.WITHDRAW_CONSENT_SUCCESS_TEXT,
                UIAlertControllerStyle.Alert);

            PresentViewController(controller, true, null);
        }
        public void DisplayLoadingIndicator()
        {
            if (_spinnerView == null)
            {
                _spinnerView = new UIView(View.Bounds)
                {
                    BackgroundColor = new UIColor(0.5f, 0.5f, 0.5f, 0.5f)
                };

                var activityIndicator = new UIActivityIndicatorView(new CGRect(0, 0, 100, 100))
                {
                    ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge,
                    Center           = _spinnerView.Center,
                    HidesWhenStopped = true
                };
                activityIndicator.Layer.CornerRadius = 5;
                activityIndicator.StartAnimating();

                _spinnerView.AddSubview(activityIndicator);
            }

            View.AddSubview(_spinnerView);
        }
示例#38
0
        public LoadingOverlayView(CGRect frame) : base(frame)
        {
            BackgroundColor  = UIColor.Black;
            Alpha            = 0.75f;
            AutoresizingMask = UIViewAutoresizing.All;

            nfloat labelHeight = 22;
            nfloat labelWidth  = Frame.Width - 20;

            nfloat centerX = Frame.Width / 2;
            nfloat centerY = Frame.Height / 2;

            _activitySpinner       = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            _activitySpinner.Frame = new CGRect(
                centerX - (_activitySpinner.Frame.Width / 2),
                centerY - _activitySpinner.Frame.Height - 20,
                _activitySpinner.Frame.Width,
                _activitySpinner.Frame.Height);
            _activitySpinner.AutoresizingMask = UIViewAutoresizing.All;
            AddSubview(_activitySpinner);
            _activitySpinner.StartAnimating();

            _loadingLabel = new UILabel(new CGRect(
                                            centerX - (labelWidth / 2),
                                            centerY + 20,
                                            labelWidth,
                                            labelHeight
                                            ))
            {
                BackgroundColor  = UIColor.Clear,
                TextColor        = UIColor.White,
                Text             = "Loading ...",
                TextAlignment    = UITextAlignment.Center,
                AutoresizingMask = UIViewAutoresizing.All
            };
            AddSubview(_loadingLabel);
        }
示例#39
0
        public WebAuthenticatorController(WebAuthenticator authenticator)
        {
            this.authenticator = authenticator;

            authenticator.Error             += HandleError;
            authenticator.BrowsingCompleted += HandleBrowsingCompleted;

            //
            // Create the UI
            //
            Title = authenticator.Title;

            if (authenticator.AllowCancel)
            {
                NavigationItem.LeftBarButtonItem = new UIBarButtonItem(
                    UIBarButtonSystemItem.Cancel,
                    delegate {
                    Cancel();
                });
            }

            activity = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White);
            NavigationItem.RightBarButtonItem = new UIBarButtonItem(activity);

            webView = new UIWebView(View.Bounds)
            {
                Delegate         = new WebViewDelegate(this),
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
            };
            View.AddSubview(webView);
            View.BackgroundColor = UIColor.Black;

            //
            // Locate our initial URL
            //
            BeginLoadingInitialUrl();
        }
        void InitializeComponents()
        {
            notes = new List <Note> ();

            auth = Auth.DefaultInstance;

            space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            indicatorView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White)
            {
                Frame            = new CGRect(0, 0, 20, 20),
                HidesWhenStopped = true
            };
            var btnIndicator = new UIBarButtonItem(indicatorView);

            lblNotesCount = new UILabel(new CGRect(0, 0, 50, 15))
            {
                Font = UIFont.SystemFontOfSize(12)
            };

            lblNotesCount.Text = $"0 notes";
            var btnNotesCount = new UIBarButtonItem(lblNotesCount);

            btnNewNote = new UIBarButtonItem(UIBarButtonSystemItem.Compose, btnNewNote_Clicked)
            {
                TintColor = UIColor.White,
                Enabled   = false
            };

            SetToolbarItems(new [] { space, space, btnIndicator, btnNotesCount, space, space, btnNewNote }, false);

            btnRefresh          = new UIBarButtonItem(UIBarButtonSystemItem.Refresh);
            btnRefresh.Clicked += BtnRefresh_Clicked;
            NavigationItem.RightBarButtonItem = btnRefresh;

            indicatorView.StartAnimating();
        }
        private void CreateLayout()
        {
            // Create the first mapview
            _myMapView = new MapView();

            // Create the preview mapview
            _myPreviewMapView = new MapView()
            {
                Hidden = true // hide it by default
            };

            // Set a border on the preview window
            _myPreviewMapView.Layer.BorderColor = new CoreGraphics.CGColor(.8f, .2f, .6f);
            _myPreviewMapView.Layer.BorderWidth = 2.0f;

            // Create the progress bar
            _myProgressBar = new UIActivityIndicatorView();

            // Set the progress bar to hide when not animating
            _myProgressBar.HidesWhenStopped = true;

            // Create the export button
            _myExportButton = new UIButton();

            // Set the export button text
            _myExportButton.SetTitle("Export", UIControlState.Normal);

            // Set background color on the button and progressbar
            _myExportButton.BackgroundColor = UIColor.LightGray;
            _myProgressBar.BackgroundColor  = UIColor.LightGray;

            // Get notified of button taps
            _myExportButton.TouchUpInside += MyExportButton_Click;

            // Add the views
            View.AddSubviews(_myMapView, _myProgressBar, _myExportButton, _myPreviewMapView);
        }
示例#42
0
        public IXFPopupCtrl CreateLoading(string loading = "Loading...")
        {
            var vwMain = new UIView();

            //get the center
            vwMain.BackgroundColor  = UIColor.White;
            vwMain.AutoresizingMask = UIViewAutoresizing.All;

            var activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);

            vwMain.Frame = new CGRect(0, 0, XFPopupConst.SCREEN_WIDTH * 0.75f, activitySpinner.Frame.Height * 2);

            activitySpinner.AutoresizingMask = UIViewAutoresizing.All;
            activitySpinner.Center           = new CGPoint(activitySpinner.Frame.Width, vwMain.Frame.Height / 2);

            vwMain.AddSubview(activitySpinner);
            activitySpinner.StartAnimating();

            // create and configure the "Loading Data" label
            var loadingLabel = new UILabel(new CGRect(
                                               activitySpinner.Frame.Width * 2,
                                               0,
                                               (XFPopupConst.SCREEN_WIDTH * 3 / 4 - activitySpinner.Frame.Width * 2),
                                               activitySpinner.Frame.Height * 2
                                               ));

            loadingLabel.TextColor        = UIColor.Black;
            loadingLabel.Text             = loading;
            loadingLabel.TextAlignment    = UITextAlignment.Center;
            loadingLabel.AutoresizingMask = UIViewAutoresizing.All;
            vwMain.Frame = new CGRect(padding, padding, XFPopupConst.SCREEN_WIDTH * 0.75f, activitySpinner.Frame.Width * 2);
            vwMain.AddSubview(loadingLabel);

            CustomPopup dlg = new CustomPopup(vwMain, false, XFPopupConst.SCREEN_WIDTH * 0.75f + 2 * padding, activitySpinner.Frame.Width * 2 + 2 * padding, ShowType.Dialog);

            return(dlg);
        }
示例#43
0
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.Apply(Style.Screen);
            EdgesForExtendedLayout = UIRectEdge.None;

            TableView.RowHeight = 60f;
            TableView.RegisterClassForHeaderFooterViewReuse(typeof(SectionHeaderView), ClientHeaderId);
            TableView.RegisterClassForCellReuse(typeof(ProjectCell), ProjectCellId);
            TableView.RegisterClassForCellReuse(typeof(TaskCell), TaskCellId);
            TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;

            var defaultFooterView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);

            defaultFooterView.Frame = new CGRect(0, 0, 50, 50);
            defaultFooterView.StartAnimating();
            TableView.TableFooterView = defaultFooterView;

            viewModel = await ProjectListViewModel.Init(workspaceId);

            TableView.Source = new Source(this, viewModel);

            var addBtn = new UIBarButtonItem(UIBarButtonSystemItem.Add, OnAddNewProject);

            if (viewModel.WorkspaceList.Count > 1)
            {
                var filterBtn = new UIBarButtonItem(UIImage.FromFile("filter_icon.png"), UIBarButtonItemStyle.Plain, OnShowWorkspaceFilter);
                NavigationItem.RightBarButtonItems = new [] { filterBtn, addBtn };
            }
            else
            {
                NavigationItem.RightBarButtonItem = addBtn;
            }

            TableView.TableFooterView = null;
        }
        public void Show(string title, Action action)
        {
            Title = title;
            Show();

            if (_activityView == null)
            {
                _activityView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);

                _activityView.Frame = new CGRect(
                    ((int)Bounds.Width / 2) - 15,
                    (int)Bounds.Height - 50,
                    30,
                    30
                    );
            }

            AddSubview(_activityView);

            _activityView.StartAnimating();

            ThreadPool.QueueUserWorkItem(delegate
            {
                try
                {
                    action();
                } finally
                {
                    this.InvokeOnMainThread(delegate
                    {
                        _activityView.StopAnimating();
                        _activityView.RemoveFromSuperview();
                        DismissWithClickedButtonIndex(0, false);
                    });
                }
            });
        }
示例#45
0
        public ProgressLabel(string text)
            : base(new RectangleF(0, 0, 200, 44))
        {
            BackgroundColor = UIColor.Clear;

            activity = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White)
            {
                Frame            = new RectangleF(0, 11.5f, 21, 21),
                HidesWhenStopped = false,
                Hidden           = false,
            };
            AddSubview(activity);

            var label = new UILabel()
            {
                Text            = text,
                TextColor       = UIColor.White,
                Font            = UIFont.BoldSystemFontOfSize(20),
                BackgroundColor = UIColor.Clear,
                #if !__UNIFIED__
                Frame = new RectangleF(25, 0, Frame.Width - 25, 44),
                #else
                Frame = new CoreGraphics.CGRect(25, 0, Frame.Width - 25, 44),
                #endif
            };

            AddSubview(label);

            var f = Frame;

            #if !__UNIFIED__
            f.Width = label.Frame.X + label.StringSize(label.Text, label.Font).Width;
            #else
            f.Width = label.Frame.X + UIStringDrawing.StringSize(label.Text, label.Font).Width;
            #endif
            Frame = f;
        }
示例#46
0
        public static void MakeToastActivity(this UIView context, object position)
        {
            // sanity
            if (_ExistingActivityView != null)
            {
                return;
            }

            var activityView = new UIView(new RectangleF(0f, 0f, CSToastActivityWidth, CSToastActivityHeight));

            activityView.Center             = CenterPointForPosition(context, position, activityView);
            activityView.BackgroundColor    = UIColor.Black.ColorWithAlpha(CSToastOpacity);
            activityView.Alpha              = 0f;
            activityView.AutoresizingMask   = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin;
            activityView.Layer.CornerRadius = CSToastCornerRadius;
            if (CSToastDisplayShadow)
            {
                activityView.Layer.ShadowColor   = UIColor.Black.CGColor;
                activityView.Layer.ShadowOpacity = CSToastShadowOpacity;
                activityView.Layer.ShadowRadius  = CSToastShadowRadius;
                activityView.Layer.ShadowOffset  = CSToastShadowOffset;
            }

            UIActivityIndicatorView activityIndicatorView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);

            activityIndicatorView.Center = new PointF(activityView.Bounds.Size.Width / 2, activityView.Bounds.Size.Height / 2);
            activityView.AddSubview(activityIndicatorView);
            activityIndicatorView.StartAnimating();

            // associate the activity view with self
            _ExistingActivityView = activityView;
            context.AddSubview(activityView);

            UIView.Animate(CSToastFadeDuration, 0.0, UIViewAnimationOptions.CurveEaseOut,
                           () => activityView.Alpha = 1.0f,
                           null);
        }
示例#47
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TableView.Source = new RepositoryTableViewSource(TableView, ViewModel.Repositories);

            var searchDelegate = this.AddSearchBar();

            var activityView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White)
            {
                Frame = new CGRect(0, 0, 320f, 88f),
                Color = NavigationController.NavigationBar.BackgroundColor,
            };

            this.WhenActivated(d =>
            {
                d(searchDelegate.SearchTextChanged.Subscribe(x =>
                {
                    ViewModel.SearchText = x;
                    ViewModel.SearchCommand.ExecuteIfCan();
                }));

                d(ViewModel.SearchCommand.IsExecuting.Subscribe(x =>
                {
                    if (x)
                    {
                        activityView.StartAnimating();
                        TableView.TableFooterView = activityView;
                    }
                    else
                    {
                        activityView.StopAnimating();
                        TableView.TableFooterView = null;
                    }
                }));
            });
        }
示例#48
0
        public Task ShowLoadingAsync(string text)
        {
            if (_progressAlert != null)
            {
                HideLoadingAsync().GetAwaiter().GetResult();
            }

            var result = new TaskCompletionSource <int>();

            var loadingIndicator = new UIActivityIndicatorView(new CGRect(10, 5, 50, 50));

            loadingIndicator.HidesWhenStopped           = true;
            loadingIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray;
            loadingIndicator.StartAnimating();

            _progressAlert = UIAlertController.Create(null, text, UIAlertControllerStyle.Alert);
            _progressAlert.View.TintColor = UIColor.Black;
            _progressAlert.View.Add(loadingIndicator);

            var vc = GetPresentedViewController();

            vc?.PresentViewController(_progressAlert, false, () => result.TrySetResult(0));
            return(result.Task);
        }
示例#49
0
        public override void LoadView()
        {
            base.LoadView();

            this.EdgesForExtendedLayout = UIRectEdge.None;

            View.BackgroundColor = UIColor.White;

            _loading = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            _loading.HidesWhenStopped = false;
            _loading.Color            = UIColor.Black;
            _loading.Frame            = new CGRect((UIScreen.MainScreen.Bounds.Width - _loading.Frame.Width) / 2, (UIScreen.MainScreen.Bounds.Height - _loading.Frame.Height) / 2, _loading.Frame.Width, _loading.Frame.Height);
            _loading.StartAnimating();

            InitializeControls();

            View.AddSubview(_loading);

            if (RegisterKeyboardActions)
            {
                RegisterHideKeyboardOnSwipe();
                RegisterForKeyboardNotifications();
            }
        }
示例#50
0
 public override void Dispose()
 {
     if (activityIndicator != null)
     {
         if (isActivityIndicatorVisible)
         {
             activityIndicator.RemoveFromSuperview();
             isActivityIndicatorVisible = false;
         }
         activityIndicator.Dispose();
         activityIndicator = null;
     }
     if (webView != null)
     {
         webView.StopLoading();
         webView.Delegate = null;
         var localWebView = webView;
         Application.InvokeOnMainThread(() => {
             localWebView.RemoveFromSuperview();                     // RemoveFromSuperview must run in main thread only.
             localWebView.Dispose();
         });
         webView = null;
     }
 }
示例#51
0
        private void SetupUpdateItem()
        {
            // Add Post button
            _updateItem = new UIBarButtonItem
            {
                Title = "Update",
            };

            var icoFontAttribute = new UITextAttributes {
                Font = Appearance.Fonts.LatoBoldWithSize(24), TextColor = Appearance.Colors.BisnerBlue
            };

            _updateItem.SetTitleTextAttributes(icoFontAttribute, UIControlState.Application);
            _updateItem.Style = UIBarButtonItemStyle.Done;

            // Post indicator
            _updateIndicator = new UIActivityIndicatorView {
                Color = Appearance.Colors.BisnerBlue
            };
            _updateIndicatorItem = new UIBarButtonItem(_updateIndicator);
            _updateIndicator.StartAnimating();

            NavigationItem.SetRightBarButtonItems(new[] { _updateItem }, true);
        }
示例#52
0
        public ProgressDialog(CGRect frame, string message) : base(frame)
        {
            BackgroundColor  = UIColor.Black;
            Alpha            = 0.75f;
            AutoresizingMask = UIViewAutoresizing.All;
            nfloat labelHeight = 22;
            nfloat labelWidth  = Frame.Width - 20;
            // derive the center x and y
            nfloat centerX = Frame.Width / 2;
            nfloat centerY = Frame.Height / 2;

            // create the activity spinner, center it horizontall and put it 5 points above center x
            activitySpinner       = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            activitySpinner.Frame = new CGRect(
                centerX - (activitySpinner.Frame.Width / 2),
                centerY - activitySpinner.Frame.Height - 20,
                activitySpinner.Frame.Width,
                activitySpinner.Frame.Height);
            activitySpinner.AutoresizingMask = UIViewAutoresizing.All;
            AddSubview(activitySpinner);
            activitySpinner.StartAnimating();

            // create and configure the "Loading Data" label
            loadingLabel = new UILabel(new CGRect(
                                           centerX - (labelWidth / 2),
                                           centerY + 20,
                                           labelWidth,
                                           labelHeight
                                           ));
            loadingLabel.BackgroundColor  = UIColor.Clear;
            loadingLabel.TextColor        = UIColor.White;
            loadingLabel.Text             = message;
            loadingLabel.TextAlignment    = UITextAlignment.Center;
            loadingLabel.AutoresizingMask = UIViewAutoresizing.All;
            AddSubview(loadingLabel);
        }
示例#53
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.AutosizesSubviews = true;

            _imgView = new UIImageView();
            _imgView.Layer.CornerRadius = imageSize / 2;
            _imgView.Layer.MasksToBounds = true;
            Add(_imgView);

            _statusLabel = new UILabel();
            _statusLabel.TextAlignment = UITextAlignment.Center;
            _statusLabel.Font = UIFont.FromName("HelveticaNeue", 13f);
            _statusLabel.TextColor = UIColor.FromWhiteAlpha(0.34f, 1f);
            Add(_statusLabel);

            _activityView = new UIActivityIndicatorView() { HidesWhenStopped = true };
            _activityView.Color = UIColor.FromRGB(0.33f, 0.33f, 0.33f);
            Add(_activityView);

            var vm = (BaseStartupViewModel)ViewModel;
            vm.Bind(x => x.IsLoggingIn, x =>
            {
                if (x)
                {
                    _activityView.StartAnimating();
                }
                else
                {
                    _activityView.StopAnimating();
                }
            });

            vm.Bind(x => x.ImageUrl, UpdatedImage);
            vm.Bind(x => x.Status, x => _statusLabel.Text = x);
        }
示例#54
0
        public TweetListController(string hashtag) : base(UITableViewStyle.Plain)
        {
            _hashTag = hashtag;
            NavigationItem.RightBarButtonItem = new UIBarButtonItem("Инфо", UIBarButtonItemStyle.Plain,
                                                                    (e, args) =>
            {
                NavigationController.PushViewController(new InfoController(), true);
            });
            var background = new UIView(new RectangleF(0, 0, 320, 480));

            background.BackgroundColor = UIColor.White;
            TableView.BackgroundView   = background;

            _provider = new TweetDataProvider();

            _progressBar        = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            _progressBar.Color  = UIColor.Red;
            _progressBar.Frame  = new RectangleF(0, -200, 40, 40);
            _progressBar.Center = this.View.Center;
            this.View.AddSubview(_progressBar);
            this.View.BringSubviewToFront(_progressBar);

            LoadNewTweets();
        }
示例#55
0
        protected virtual void LoadViewModel()
        {
            var iLoadableViewModel = ViewModel as ILoadableViewModel;

            if (iLoadableViewModel != null)
            {
                var activityView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White)
                {
                    Frame = new RectangleF(0, 0, 320f, 88f),
                    Color = NavigationController.NavigationBar.BackgroundColor,
                };
                activityView.StartAnimating();
                TableView.TableFooterView = activityView;

                iLoadableViewModel.LoadCommand.IsExecuting.Where(x => !x).Skip(1).Take(1).Subscribe(_ =>
                {
                    TableView.TableFooterView = null;
                    activityView.StopAnimating();

                    CreateRefreshControl();
                });
                iLoadableViewModel.LoadCommand.ExecuteIfCan();
            }
        }
        protected void StartActivityAnimation(string title)
        {
            if (activityAlert != null)
            {
                StopActivityAnimation();
            }

            activityAlert = new UIAlertView
            {
                Title = title
            };

            var indicator = new UIActivityIndicatorView
            {
                ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White,
                Center           = new CGPoint(activityAlert.Bounds.GetMidX(), activityAlert.Bounds.GetMidY()),
                AutoresizingMask = UIViewAutoresizing.FlexibleMargins
            };

            indicator.StartAnimating();

            activityAlert.AddSubview(indicator);
            activityAlert.Show();
        }
示例#57
0
        public LoadingOverlay(CGRect frame) : base(frame)
        {
            BackgroundColor  = UIColor.Black;
            Alpha            = 0.8f;
            AutoresizingMask = UIViewAutoresizing.All;

            nfloat centerX = Frame.Width / 2;
            nfloat centerY = Frame.Height / 2;

            UIActivityIndicatorView activitySpinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);

            activitySpinner.Frame = new CGRect(
                centerX - activitySpinner.Frame.Width / 2,
                centerY - activitySpinner.Frame.Height - 20,
                activitySpinner.Frame.Width,
                activitySpinner.Frame.Height);
            activitySpinner.AutoresizingMask = UIViewAutoresizing.All;
            AddSubview(activitySpinner);
            activitySpinner.StartAnimating();

            UILabel loadingLabel = new UILabel(new CGRect(
                                                   centerX - (Frame.Width - 20) / 2,
                                                   centerY + 20,
                                                   Frame.Width - 20,
                                                   22
                                                   ))
            {
                BackgroundColor  = UIColor.Clear,
                TextColor        = UIColor.White,
                Text             = "Downloading Data",
                TextAlignment    = UITextAlignment.Center,
                AutoresizingMask = UIViewAutoresizing.All
            };

            AddSubview(loadingLabel);
        }
示例#58
0
        public override void ViewDidLoad()
        {
            loadingBg = new UIView(this.View.Frame)
            {
                BackgroundColor = UIColor.Black, AutoresizingMask = UIViewAutoresizing.FlexibleDimensions
            };
            loadingView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge)
            {
                AutoresizingMask = UIViewAutoresizing.FlexibleMargins
            };
            loadingView.Frame = new CGRect((this.View.Frame.Width - loadingView.Frame.Width) / 2,
                                           (this.View.Frame.Height - loadingView.Frame.Height) / 2,
                                           loadingView.Frame.Width,
                                           loadingView.Frame.Height);

            loadingBg.AddSubview(loadingView);
            View.AddSubview(loadingBg);
            loadingView.StartAnimating();

            scannerView = new ZXingScannerView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height));
            scannerView.AutoresizingMask     = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            scannerView.UseCustomOverlayView = this.Scanner.UseCustomOverlay;
            scannerView.CustomOverlayView    = this.Scanner.CustomOverlay;
            scannerView.TopText                = this.Scanner.TopText;
            scannerView.BottomText             = this.Scanner.BottomText;
            scannerView.CancelButtonText       = this.Scanner.CancelButtonText;
            scannerView.FlashButtonText        = this.Scanner.FlashButtonText;
            scannerView.OnCancelButtonPressed += delegate {
                Scanner.Cancel();
            };

            //this.View.AddSubview(scannerView);
            this.View.InsertSubviewBelow(scannerView, loadingView);

            this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
        }
示例#59
0
        public static void ShowLoadingIndicator(UIView view, string loadingMessage, bool show)
        {
            //CGRect rect = UIScreen.MainScreen.Bounds;
            //var screenWidth = rect.Size.Width;
            //var screenHeight = rect.Size.Height;

            container = new UIView(new CGRect(0, 0, 120, 120));
            container.BackgroundColor    = UIColor.DarkGray;
            container.Layer.CornerRadius = 5;
            container.Center             = new CGPoint(view.Bounds.Width / 2, view.Bounds.Height / 2);

            if (!string.IsNullOrEmpty(loadingMessage))
            {
                activitySpinner        = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
                activitySpinner.Center = new CGPoint(container.Frame.Width / 2, container.Frame.Height / 2.5);
                container.Add(activitySpinner);

                var label = new UILabel(new CGRect(0, 0, (container.Frame.Width - 20), 20));
                label.TextColor = UIColor.White;
                label.Text      = loadingMessage;
                //label.Font = UIFont.FromName("Helvetica-Bold", 20f);
                label.Font          = UIFont.SystemFontOfSize(13);
                label.TextAlignment = UITextAlignment.Center;
                label.Center        = new CGPoint(container.Frame.Width / 2, 4 * container.Frame.Height / 5);
                container.Add(label);
            }
            else
            {
                activitySpinner        = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
                activitySpinner.Center = new CGPoint(container.Frame.Width / 2, container.Frame.Height / 2);
                container.Add(activitySpinner);
            }

            activitySpinner.StartAnimating();
            view.AddSubview(container);
        }
        void InitializeComponents()
        {
            Title = "Playlist";

            // Showed when we are getting the playlist from YouTube.
            indicatorView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White)
            {
                Frame            = new CGRect(0, 0, 30, 30),
                HidesWhenStopped = true
            };

            var btnProgress = new UIBarButtonItem(indicatorView);

            NavigationItem.RightBarButtonItems = new[] { btnProgress };

            PlayerView.BecameReady  += PlayerView_BecameReady;
            PlayerView.StateChanged += PlayerView_StateChanged;
            PlayerView.PreferredWebViewBackgroundColor += PlayerView_PreferredWebViewBackgroundColor;

            BtnPrevious.TouchUpInside  += BtnPrevious_TouchUpInside;
            BtnPlayPause.TouchUpInside += BtnPlayPause_TouchUpInside;
            BtnStop.TouchUpInside      += BtnStop_TouchUpInside;
            BtnNext.TouchUpInside      += BtnNext_TouchUpInside;
        }