public override void RowSelected(UITableView tableView, Foundation.NSIndexPath indexPath)
        {
            var                    row           = indexPath.Row;
            UIStoryboard           storyboard    = UIStoryboard.FromName("Main", null);
            UINavigationController navController = this.slideMenuController().MainViewController as UINavigationController;

            this.slideMenuController().RemoveRightGestures();

            switch (row)
            {
            case 0:

                ViewController controller = storyboard.InstantiateViewController("ViewController") as ViewController;
                controller.Title = "First View Controller";
                navController.SetViewControllers(new UIViewController[] { controller }, true);
                break;

            case 1:
                ViewController2 controller2 = storyboard.InstantiateViewController("ViewController2") as ViewController2;
                controller2.Title = "Second View Controller";
                navController.SetViewControllers(new UIViewController[] { controller2 }, true);
                break;

            case 2:
                ViewController3 controller3 = storyboard.InstantiateViewController("ViewController3") as ViewController3;
                controller3.Title = "Third View Controller";
                this.slideMenuController().AddRightGestures();
                navController.SetViewControllers(new UIViewController[] { controller3 }, true);
                break;
            }



            this.CloseLeft();
        }
Exemplo n.º 2
0
 public override void NotifyPagePushed(INavigationPage page)
 {
     // we are just pushing new page, no trickery required
     if (!Intercepting)
     {
         var viewControllers = _navigationController.ViewControllers;
         // check if this controller is not already on stack
         if (viewControllers.Any(controller => ReferenceEquals(controller, page)))
         {
             // if so we have to remove them
             var clearedViewControllers = viewControllers.ToList();
             clearedViewControllers.RemoveAll(controller => ReferenceEquals(page, controller));
             clearedViewControllers.Add(page as UIViewController);
             viewControllers = clearedViewControllers.ToArray();
             _navigationController.SetViewControllers(viewControllers, true);
             _needsToSetPageAsRoot = false;
         }
         else
         {
             if (_needsToSetPageAsRoot)
             {
                 _navigationController.SetViewControllers(new[] { (UIViewController)page }, true);
                 _needsToSetPageAsRoot = false;
             }
             else
             {
                 _navigationController.PushViewController((UIViewController)page, true);
             }
         }
     }
 }
Exemplo n.º 3
0
            public void InsertView(int index, IMXView view)
            {
                //increment index so that this controller cannot be removed
                Parameter.CheckIndex(NavigationController.ViewControllers, "history", ++index);

                var vcs = NavigationController.ViewControllers;

                vcs[index] = TouchFactory.GetNativeObject <UIViewController>(view, "view");
                NavigationController.SetViewControllers(vcs, false);
            }
        public override void Execute(CallbackActionWaiter callbackActionWaiter, bool animated)
        {
            UINavigationController navigationController = (UINavigationController)HostStack.Host;

            if (Controllers.Count == 1)
            {
                navigationController.PushViewController(Controllers[0].AsViewController(), animated);
            }
            else
            {
                UIViewController[] vcs    = navigationController.ViewControllers;
                UIViewController[] newVcs = new UIViewController[vcs.Length + Controllers.Count];

                for (int i = 0; i < vcs.Length; i++)
                {
                    newVcs[i] = vcs[i];
                }

                for (int i = 0, j = vcs.Length; j < newVcs.Length; ++i, ++j)
                {
                    newVcs[j] = Controllers[i].AsViewController();
                }

                navigationController.SetViewControllers(newVcs, animated);
            }
        }
