/// <summary>
 /// Hides the popover.
 /// </summary>
 public void HidePopover()
 {
     if (masterPopoverShown)
     {
         NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { menu }, true);
         AnimateMasterView(false);
     }
 }
 /// <summary>
 /// Shows the popover.
 /// </summary>
 public void ShowPopover()
 {
     if (!masterPopoverShown)
     {
         NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { hide }, true);
         AnimateMasterView(true);
     }
 }
Esempio n. 3
0
        private void OnPopoverMenuToggled(PopoverMenuToggled e)
        {
            if (false == e.Show)
            {
                return;
            }

            NavigationItem.SetLeftBarButtonItems(new[] { _hideMenuButton }, true);
        }
        private void SetupNavigationBar()
        {
            _backButton       = new UIButton(UIButtonType.Custom);
            _backButton.Frame = new CGRect(0, 0, 40, 40);
            _backButton.SetImage(UIImage.FromBundle("backButton"), UIControlState.Normal);

            NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { new UIBarButtonItem(_backButton) }, false);

            MvxFluentBindingDescriptionSet <TaskDetailsViewController, TaskDetailsViewModel> set = this.CreateBindingSet <TaskDetailsViewController, TaskDetailsViewModel>();

            set.Bind(_backButton).To(vm => vm.BackViewCommand);
            set.Apply();
        }
Esempio n. 5
0
        private void OnPopoverMenuToggled(PopoverMenuToggleRequested e)
        {
            if (e.Show)
            {
                return;
            }
            var leftBarButtonItems = NavigationItem.LeftBarButtonItems;

            if (NavigationItem != null && leftBarButtonItems != null)
            {
                var uiBarButtonItems = leftBarButtonItems.Concat(new[] { _previousSpaceButton, _previousButton }).ToArray();
                NavigationItem.SetLeftBarButtonItems(uiBarButtonItems, true);
            }
        }
Esempio n. 6
0
        void SetSelectingNavItems(bool animated)
        {
            if (ios7)
            {
                cancelSelBtn.TintColor = UIColor.White;
            }

            NavigationItem.LeftItemsSupplementBackButton = false;
            NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] {
                cancelSelBtn,
            }, animated);
            NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] {
            }, animated);
        }
Esempio n. 7
0
        private void ShowSegmentImpl(int segment)
        {
            if (null == _dataMap)
            {
                return;
            }

            var rightButtons = new List <UIBarButtonItem> {
                _saveButton, _nextSpaceButton, _nextButton
            };

            // Activates the controller which contains the
            // details of the composite (i.e. parent) app.
            if (segment == 0)
            {
                _selectedController         = _compositeController;
                newCompositionButton.Hidden = true;
            }
            else
            {
                _selectedController = _componentControllers[segment - 1].Value;

                // Let's display the "new child"
                // button, but only if the data
                // map already exists on the server.
                if (!_dataMap.Composite.LocalState.IsLocal)
                {
                    //                    buttons.Add(_newButton);
                }
                newCompositionButton.Hidden = false;
            }

            Theme.Fade(View);
            segmentedControl.SelectedSegment = segment;

            // Performs the view transfer dance.
            _selectedController.View.Frame = containerView.Bounds;
            containerView.AddSubview(_selectedController.View);
            _selectedController.View.MovedToSuperview();

            var originalLeftButtons = NavigationItem.LeftBarButtonItems;
            var leftButtons         = originalLeftButtons == null
                ? new[] { _previousSpaceButton, _previousButton }
                : originalLeftButtons.Concat(new[] { _previousSpaceButton, _previousButton }).ToArray();

            NavigationItem.SetLeftBarButtonItems(leftButtons
                                                 , false);
            NavigationItem.SetRightBarButtonItems(rightButtons.ToArray(), false);
        }
Esempio n. 8
0
 /// <summary>
 /// Shows the popover.
 /// </summary>
 public void ShowPopover()
 {
     if (!masterPopoverShown)
     {
         if (Theme.IsiOS7)
         {
             NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] { hide }, true);
         }
         else
         {
             NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { hide }, true);
         }
         AnimateMasterView(true);
     }
 }
