Пример #1
0
 /// <summary>
 /// Apply this theme to a specific view.
 /// </summary>
 /// <param name="options">
 /// "blue", or null
 /// </para>
 public static void Apply(UIToolbar view, string options = null)
 {
     if (options == "blue")
     {
         view.SetBackgroundImage(blueNavigationBarBackground.Value, UIToolbarPosition.Any, UIBarMetrics.Default);
     }
     else
     {
         view.SetBackgroundImage(navigationBarBackground.Value, UIToolbarPosition.Any, UIBarMetrics.Default);
     }
 }
Пример #2
0
 public void BackgroundImage()
 {
     using (UIToolbar tb = new UIToolbar()) {
         Assert.Null(tb.GetBackgroundImage(UIToolbarPosition.Any, UIBarMetrics.Default), "Get");
         tb.SetBackgroundImage(null, UIToolbarPosition.Any, UIBarMetrics.Default);
     }
 }
Пример #3
0
        protected virtual UIView createBottomToolbar()
        {
            var bottomBarFrame = getRootViewFrameRect();

            bottomBarFrame.Y     += bottomBarFrame.Height - DefaultToolbarHeight;
            bottomBarFrame.Height = DefaultToolbarHeight;

            var bottomBar = new UIToolbar(bottomBarFrame);

            bottomBar.SetBackgroundImage(new UIImage(), UIToolbarPosition.Any, UIBarMetrics.Default);
            bottomBar.SetShadowImage(new UIImage(), UIToolbarPosition.Any);
            bottomBar.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth;

            createToolbarButton(bottomBar, DocumentActionTypes.NavigateToFirstPage, "navigateToFirst.png", openFirstPage);
            createToolbarButton(bottomBar, DocumentActionTypes.NavigateToPriorPage, "navigateToPrior.png", openPriorPage);
            createToolbarButton(bottomBar, DocumentActionTypes.NavigateToPage, "navigateToPage.png", () => {
                var vc = new GotoPageVC(p => OpenDocumentPage((int)p));
                vc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
                PresentViewController(vc, true, null);
            });
            createToolbarButton(bottomBar, DocumentActionTypes.NavigateToNextPage, "navigateToNext.png", openNextPage);
            createToolbarButton(bottomBar, DocumentActionTypes.NavigateToLastPage, "navigateToLast.png", openLastPage);
            createToolbarSeparator(bottomBar);

            var pageNumberLeft       = bottomBarFrame.Width - PageNumberWidth - DefaultMargin;
            var pageNumberLabelFrame = new CGRect(pageNumberLeft, (bottomBarFrame.Height - PageNumberHeight) / 2, PageNumberWidth, PageNumberHeight);

            _pageNumberLabel = new UILabel(pageNumberLabelFrame);
            _pageNumberLabel.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin;
            _pageNumberLabel.Font             = UIFont.SystemFontOfSize(12.0f);
            _pageNumberLabel.TextAlignment    = UITextAlignment.Center;
            _pageNumberLabel.TextColor        = UIColor.Gray;
            bottomBar.AddSubview(_pageNumberLabel);

            var sliderWidth = pageNumberLeft - SliderLeft - DefaultMargin;
            var sliderFrame = new CGRect(SliderLeft, (bottomBarFrame.Height - SliderHeight) / 2, sliderWidth, SliderHeight);

            _slider                  = new UISlider(sliderFrame);
            _slider.MinValue         = 1;
            _slider.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            _slider.ValueChanged    += delegate {
                if (_pageNumberLabel != null)
                {
                    _pageNumberLabel.Text = string.Format(@"{0}/{1}", (int)_slider.Value, PDFDocument.PageCount);
                }
            };
            _slider.TouchUpInside += delegate(object sender, EventArgs e) {
                OpenDocumentPage((int)_slider.Value);
            };
            bottomBar.AddSubview(_slider);

            return(bottomBar);
        }