Exemplo n.º 5
0
        void HandlePageModeButtonTouchUpInside()
        {
            HidePopover();

            if (pageModeViewController == null)
            {
                PopoverPageModeController pmc = new PopoverPageModeController();
                pmc.Title          = StringRef.PageView;
                pmc.PageModeEvent += HandlePageModeEvent;

                UINavigationController navController = new UINavigationController();
                navController.SetViewControllers(new UIViewController[] { pmc }, true);
                navController.View.Frame = new CGRect(0, 0, 280, 44 * 3 + 20);

                pageModeViewController = new UIPopoverController(navController);
                pageModeViewController.SetPopoverContentSize(new CGSize(navController.View.Frame.Width, navController.View.Frame.Height), true);
                pageModeViewController.PresentFromBarButtonItem(PageModeItem, UIPopoverArrowDirection.Any, true);
                pageModeViewController.DidDismiss += delegate
                {
                    pageModeViewController = null;
                };
            }
            else
            {
                pageModeViewController.Dismiss(true);
                pageModeViewController = null;
            }
        }
Exemplo n.º 6
0
        void HandleCollectionMenuButtonTouchUpInside()
        {
            HidePopover();

            if (collectionViewController == null)
            {
                PopoverCollectionController pcc = new PopoverCollectionController();
                pcc.Title             = "Menu";
                pcc.RowSelectedEvent += HandleCollectionMenuButtonEvent;

                UINavigationController navController = new UINavigationController();
                navController.SetViewControllers(new UIViewController[] { pcc }, true);
                navController.View.Frame = new CGRect(0, 0, 280, 44 * 6 + 20);

                collectionViewController = new UIPopoverController(navController);
                collectionViewController.SetPopoverContentSize(new CGSize(navController.View.Frame.Width, navController.View.Frame.Height), true);
                collectionViewController.PresentFromBarButtonItem(CollectionMenuItem, UIPopoverArrowDirection.Any, true);
                collectionViewController.DidDismiss += delegate
                {
                    collectionViewController = null;
                };
            }
            else
            {
                collectionViewController.Dismiss(true);
                collectionViewController = null;
            }
        }
 public static void SetViewController(this UINavigationController uiNavigationController, UIViewController controller, bool animated)
 {
     uiNavigationController.SetViewControllers(new[]
     {
         controller
     }, animated);
 }
Exemplo n.º 8
0
 private void ShowViewController(UIViewController controller)
 {
     if (controller != null)
     {
         ConfigureViewController(controller);
         slideNavigationController.SetViewControllers(new UIViewController[] { controller }, false);
         SlideInSlideNavigationView();
     }
 }
        public override void FinishedLaunching(UIApplication application)
        {
            Window = new UIWindow (UIScreen.MainScreen.Bounds);

            var signPDFController = new SignViewController ();
            signPDFController.View.BackgroundColor = UIColor.White;

            UINavigationController nav = new UINavigationController ();
            nav.SetViewControllers(new UIViewController[] { signPDFController }, true);
            Window.RootViewController = nav;
            Window.MakeKeyAndVisible ();
        }
Exemplo n.º 10
0
 public static void ReplaceController(this UINavigationController me, string storyboard, string controller = null, bool animated = true) {
     UIViewController ctl = getController(storyboard, controller);
     UIViewController[] vcl = this.NavigationController?.ViewControllers;
     if (vcl == null) return;
     if (vcl.Length > 0) {
         UIViewController old = vcl[vcl.Length - 1];
         vcl[vcl.Length - 1] = ctl;
         me.SetViewControllers(vcl, animated);
         (old as BaseViewController)?.Finished();
     } else {
         me.PushViewController(ctl, animated);
     }
 }
Exemplo n.º 11
0
        /// <inheritdoc/>
        public IObservable <Unit> PushPage(IPageViewModel pageViewModel, string contract, bool resetStack, bool animate)
        {
            return(Observable
                   .Start(
                       () =>
            {
                var page = LocatePageFor(pageViewModel, contract);
                return page;
            },
                       _backgroundScheduler)
                   .ObserveOn(_mainScheduler)
                   .SelectMany(
                       page =>
            {
                page.Title = pageViewModel.Title;

                return Observable
                .Create <Unit>(
                    observer =>
                {
                    CATransaction.Begin();
                    CATransaction.CompletionBlock = () =>
                    {
                        observer.OnNext(Unit.Default);
                        observer.OnCompleted();
                    };

                    if (resetStack)
                    {
                        _currentNavigationController.SetViewControllers(null, false);
                    }

                    _currentNavigationController.PushViewController(page, animated: animate);

                    CATransaction.Commit();
                    return Disposable.Empty;
                });
            }));
        }