Esempio n. 9
0
 private void SwitchOrientation(UIInterfaceOrientation orientation)
 {
     if (orientation.IsLandscape())
     {
         if (!_wasLandscape)
         {
             NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[0], true);
             _wasLandscape = true;
         }
     }
     else
     {
         if (_wasLandscape)
         {
             NavigationItem.SetLeftBarButtonItems(new[] { _hideMenuButton }, true);
             _wasLandscape = false;
         }
     }
 }
Esempio n. 10
0
        private void InitializeNavBarItems()
        {
            var navBarItems = new List <UIBarButtonItem>();
            var gap         = ButtonBarUtil.CreateGapSpacer();

            // replacing default iOS back button
            if (IsBackButtonVisible &&
                NavigationController != null &&
                NavigationController.ViewControllers.Length > 1)
            {
                NavigationItem.HidesBackButton = true;

                _backButton = ButtonBarUtil.Create(
                    ThemeIcons.Back,
                    ThemeIcons.BackLandscape,
                    SemiTransparentType.Light);
                _backButton.TouchUpInside += OnNavigationBackClick;
                _backButton.UpdateState();

                var backBarButton = new UIBarButtonItem(_backButton);
                NavigationItem.SetLeftBarButtonItems(new [] { gap, backBarButton }, true);
            }

            OnInitializeNavBarItems(navBarItems);

            // More (...) Button
            if (IsMoreButtonVisible)
            {
                _moreButton = ButtonBarUtil.Create(
                    ThemeIcons.More,
                    ThemeIcons.MoreLandscape,
                    SemiTransparentType.Light);
                _moreButton.TouchUpInside += OnMoreButtonClicked;

                var moreBarButton = new UIBarButtonItem(_moreButton);
                navBarItems.AddRange(new [] { moreBarButton, gap });
            }

            navBarItems.Reverse();

            NavigationItem.SetRightBarButtonItems(navBarItems.ToArray(), true);
        }
Esempio n. 11
0
        void SetEditingNavItems(bool animated)
        {
            if (ios7)
            {
                EditButtonItem.TintColor = UIColor.White;
                dupBtn.TintColor         = UIColor.White;
                moveBtn.TintColor        = UIColor.White;
                deleteBtn.TintColor      = UIColor.White;
            }

            NavigationItem.LeftItemsSupplementBackButton = false;
            NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] {
                dupBtn,
                moveBtn,
                deleteBtn,
            }, animated);
            NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] {
                EditButtonItem,
            }, animated);
        }
Esempio n. 12
0
        void SetNormalNavItems(bool animated)
        {
            if (ios7)
            {
                var tint = Praeclarum.Graphics.ColorEx.GetUIColor(DocumentAppDelegate.Shared.App.TintColor);

                actionBtn.TintColor      = tint;
                addBtn.TintColor         = tint;
                EditButtonItem.TintColor = tint;
            }

            NavigationItem.LeftItemsSupplementBackButton = true;
            NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] {
                thereforeBtn,
                actionBtn,
            }, animated);
            NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] {
                addBtn,
                EditButtonItem,
            }, animated);
        }
Esempio n. 13
0
        private void InitializeNavBarItems()
        {
            var gap = ButtonBarUtil.CreateGapSpacer();

            _closeButton = ButtonBarUtil.Create(
                ThemeIcons.Close,
                ThemeIcons.CloseLandscape);
            _closeButton.TouchUpInside += OnCloseButtonClick;
            var closeButtonItem = new UIBarButtonItem(_closeButton);

            _backButton = ButtonBarUtil.Create(
                ThemeIcons.Back,
                ThemeIcons.BackLandscape);
            _backButton.TouchUpInside += OnBackButtonClick;
            _backButtonItem            = new UIBarButtonItem(_backButton);

            NavigationItem.SetLeftBarButtonItems(new [] { gap, closeButtonItem, _backButtonItem }, true);

            _indicatorView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White)
            {
                Frame = new CGRect(0, 0, 40, 40)
            };
            _progressButtonItem = new UIBarButtonItem(_indicatorView);

            _forwardButton = ButtonBarUtil.Create(
                ThemeIcons.Forward,
                ThemeIcons.ForwardLandscape);
            _forwardButton.TouchUpInside += OnForwardButtonClick;
            _forwardButtonItem            = new UIBarButtonItem(_forwardButton);

            _moreButton = ButtonBarUtil.Create(
                ThemeIcons.More,
                ThemeIcons.MoreLandscape);
            _moreButton.TouchUpInside += OnMoreButtonClicked;
            var moreButtonItem = new UIBarButtonItem(_moreButton);

            NavigationItem.SetRightBarButtonItems(
                new [] { gap, moreButtonItem, _forwardButtonItem, _progressButtonItem }, true);
        }
        void SetNormalNavItems(bool animated)
        {
            if (ios7)
            {
                var theme = Theme.Current;
                var tint  = theme.TintColor;

                actionBtn.TintColor      = tint;
                addBtn.TintColor         = tint;
                EditButtonItem.TintColor = tint;
                thereforeBtn.TintColor   = tint;
            }

            NavigationItem.LeftItemsSupplementBackButton = true;
            NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] {
                thereforeBtn,
                actionBtn,
            }, animated);
            NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] {
                addBtn,
                EditButtonItem,
            }, animated);
        }
