Exemplo n.º 1
0
		public void SetElement(VisualElement element)
		{
			var oldElement = Element;
			Element = element;
			Element.PropertyChanged += HandlePropertyChanged;
			((WebView)Element).EvalRequested += OnEvalRequested;
			((WebView)Element).GoBackRequested += OnGoBackRequested;
			((WebView)Element).GoForwardRequested += OnGoForwardRequested;
			Delegate = new CustomWebViewDelegate(this);

			BackgroundColor = UIColor.Clear;

			AutosizesSubviews = true;

			_tracker = new VisualElementTracker(this);

			_packager = new VisualElementPackager(this);
			_packager.Load();

			_events = new EventTracker(this);
			_events.LoadEvents(this);

			Load();

			OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

			if (Element != null && !string.IsNullOrEmpty(Element.AutomationId))
				AccessibilityIdentifier = Element.AutomationId;

			if (element != null)
				element.SendViewInitialized(this);
		}
Exemplo n.º 2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                Element.PropertyChanged -= OnHandlePropertyChanged;
                Platform.SetRenderer(Element, null);
                if (_appeared)
                {
                    Page.SendDisappearing();
                }

                _appeared = false;

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

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

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

                Element   = null;
                _disposed = true;
            }

            base.Dispose(disposing);
        }
Exemplo n.º 3
0
        public void SetElement(VisualElement element)
        {
            var oldElement = Element;

            Element = element;
            Element.PropertyChanged               += HandlePropertyChanged;
            ((WebView)Element).EvalRequested      += OnEvalRequested;
            ((WebView)Element).GoBackRequested    += OnGoBackRequested;
            ((WebView)Element).GoForwardRequested += OnGoForwardRequested;
            Delegate = new CustomWebViewDelegate(this);

            BackgroundColor = UIColor.Clear;

            AutosizesSubviews = true;

            _tracker = new VisualElementTracker(this);

            _packager = new VisualElementPackager(this);
            _packager.Load();

            _events = new EventTracker(this);
            _events.LoadEvents(this);

            Load();

            OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

            if (Element != null && !string.IsNullOrEmpty(Element.AutomationId))
            {
                AccessibilityIdentifier = Element.AutomationId;
            }

            if (element != null)
            {
                element.SendViewInitialized(this);
            }
        }
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			_tracker = new VisualElementTracker(this);
			_events = new EventTracker(this);
			_events.LoadEvents(View);

			((MasterDetailPage)Element).PropertyChanged += HandlePropertyChanged;

			_tapGesture = new UITapGestureRecognizer(() =>
			{
				if (Presented)
					Presented = false;
			});
			_clickOffView.AddGestureRecognizer(_tapGesture);

			PackContainers();
			UpdateMasterDetailContainers();

			UpdateBackground();

			UpdatePanGesture();
		}
Exemplo n.º 5
0
        public void SetElement(VisualElement element)
        {
            _requestedScroll = null;
            var oldElement = Element;

            Element = element;

            if (oldElement != null)
            {
                oldElement.PropertyChanged -= HandlePropertyChanged;
                ((ScrollView)oldElement).ScrollToRequested -= OnScrollToRequested;
            }

            if (element != null)
            {
                element.PropertyChanged += HandlePropertyChanged;
                ((ScrollView)element).ScrollToRequested += OnScrollToRequested;
                if (_packager == null)
                {
                    _packager = new VisualElementPackager(this);
                    _packager.Load();

                    _tracker = new VisualElementTracker(this);
                    _tracker.NativeControlUpdated += OnNativeControlUpdated;
                    _events = new EventTracker(this);
                    _events.LoadEvents(this);


                    _insetTracker = new KeyboardInsetTracker(this, () => Window, insets =>
                    {
                        ContentInset = ScrollIndicatorInsets = insets;
                    },
                                                             point =>
                    {
                        var offset = ContentOffset;
                        offset.Y  += point.Y;
                        SetContentOffset(offset, true);
                    }, this);
                }

                UpdateDelaysContentTouches();
                UpdateContentSize();
                UpdateBackgroundColor();
                UpdateIsEnabled();
                UpdateVerticalScrollBarVisibility();
                UpdateHorizontalScrollBarVisibility();

                OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));

                EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);

                if (element != null)
                {
                    element.SendViewInitialized(this);
                }

                if (!string.IsNullOrEmpty(element.AutomationId))
                {
                    AccessibilityIdentifier = element.AutomationId;
                }
            }
        }