Exemplo n.º 12
0
 private bool ShowMainView(IMvxIosView view)
 {
     if (view is CategoriesView)
     {
         if (_mainController == null)
         {
             base.Show(view);
         }
         _mainController.SetViewControllers(new UIViewController[] { view as UIViewController }, true);
         return(true);
     }
     return(false);
 }
Exemplo n.º 13
0
        public void SetSecondaryView(IMvxTouchView view)
        {
            var controller = view as UIViewController;

            if (view is ExtendParkingTimeView || view is ExtendParkingTimeConfirmView || view is BookingView || view is DelayedParkingMapView)
            {
                _secondaryNav.PushViewController(controller, true);
            }
            else
            {
                _secondaryNav.SetViewControllers(new UIViewController[] { controller }, true);
            }

            //this.ViewControllers = new UIViewController[] { ViewControllers[0], controller };
        }
Exemplo n.º 14
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Window = new UIWindow(UIScreen.MainScreen.Bounds);

            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);

            UINavigationController navController = new UINavigationController();
            navController.SetNavigationBarHidden(true, false);
            navController.SetViewControllers(new UIViewController[] { new SnakeViewController() }, true);

            // Show
            Window.RootViewController = navController;
            Window.MakeKeyAndVisible();

            return true;
        }
Exemplo n.º 15
0
        // Is called by other apps from "open in" dialogs
        public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation)
        {
            var sourceFile = url.Path;
            var destFile   = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), System.IO.Path.GetFileName(sourceFile));

            if (!File.Exists(sourceFile))
            {
                return(false);
            }

            var fileExists = false;

            if (File.Exists(destFile))
            {
                fileExists = true;
                File.Delete(destFile);
            }

            File.Copy(sourceFile, destFile);

            Cartridge cart = new Cartridge(destFile);

            CartridgeLoaders.LoadMetadata(new FileStream(destFile, FileMode.Open), cart);

            // TODO
            // If there was a cartridge with the same filename, than replace
            if (fileExists)
            {
            }

            if (window.RootViewController.PresentedViewController is UINavigationController && window.RootViewController.PresentedViewController == navCartSelect)
            {
                // Now create a new list for cartridges
                viewCartSelect = new CartridgeList(this);
                // Add the cartridge view to the navigation controller
                // (it'll be the top most screen)
                navCartSelect.PopToRootViewController(true);
                navCartSelect.SetViewControllers(new UIViewController[] { (UIViewController)viewCartSelect }, false);
//				CartridgeDetail cartDetail = new CartridgeDetail(this);
//				((UINavigationController)window.RootViewController.PresentedViewController).PushViewController (cartDetail,true);
//				cartDetail.Cartridge = cart;
            }

            return(true);
        }
		partial void RegisterButtonClicked(Foundation.NSObject sender)
		{

			if (!ShowedEULA)
			{
				UINavigationController nc = new UINavigationController();
				nc.NavigationBar.BackgroundColor = UIColor.White;
				nc.NavigationBar.TintColor = UIColor.Blue;
				nc.NavigationBar.BarTintColor = UIColor.White;

				WebViewController vc = new WebViewController();

				vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(Strings.accept, UIBarButtonItemStyle.Plain, delegate
				{
					nc.DismissViewController(true, delegate
					{
						ShowedEULA = true;
						PerformSegue("Landing2Register", this);
					});
				});



				vc.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Strings.cancel, UIBarButtonItemStyle.Plain, delegate
				{
					nc.DismissViewController(true, null);
				});



				vc.NavigationItem.RightBarButtonItem.Enabled = false;
				vc.NavigationItem.LeftBarButtonItem.Enabled = false;


				vc.URL = Strings.web_url_base + Strings.web_url_privacy_policy;
				nc.SetViewControllers(new UIViewController[] { vc }, false);
				this.PresentViewController(nc, true, null);
			}
			else {
				PerformSegue("Landing2Register", this);
			}

		}