Esempio n. 15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var bindingSet = this.CreateBindingSet <ExceptionModalView, ModalViewModel>();

            bindingSet = BindLoader(bindingSet);

            var exceptionDetails = new TLabelView();

            Add(exceptionDetails);

            bindingSet.Bind(exceptionDetails).To(vm => vm.Exception).Apply();

            var closeButton = new UIButton(UIButtonType.Custom);

            closeButton.SetImage(UIImage.FromBundle("Images/close.png"), UIControlState.Normal);
            closeButton.Frame = new RectangleF(0, 0, 30, 30);
            NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] {
                new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace, null, null)
                {
                    Width = -5f
                },
                new UIBarButtonItem(closeButton)
            }, false);

            bindingSet.Bind(closeButton)
            .For("TouchUpInside")
            .To(vm => vm.CloseCommand).Apply();

            View.AddConstraints(new FluentLayout[] {
                exceptionDetails.AtTopOf(View, Constants.MARGIN),
                exceptionDetails.AtLeftOf(View, Constants.MARGIN),
                exceptionDetails.WithSameWidth(View).Minus(Constants.MARGIN * 2)
            });
        }
Esempio n. 16
0
 private void OnTogglePopoverMenu()
 {
     SimpleEventBus.Publish(new PopoverMenuToggleRequested(false));
     NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[0], true);
 }
Esempio n. 17
0
        /// <summary>
        /// Performs the work for animating the orientation
        /// </summary>
        private void SwitchOrientation(UIInterfaceOrientation orientation, bool animated, double duration = .5)
        {
            if (orientation.IsLandscape())
            {
                if (!wasLandscape)
                {
                    //Set the navbar to have only the back button
                    if (Theme.IsiOS7)
                    {
                        NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[0], true);
                    }
                    else
                    {
                        NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[0], true);
                    }

                    //Hide the master view if needed
                    if (masterPopoverShown)
                    {
                        AnimateMasterView(false);
                    }

                    if (animated)
                    {
                        UIView.BeginAnimations("SwitchOrientation");
                        UIView.SetAnimationDuration(duration);
                        UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
                    }

                    //Slide the masterView inward
                    var frame = masterView.Frame;
                    frame.X          = 0;
                    masterView.Frame = frame;

                    //Shrink the detailView
                    frame            = detailView.Frame;
                    frame.X         += masterWidth;
                    frame.Width     -= masterWidth;
                    detailView.Frame = frame;

                    if (animated)
                    {
                        UIView.CommitAnimations();
                    }
                    wasLandscape = true;
                }
            }
            else
            {
                if (wasLandscape)
                {
                    //Set the nav bar to include the menu button
                    if (Theme.IsiOS7)
                    {
                        NavigationItem.SetRightBarButtonItems(new UIBarButtonItem[] { menu }, true);
                    }
                    else
                    {
                        NavigationItem.SetLeftBarButtonItems(new UIBarButtonItem[] { menu }, true);
                    }

                    if (animated)
                    {
                        UIView.BeginAnimations("SwitchOrientation");
                        UIView.SetAnimationDuration(duration);
                        UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
                    }

                    //Slide the masterView off screen
                    var frame = masterView.Frame;
                    frame.X          = -frame.Width;
                    masterView.Frame = frame;

                    //Grow the detailView
                    frame            = detailView.Frame;
                    frame.X         -= masterWidth;
                    frame.Width     += masterWidth;
                    detailView.Frame = frame;

                    if (animated)
                    {
                        UIView.CommitAnimations();
                    }
                    wasLandscape = false;
                }
            }
        }