Пример #4
0
        protected WebViewController()
        {
            var fixedSpace = new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace, null)
            {
                Width = 26
            };
            var flexibleSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null);

            toolbar          = new UIToolbar();
            toolbar.BarStyle = UIBarStyle.Black;

            topBar          = new UIToolbar();
            topBar.BarStyle = UIBarStyle.Black;
            topBar.SetBackgroundImage(UIImage.FromBundle("Images/opaqueBar.png"), UIToolbarPosition.Top, UIBarMetrics.Default);

            title = new UILabel(new RectangleF(10, 0, 80, 30))
            {
                BackgroundColor           = UIColor.Clear,
                AdjustsFontSizeToFitWidth = true,
                Font            = UIFont.BoldSystemFontOfSize(22),
                MinimumFontSize = 14,
                TextColor       = UIColor.White,
                ShadowColor     = UIColor.FromRGB(64, 74, 87),
                ShadowOffset    = new SizeF(0, -1)
            };

            topBar.Items = new UIBarButtonItem []
            {
                new UIBarButtonItem(title),
                flexibleSpace,
                new UIBarButtonItem("Close", UIBarButtonItemStyle.Bordered, (o, e) =>
                {
                    Main.DismissModalViewControllerAnimated(true);
                })
            };

            backButton    = new UIBarButtonItem(UIImage.FromBundle("Images/39-back.png"), UIBarButtonItemStyle.Plain, (o, e) => { WebView.GoBack(); });
            forwardButton = new UIBarButtonItem(UIImage.FromBundle("Images/40-forward.png"), UIBarButtonItemStyle.Plain, (o, e) => { WebView.GoForward(); });
            refreshButton = new UIBarButtonItem(UIBarButtonSystemItem.Refresh, (o, e) => { WebView.Reload(); });
            stopButton    = new UIBarButtonItem(UIBarButtonSystemItem.Stop, (o, e) => { WebView.StopLoading(); });

            toolbar.Items = new UIBarButtonItem [] { backButton, fixedSpace, forwardButton, flexibleSpace, stopButton, fixedSpace, refreshButton };

            View.AddSubview(topBar);
            View.AddSubview(toolbar);
        }
Пример #5
0
		protected WebViewController()
		{
			var fixedSpace = new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace, null) {
				Width = 26
			};
			var flexibleSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null);

			toolbar = new UIToolbar ();
			toolbar.BarStyle = UIBarStyle.Black;
			
			topBar = new UIToolbar ();
			topBar.BarStyle = UIBarStyle.Black;			
			topBar.SetBackgroundImage(UIImage.FromBundle ("Images/opaqueBar.png"), UIToolbarPosition.Top, UIBarMetrics.Default);
			
			title = new UILabel(new RectangleF(10, 0, 80, 30))
			{
				BackgroundColor = UIColor.Clear,
				AdjustsFontSizeToFitWidth = true,
				Font = UIFont.BoldSystemFontOfSize(22),
				MinimumFontSize = 14,
				TextColor = UIColor.White,
				ShadowColor = UIColor.FromRGB(64, 74, 87),
				ShadowOffset = new SizeF (0, -1)
			};
			
			topBar.Items = new UIBarButtonItem []
			{
				new UIBarButtonItem (title),
				flexibleSpace,
				new UIBarButtonItem ("Close", UIBarButtonItemStyle.Bordered, (o, e) =>
				{ 
					Main.DismissModalViewControllerAnimated (true);
				})
			};
			
			backButton = new UIBarButtonItem (UIImage.FromBundle("Images/39-back.png"), UIBarButtonItemStyle.Plain, (o, e) => { WebView.GoBack (); });
			forwardButton = new UIBarButtonItem (UIImage.FromBundle("Images/40-forward.png"), UIBarButtonItemStyle.Plain, (o, e) => { WebView.GoForward (); });
			refreshButton = new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => { WebView.Reload (); });
			stopButton = new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => { WebView.StopLoading (); });
			
			toolbar.Items = new UIBarButtonItem [] { backButton, fixedSpace, forwardButton, flexibleSpace, stopButton, fixedSpace, refreshButton };

			View.AddSubview (topBar);
			View.AddSubview (toolbar);
		}
Пример #6
0
        protected virtual UIView createTopToolbar()
        {
            var toolBarFrame = getRootViewFrameRect();

            toolBarFrame.Height = DefaultToolbarHeight;

            var toolBar = new UIToolbar(toolBarFrame);

            toolBar.SetBackgroundImage(new UIImage(), UIToolbarPosition.Any, UIBarMetrics.Default);
            toolBar.SetShadowImage(new UIImage(), UIToolbarPosition.Any);
            toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth;

            createToolbarButton(toolBar, DocumentActionTypes.ZoomOut, "zoomOut.png", zoomOut);
            createToolbarButton(toolBar, DocumentActionTypes.ZoomIn, "zoomIn.png", zoomIn);
            createToolbarSeparator(toolBar);

            //			createToolbarButton(toolBar, DocumentActionTypes.Note, "note.png", () => {
            //				var note = MgrAccessor.DocumentNoteMgr.Load(_documentId);
            //				var vc = new NoteVC(note);
            //				vc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
            //				PresentViewController(vc, true, null);
            //			});
            //			createToolbarButton(toolBar, DocumentActionTypes.Bookmarks, "bookmarksList.png", () => {
            //				var bookmarks = MgrAccessor.DocumentBookmarkMgr.GetAllForDocument(_documentId);
            //				var vc = new BookmarksVC(_documentId, bookmarks, PDFDocument.CurrentPageNumber, p => OpenDocumentPage((int)p));
            //				vc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
            //				PresentViewController(vc, true, null);
            //			});
            //			createToolbarButton(toolBar, DocumentActionTypes.Thumbs, "thumbs.png", () => {
            //				var vc = new ThumbsVC(p => OpenDocumentPage((int)p));
            //				vc.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
            //				PresentViewController(vc, true, null);
            //			});
            createToolbarSeparator(toolBar);

            _btnAutoWidth  = createToolbarButton(toolBar, DocumentActionTypes.AutoWidth, getImagePathForButton(DocumentActionTypes.AutoWidth), setAutoWidth);
            _btnAutoHeight = createToolbarButton(toolBar, DocumentActionTypes.AutoHeight, getImagePathForButton(DocumentActionTypes.AutoHeight), setAutoHeight);
            createToolbarSeparator(toolBar);

            return(toolBar);
        }