Exemplo n.º 17
0
		public override bool FinishedLaunching (UIApplication application, NSDictionary option)
		{
			UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval (UIApplication.BackgroundFetchIntervalMinimum);

			TCLocalizabled.initialize ();

			NSNotificationCenter.DefaultCenter.AddObserver (new NSString("finshedSplash"), finshedSplash);

			// Load SplashScreen
			UINavigationController navigationVC = new UINavigationController ();
			navigationVC.NavigationBar.Hidden = true;

			TCSplashScreenViewController splashSreenVC = new TCSplashScreenViewController ();
			splashSreenVC.View.Frame = new CoreGraphics.CGRect (0.0f, 0.0f, 320.0f, 480.0f);			
		
			navigationVC.SetViewControllers (new UIViewController[] { splashSreenVC }, true);
			this.Window.RootViewController = navigationVC;
			this.Window.MakeKeyAndVisible ();

			return true;
		}
Exemplo n.º 18
0
        public override void Show(IMvxTouchView view)
        {
            if (view is SignInView || view is SignUpView)
            {
                if (_navigationController != null)
                {
                    _window.RootViewController = _navigationController;
                }


                if (view is SignInView)
                {
                    _navigationController.SetViewControllers(new UIViewController[] { view as UIViewController }, true);
                }
                else
                {
                    _navigationController.PushViewController(view as UIViewController, true);
                }
                //TODO : maybe using MasterNavigationController to Push SignUpView into NavigationStack
                //or use base.Show(view) ???
                return;
            }
            else
            {
                if (_splitView != null)
                {
                    _window.RootViewController = _splitView;
                }

                if (view is BaseMenuView)
                {
                    _splitView.SetPrimaryView(view);
                }
                else
                {
                    _splitView.SetSecondaryView(view);
                }
            }
        }
Exemplo n.º 19
0
        // place this item in the detail pane
        public void PushToDetail(UIViewController vc)
        {
            // first time through!
            if (_splitViewController == null && _masterNavigationController == null)
            {
                Init(vc);
                return;
            }

            if (_splitViewController != null)
            {
                // DKL - commented out as this was causing the popup detail to immediately disappear
                //_splitViewController.HidePopover();
                _detailNavigationController.SetViewControllers(new UIViewController[1] {
                    vc
                }, false);
                //_splitViewController.SetDetailViewController(_detailNavigationController = new UINavigationController(vc));
                _splitViewController.UpdateMasterButton();

                //if (_options.NavigationBarTintColor != UIColor.Clear)
                //{
                //	_detailNavigationController.NavigationBar.TintColor = _options.NavigationBarTintColor;
                //}


                // ipad -- set pane, we just change out the panes depending on the master
                //_detailNavigationController.PopToRootViewController(false);
                //_detailNavigationController.PopViewControllerAnimated(false);
                //_detailNavigationController.PushViewController(vc, false);
                //_splitViewControllerDelegate.ReplaceDetailNavigationViewController();
                //_splitViewControllerDelegate.HidePopover();
            }
            else
            {
                _masterNavigationController.DisplayViewController(vc, true);
            }
        }