Exemplo n.º 6
0
		protected override void Dispose(bool disposing)
		{
			if (disposing && !_disposed)
			{
				if (_scrollView != null)
					_scrollView.DecelerationEnded -= OnDecelerationEnded;

				if (Carousel != null)
				{
					Carousel.PropertyChanged -= OnPropertyChanged;
					Carousel.PagesChanged -= OnPagesChanged;
				}

				Platform.SetRenderer(Element, null);

				Clear();

				if (_scrollView != null)
				{
					_scrollView.DecelerationEnded -= OnDecelerationEnded;
					_scrollView.RemoveFromSuperview();
					_scrollView = null;
				}

				if (_appeared)
				{
					_appeared = false;
					Carousel.SendDisappearing();
				}

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

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

				Element = null;
				_disposed = true;
			}

			base.Dispose(disposing);
		}
Exemplo n.º 7
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			_tracker = new VisualElementTracker(this);
			_events = new EventTracker(this);
			_events.LoadEvents(View);

			_scrollView = new UIScrollView { ShowsHorizontalScrollIndicator = false };

			_scrollView.DecelerationEnded += OnDecelerationEnded;

			UpdateBackground();

			View.Add(_scrollView);

			for (var i = 0; i < Element.LogicalChildren.Count; i++)
			{
				Element element = Element.LogicalChildren[i];
				var child = element as ContentPage;
				if (child != null)
					InsertPage(child, i);
			}

			PositionChildren();

			Carousel.PropertyChanged += OnPropertyChanged;
			Carousel.PagesChanged += OnPagesChanged;
		}
		protected override void Dispose ( bool disposing ) {
			if ( disposing && !disposed ) {
				TabbedCarousel.PropertyChanged -= OnPropertyChanged;
				SetRenderer ( Element , null );
				Clear ();
				if ( scrollView != null ) {
					scrollView.DecelerationEnded -= OnDecelerationEnded;
					scrollView.RemoveFromSuperview ();
					scrollView = null;
				}
				if ( appeared ) {
					appeared = false;
					SendDisappearing ();
				}
				if ( tabBarView != null ) {
					if ( tabBarView.Delegate != null ) {
						tabBarView.Delegate.Dispose ();
						tabBarView.Delegate = null;
					}
					tabBarView.RemoveFromSuperview ();
					tabBarView = null;
				}
				if ( events != null ) {
					events.Dispose ();
					events = null;
				}
				if ( tracker != null ) {
					tracker.Dispose ();
					tracker = null;
				}
				Element = null;
				disposed = true;
			}
			base.Dispose ( disposing );
		}
		public override void ViewDidLoad () {
			base.ViewDidLoad ();

			//Initialize the tab bar items
			tabBarItems = new List <UITabBarItem> ();

			tracker = new VisualElementTracker ( this );
			events = new EventTracker ( this );
			events.LoadEvents ( View );
			scrollView = new UIScrollView {
					ShowsHorizontalScrollIndicator = false
			};
			scrollView.DecelerationEnded += OnDecelerationEnded;
			View.AddSubview ( scrollView );
			int num = 0;
			foreach ( var page in TabbedCarousel.Children ) {
				InsertPage ( page , num++ );
			}
			PositionChildren ();
			TabbedCarousel.PropertyChanged += OnPropertyChanged;
			TabbedCarousel.PagesChanged += OnPagesChanged;

			//Initialized the tab bar view
			tabBarView = new UITabBar {
					Items = tabBarItems.ToArray () ,
					Translucent = true
			};
			View.AddSubview ( tabBarView );
		}
Exemplo n.º 10
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			var uiTapGestureRecognizer = new UITapGestureRecognizer(a => View.EndEditing(true));

			uiTapGestureRecognizer.ShouldRecognizeSimultaneously = (recognizer, gestureRecognizer) => true;
			uiTapGestureRecognizer.ShouldReceiveTouch = OnShouldReceiveTouch;
			uiTapGestureRecognizer.DelaysTouchesBegan =
				uiTapGestureRecognizer.DelaysTouchesEnded = uiTapGestureRecognizer.CancelsTouchesInView = false;
			View.AddGestureRecognizer(uiTapGestureRecognizer);

			UpdateBackground();

			_packager = new VisualElementPackager(this);
			_packager.Load();

			Element.PropertyChanged += OnHandlePropertyChanged;
			_tracker = new VisualElementTracker(this);

			_events = new EventTracker(this);
			_events.LoadEvents(View);

			Element.SendViewInitialized(View);
		}