Пример #7
0
            public FullScreenVideoView()
            {
                TintColor     = UIColor.White;
                Add(videoView = new VideoView {
                    Tapped = Toggle
                });

                Add(topToolbar = new UIToolbar {
                    BackgroundColor = UIColor.Clear,
                    Items           = new UIBarButtonItem [] {
                        new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                        new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => {
                            Parent.DismissViewControllerAsync(true);
                        }),
                        new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace)
                        {
                            Width = 10
                        },
                    }
                });
                topToolbar.SetBackgroundImage(new UIImage(), UIToolbarPosition.Any, UIBarMetrics.Default);
                topToolbar.SetShadowImage(new UIImage(), UIToolbarPosition.Any);
                topToolbar.SizeToFit();
                Add(playPauseButton = new SimpleButton {
                    BackgroundColor = UIColor.Black.ColorWithAlpha(.5f),
                    Frame           = new CoreGraphics.CGRect(0, 0, 50, 50),
                    Layer           =
                    {
                        CornerRadius = 25,
                    },
                    Tapped = (b) => PlaybackManager.Shared.PlayPause(),
                });
                timeLabel = new UILabel {
                    Text = "0000:00"
                }.StyleAsSubText();
                timeLabel.TextColor = UIColor.White;
                timeLabel.SizeToFit();
                timeRemaingLabel = new UILabel {
                    Text = "0000:00", TextAlignment = UITextAlignment.Right
                }.StyleAsSubText();
                timeRemaingLabel.TextColor = UIColor.White;
                timeRemaingLabel.SizeToFit();
                slider = new ProgressView();
                slider.EditingStarted = () => timer.Stop();
                slider.EditingEnded   = () => ResetTimer();
                Add(bottomToolbar     = new UIToolbar {
                    BackgroundColor = UIColor.Clear,
                    Items           = new UIBarButtonItem[] {
                        new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace)
                        {
                            Width = 10
                        },
                        new UIBarButtonItem(timeLabel),

                        new UIBarButtonItem(slider),

                        new UIBarButtonItem(timeRemaingLabel),
                        new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace)
                        {
                            Width = 10
                        },
                    }
                });

                bottomToolbar.SetBackgroundImage(new UIImage(), UIToolbarPosition.Any, UIBarMetrics.Default);
                bottomToolbar.SetShadowImage(new UIImage(), UIToolbarPosition.Any);
                bottomToolbar.SizeToFit();
                timer          = new Timer(5000);
                timer.Elapsed += Timer_Elapsed;
            }
Пример #8
0
 /// <summary>
 /// Apply this theme to all views with the given appearance.
 /// </summary>
 /// <param name="options">
 /// "blue", or null
 /// </para>
 public static void Apply(UIToolbar.UIToolbarAppearance appearance, string options = null)
 {
     if (options == "blue")
         appearance.SetBackgroundImage (blueNavigationBarBackground.Value, UIToolbarPosition.Any, UIBarMetrics.Default);
     else
         appearance.SetBackgroundImage (navigationBarBackground.Value, UIToolbarPosition.Any, UIBarMetrics.Default);
 }
Пример #9
0
		/// <summary>
		/// Apply this theme to a specific view.
		/// </summary>
		/// <param name="options">
		/// "blue", or null
		/// </para>
		public static void Apply (UIToolbar view, string options = null)
		{
			if (options == "blue") {
				view.SetBackgroundImage (blueNavigationBarBackground.Value, UIToolbarPosition.Any, UIBarMetrics.Default);
			} else {
				view.SetBackgroundImage (navigationBarBackground.Value, UIToolbarPosition.Any, UIBarMetrics.Default);
			}
		}