Exemplo n.º 20
0
		// Sign Out
		public void signOut(UIStoryboard storyBoard)
		{
			MApplication.getInstance ().isLogedIn = false;
			TCGlobals.getInstance.isAllowShowAlert = false;
			TCNotificationCenter.defaultCenter.observers.Clear ();
			MApplication.getInstance ().isConnectedSignalR = false;
			UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;

			new System.Threading.Thread (new System.Threading.ThreadStart (() => {
				if (TCGlobals.getInstance.currentSignalR != null)
					TCGlobals.getInstance.currentSignalR.stop ();
			})).Start ();
				
			TCLogOutHelper logoutHelper = new TCLogOutHelper (UIApplication.SharedApplication.KeyWindow.RootViewController);
			logoutHelper.logOut ();

			TCViewIdentity.getInstance.setObjectForKey ("TCMainTabViewController", null);

			TCViewIdentity.getInstance.setObjectForKey ("TCBookingAlertViewController", null);
			TCViewIdentity.getInstance.setObjectForKey ("TCBookingConfirmedViewController", null);
			TCViewIdentity.getInstance.setObjectForKey ("TCBookingPastViewController", null);
			TCViewIdentity.getInstance.setObjectForKey ("TCBookingRequestViewController", null);

			TCSortTable.currentIndexPath = NSIndexPath.FromRowSection (0, 0);

			CoreSystem.Utils.keepAccessToken ("");
			CoreSystem.Utils.keepEmail ("");
			TCGlobals.getInstance.accessToken = "";

			MApplication.getInstance ().isRequired = true;

			MApplication.getInstance ().userId = Guid.Empty;


			TCGlobals.getInstance.isAddObserverSplash = false;
			TCGlobals.getInstance.searchFromDashboard = false;
			TCGlobals.getInstance.myEmail = "";
		
			TCHomeViewController homeVC = (TCHomeViewController)storyBoard.InstantiateViewController ("TCHomeViewController");
			UINavigationController rootVC = new UINavigationController ();
			rootVC.SetViewControllers (new UIViewController[] { homeVC }, true);

			UIApplication.SharedApplication.Delegate.GetWindow ().RootViewController = rootVC;
			UIApplication.SharedApplication.Delegate.GetWindow ().MakeKeyAndVisible ();

			if (TCViewIdentity.getInstance.getObjectForKey ("TCMainTabViewController") != null) {
				TCMainTabViewController mainVC = (TCMainTabViewController)TCViewIdentity.getInstance.getObjectForKey ("TCMainTabViewController");
				mainVC.Dispose();
			}

			if (TCViewIdentity.getInstance.getObjectForKey ("TCSplashScreenViewController") != null && !TCGlobals.getInstance.isAddObserverSplash) {
				TCSplashScreenViewController splashScreenVC = (TCSplashScreenViewController)TCViewIdentity.getInstance.getObjectForKey ("TCSplashScreenViewController");
				splashScreenVC.addObserverNetwork ();
			}

		}