Exemplo n.º 11
0
		protected override void Dispose(bool disposing)
		{
			if (disposing && !_disposed)
			{
				Element.PropertyChanged -= OnHandlePropertyChanged;
				Platform.SetRenderer(Element, null);
				if (_appeared)
					((Page)Element).SendDisappearing();

				_appeared = false;

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

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

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

				Element = null;
				_disposed = true;
			}

			base.Dispose(disposing);
		}
Exemplo n.º 12
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			if (Forms.IsiOS7OrNewer)
				NavigationBar.Translucent = false;
			else
				WantsFullScreenLayout = false;

			_secondaryToolbar = new SecondaryToolbar { Frame = new RectangleF(0, 0, 320, 44) };
			View.Add(_secondaryToolbar);
			_secondaryToolbar.Hidden = true;

			FindParentMasterDetail();

			var navPage = (NavigationPage)Element;

			if (navPage.CurrentPage == null)
			{
				throw new InvalidOperationException(
					"NavigationPage must have a root Page before being used. Either call PushAsync with a valid Page, or pass a Page to the constructor before usage.");
			}

			var navController = ((INavigationPageController)navPage);

			navController.PushRequested += OnPushRequested;
			navController.PopRequested += OnPopRequested;
			navController.PopToRootRequested += OnPopToRootRequested;
			navController.RemovePageRequested += OnRemovedPageRequested;
			navController.InsertPageBeforeRequested += OnInsertPageBeforeRequested;

			UpdateTint();
			UpdateBarBackgroundColor();
			UpdateBarTextColor();

			// If there is already stuff on the stack we need to push it
			((INavigationPageController)navPage).StackCopy.Reverse().ForEach(async p => await PushPageAsync(p, false));

			_tracker = new VisualElementTracker(this);

			Element.PropertyChanged += HandlePropertyChanged;

			UpdateToolBarVisible();
			UpdateBackgroundColor();
			Current = navPage.CurrentPage;
		}
		protected override void Dispose(bool disposing)
		{
		    if (!_disposed && disposing)
		    {
		        if (Element != null)
		        {
		            PageController.SendDisappearing();
		            Element.PropertyChanged -= HandlePropertyChanged;
		            Element = null;
		        }

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

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

		        if (_masterController != null)
		        {
		            _masterController.WillAppear -= MasterControllerWillAppear;
		            _masterController.WillDisappear -= MasterControllerWillDisappear;
		        }

		        _disposed = true;
		    }
		    base.Dispose(disposing);
		}
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();
			UpdateBackground();
			_tracker = new VisualElementTracker(this);
			_events = new EventTracker(this);
			_events.LoadEvents(NativeView);
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && !_disposed)
			{
				Element.SizeChanged -= PageOnSizeChanged;
				Element.PropertyChanged -= HandlePropertyChanged;

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

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

				if (_tapGesture != null)
				{
					if (_clickOffView != null && _clickOffView.GestureRecognizers.Contains(_panGesture))
					{
						_clickOffView.GestureRecognizers.Remove(_tapGesture);
						_clickOffView.Dispose();
					}
					_tapGesture.Dispose();
				}
				if (_panGesture != null)
				{
					if (View != null && View.GestureRecognizers.Contains(_panGesture))
						View.GestureRecognizers.Remove(_panGesture);
					_panGesture.Dispose();
				}

				EmptyContainers();

				((Page)Element).SendDisappearing();

				_disposed = true;
			}

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

			_tracker = new VisualElementTracker(this);
			_events = new EventTracker(this);
			_events.LoadEvents(View);

			((MasterDetailPage)Element).PropertyChanged += HandlePropertyChanged;

			_tapGesture = new UITapGestureRecognizer(() =>
			{
				if (Presented)
					Presented = false;
			});
			_clickOffView.AddGestureRecognizer(_tapGesture);

			PackContainers();
			UpdateMasterDetailContainers();

			UpdateBackground();

			UpdatePanGesture();
		}