Exemplo n.º 21
0
        public override void PushViewController(UIViewController viewController, bool animated)
        {
            if (ViewControllers.Length <= 0)
            {
                // NOTE: pushViewController is called by init(rootViewController: UIViewController)
                // so we must perform the normal super method in this case.
                base.PushViewController(viewController, animated: true);
                return;
            }

            UINavigationController presentingViewController = null;

            if (PresentingViewController is UINavigationController)
            {
                presentingViewController = PresentingViewController as UINavigationController;
            }
            else if (PresentingViewController is UITabBarController)
            {
                presentingViewController = ((UITabBarController)PresentingViewController).SelectedViewController as UINavigationController;
            }

            if (presentingViewController == null)
            {
                PresentViewController(viewController, animated, null);
                System.Diagnostics.Debug.WriteLine("SideMenu Warning: cannot push a ViewController from a ViewController without a NavigationController. It will be presented it instead.");
                return;
            }

            // to avoid overlapping dismiss & pop/push calls, create a transaction block where the menu
            // is dismissed after showing the appropriate screen
            CATransaction.Begin();
            CATransaction.CompletionBlock = () =>
            {
                if (SideMenuManager.MenuPushStyle != SideMenuManager.MenuPushStyleType.NoNavigation)
                {
                    this.DismissViewController(true, null);
                }

                this.VisibleViewController?.ViewWillAppear(false); // Hack: force selection to get cleared on UITableViewControllers when reappearing using custom transitions
            };

            UIView.Animate(SideMenuManager.AnimationDismissDuration, animation: () => SideMenuManager.SideMenuTransition.HideMenuStart());

            if (!SideMenuManager.AllowPushOfSameClassTwice)
            {
                //TODO: Review this
                var lastView = ViewControllers.LastOrDefault();
                if (lastView != null && lastView.GetType() == viewController.GetType()) //if presentingViewController.viewControllers.last?.dynamicType == viewController.dynamicType {
                {
                    CATransaction.Commit();
                    return;
                }
            }

            switch (SideMenuManager.MenuPushStyle)
            {
            case SideMenuManager.MenuPushStyleType.SubMenu:
            case SideMenuManager.MenuPushStyleType.DefaultBehavior:
                break;

            case SideMenuManager.MenuPushStyleType.PopWhenPossible:
                foreach (var subViewController in presentingViewController.ViewControllers.Reverse())
                {
                    if (subViewController.GetType() == viewController.GetType())
                    {
                        presentingViewController.PopToViewController(subViewController, animated: animated);
                        CATransaction.Commit();
                        return;
                    }
                }
                break;

            case SideMenuManager.MenuPushStyleType.Preserve:
            case SideMenuManager.MenuPushStyleType.PreserveAndHideBackButton:
                var viewControllers         = presentingViewController.ViewControllers;
                var preservedViewController = viewControllers.Where(x => x.GetType() == viewController.GetType()).LastOrDefault();
                if (preservedViewController != null)
                {
                    if (SideMenuManager.MenuPushStyle == SideMenuManager.MenuPushStyleType.PreserveAndHideBackButton)
                    {
                        preservedViewController.NavigationItem.SetHidesBackButton(true, false);
                    }
                    viewControllers.Append(preservedViewController);
                    presentingViewController.SetViewControllers(viewControllers, animated: animated);

                    CATransaction.Commit();
                    return;
                }

                if (SideMenuManager.MenuPushStyle == SideMenuManager.MenuPushStyleType.PreserveAndHideBackButton)
                {
                    viewController.NavigationItem.SetHidesBackButton(true, false);
                }
                break;

            case SideMenuManager.MenuPushStyleType.Replace:
            case SideMenuManager.MenuPushStyleType.NoNavigation:
                if (SideMenuManager.MenuPushStyle != SideMenuManager.MenuPushStyleType.NoNavigation)
                {
                    viewController.NavigationItem.LeftBarButtonItem  = SideMenuManager.LeftNavigationController.NavigationItem.LeftBarButtonItem;
                    viewController.NavigationItem.RightBarButtonItem = SideMenuManager.LeftNavigationController.NavigationItem.RightBarButtonItem;
                }
                else
                {
                    viewController.NavigationItem.SetHidesBackButton(true, false);
                }
                UIViewController[] viewctrl = { viewController };

                presentingViewController.SetViewControllers(viewctrl, true);
                CATransaction.Commit();
                return;

            default:
                break;
            }

            presentingViewController.PushViewController(viewController, animated: animated);
            CATransaction.Commit();
        }
		private void setNavigation ()
		{
			UINavigationController navigationVC = new UINavigationController ();
			navigationVC.SetViewControllers (new UIViewController[] { rootVC }, true);
			NSNotificationCenter.DefaultCenter.PostNotificationName ("finshedSplash", navigationVC);
		}
Exemplo n.º 23
0
 private void SetLoginAsRootControler()
 {
     _navigationController.SetViewControllers(new UIViewController[] { new LoginViewControler() }, false);
 }
Exemplo n.º 24
0
 public void Stop(bool animated)
 {
     _coordinators.Clear();
     _navigationController?.SetViewControllers(new UIViewController[] {}, animated);
 }