Esempio n. 1
0
        //private UINavigationController _navigationCotroller;
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // create a new window instance based on the screen size
            window                  = new UIWindow(UIScreen.MainScreen.Bounds);
            Menu                    = new SlideoutNavigationController();
            Menu.TopView            = new PublicationsViewController(false);
            Menu.LeftMenuButtonText = "Menu".t();
            Menu.MenuViewLeft       = new LeftMenu();
            Menu.DefineTextColor();
            Menu.BarTintColor         = UIColor.FromRGB(255, 153, 0);
            Menu.TintColor            = UIColor.White;
            Menu.Translucent          = false;
            window.RootViewController = Menu;

            // make the window visible
            window.MakeKeyAndVisible();
            UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Alert
                                                                               | UIRemoteNotificationType.Badge
                                                                               | UIRemoteNotificationType.Sound);

            if (launchOptions != null)
            {
                var dictionary = launchOptions.ObjectForKey(UIApplication.LaunchOptionsRemoteNotificationKey);
                if (dictionary != null)
                {
                    Console.WriteLine("Received Dictionary: " + dictionary);
                    // TODO Handle the information from the notification and show
                    // the appropriate view to the user
                }
            }

            return(true);
        }
Esempio n. 2
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            //Set the status bar
            if (Util.iOSVersion.Item1 < 6)
            {
                UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.BlackOpaque, false);
            }
            else
            {
                UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.BlackTranslucent, false);
            }

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                var textAttrs = new UITextAttributes()
                {
                    TextColor = UIColor.White, TextShadowColor = UIColor.DarkGray, TextShadowOffset = new UIOffset(0, -1)
                };
                UINavigationBar.Appearance.SetTitleTextAttributes(textAttrs);
                UISegmentedControl.Appearance.SetTitleTextAttributes(textAttrs, UIControlState.Normal);
            }

            //Set the theming
            UIBarButtonItem.Appearance.SetBackButtonBackgroundImage(Images.Controls.BackButton.CreateResizableImage(new UIEdgeInsets(0, 16, 0, 10)), UIControlState.Normal, UIBarMetrics.Default);
            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UIPopoverController)).SetBackButtonBackgroundImage(null, UIControlState.Normal, UIBarMetrics.Default);

            UIBarButtonItem.Appearance.SetBackgroundImage(Images.Controls.Button, UIControlState.Normal, UIBarMetrics.Default);
            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UIPopoverController)).SetBackgroundImage(null, UIControlState.Normal, UIBarMetrics.Default);

            UINavigationBar.Appearance.SetBackgroundImage(Images.Controls.Navbar.CreateResizableImage(new UIEdgeInsets(0, 0, 0, 0)), UIBarMetrics.Default);
            UINavigationBar.AppearanceWhenContainedIn(typeof(UIPopoverController)).SetBackgroundImage(null, UIBarMetrics.Default);

            UIToolbar.Appearance.SetBackgroundImage(Images.Controls.Navbar.CreateResizableImage(new UIEdgeInsets(0, 0, 0, 0)), UIToolbarPosition.Any, UIBarMetrics.Default);

            Window                    = new UIWindow(UIScreen.MainScreen.Bounds);
            SlideController           = new SlideoutNavigationController();
            Window.RootViewController = SlideController;
            SlideController.SelectView(new RecentPatternsViewController());
            Window.MakeKeyAndVisible();


            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
            {
                UIImageView killSplash = null;
                if (IsTall)
                {
                    killSplash = new UIImageView(UIImageHelper.FromFileAuto("Default-568h"));
                }
                else
                {
                    killSplash = new UIImageView(UIImageHelper.FromFileAuto("Default"));
                }

                Window.AddSubview(killSplash);
                Window.BringSubviewToFront(killSplash);
                UIView.Animate(0.8, () => killSplash.Alpha = 0.0f, killSplash.RemoveFromSuperview);
            }

            return(true);
        }
Esempio n. 3
0
        private MXSlideoutContainer(MXApplication theApp, UIApplicationDelegate appDelegate, UIWindow window) : base(theApp)
        {
            _appDelegate = appDelegate;
            Menu         = new SlideoutNavigationController();

            _window = window;
            _window.RootViewController = Menu;
        }
Esempio n. 4
0
 public MenuController(SlideoutNavigationController menu, IDictionaryStorage storage)
     : base(UITableViewStyle.Plain, new RootElement(""))
 {
     this.menu        = menu;
     this.storage     = storage;
     homeControlled   = new HomeScreen(storage);
     updateController = new SourceTypeController(storage);
     menu.TopView     = storage.Empty() ? updateController : homeControlled;
 }
        private void GoToMenu(Unit o)
        {
            var vc = new MenuViewController();
            var slideoutController = new SlideoutNavigationController();

            slideoutController.MenuViewController   = new MenuNavigationController(vc, slideoutController);
            slideoutController.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve;
            PresentViewController(slideoutController, true, () => vc.ViewModel.GoToDefaultTopView.ExecuteNow());
        }
Esempio n. 6
0
        public void ShowMainWindow()
        {
            var defaultAccount = GetDefaultAccount();

            Application.SetUser(defaultAccount);

            _nav = new SlideoutNavigationController();
            _window.RootViewController = _nav;
            _nav.SelectView(new MyGistsController());
        }
Esempio n. 7
0
        private void GoToMenu(object o)
        {
            var vc = new MenuViewController();
            var slideoutController = new SlideoutNavigationController();

            slideoutController.MenuViewController = new MenuNavigationController(vc, slideoutController);
            (UIApplication.SharedApplication.Delegate as AppDelegate).Do(y => y.Presenter.SlideoutNavigationController = slideoutController);
            vc.ViewModel.GoToDefaultTopView.Execute(null);
            slideoutController.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve;
            PresentViewController(slideoutController, true, null);
        }
        private void DoTransition(UIViewController fromViewController, IBaseViewModel fromViewModel, UIViewController toViewController, IBaseViewModel toViewModel)
        {
            var toViewDismissCommand = toViewModel.DismissCommand;

//            if (toViewController is SettingsViewController)
//            {
//                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(CodeFramework.iOS.Images.Cancel, UIBarButtonItemStyle.Plain, (s, e) => toViewDismissCommand.ExecuteIfCan());
//                toViewDismissCommand.Subscribe(__ => toViewController.DismissViewController(true, null));
//                fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
//            }
            if (toViewController is AccountsView || toViewController is WebBrowserViewController || toViewController is GistCommentView ||
                toViewController is CommitCommentView || toViewController is GistCreateView || toViewController is FeedbackComposerView)
            {
                var rootNav = (UINavigationController)UIApplication.SharedApplication.Delegate.Window.RootViewController;
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Cancel, UIBarButtonItemStyle.Plain, (s, e) => toViewDismissCommand.ExecuteIfCan());
                toViewDismissCommand.Subscribe(_ => rootNav.DismissViewController(true, null));
                rootNav.PresentViewController(new ThemedNavigationController(toViewController), true, null);
            }
//            else if (fromViewController is RepositoriesViewController)
//            {
//                fromViewController.NavigationController.PresentViewController(toViewController, true, null);
//            }
            else if (toViewController is MenuView)
            {
                var nav      = ((UINavigationController)UIApplication.SharedApplication.Delegate.Window.RootViewController);
                var slideout = new SlideoutNavigationController();
                slideout.MenuViewController = new MenuNavigationController(toViewController, slideout);
                UIView.Transition(nav.View, 0.1, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.TransitionCrossDissolve,
                                  () => nav.PushViewController(slideout, false), null);
            }
            else if (toViewController is NewAccountView && fromViewController is StartupView)
            {
                toViewDismissCommand.Subscribe(_ => toViewController.DismissViewController(true, null));
                fromViewController.PresentViewController(new ThemedNavigationController(toViewController), true, null);
            }
            else if (fromViewController is MenuView)
            {
                fromViewController.NavigationController.PushViewController(toViewController, true);
            }
            else if (toViewController is LanguagesView && fromViewController is RepositoriesTrendingView)
            {
                toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => toViewDismissCommand.ExecuteIfCan());
                var ctrlToPresent = new ThemedNavigationController(toViewController);
                ctrlToPresent.TransitioningDelegate = new SlideDownTransition();
                fromViewController.PresentViewController(ctrlToPresent, true, null);
            }
            else
            {
                toViewDismissCommand.Subscribe(_ => toViewController.NavigationController.PopToViewController(fromViewController, true));
                fromViewController.NavigationController.PushViewController(toViewController, true);
            }
        }
Esempio n. 9
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window             = new UIWindow(UIScreen.MainScreen.Bounds);
            Menu               = new SlideoutNavigationController();
            Menu.TopView       = new HomeViewController();
            Menu.MenuViewLeft  = new DummyControllerLeft();
            Menu.MenuViewRight = new DummyControllerRight();

            window.RootViewController = Menu;
            window.MakeKeyAndVisible();

            return(true);
        }
Esempio n. 10
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            Menu = new SlideoutNavigationController();
            Menu.MainViewController = new MainNavigationController(new RootViewController(), Menu);
            Menu.MenuViewController = new MenuNavigationController(new DummyControllerLeft(), Menu)
            {
                NavigationBarHidden = true
            };
            //Menu.MenuViewController = new MenuNavigationController(new MenuView(), Menu) { NavigationBarHidden = true };
            window.RootViewController = Menu;
            window.MakeKeyAndVisible();

            return(true);
        }
Esempio n. 11
0
 protected override void HandleNavigation(CodeHub.Core.ViewModels.IBaseViewModel viewModel, UIViewController view)
 {
     if (view is MenuViewController)
     {
         var appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
         var nav         = ((UINavigationController)appDelegate.Window.RootViewController);
         var slideout    = new SlideoutNavigationController();
         slideout.MenuViewController = new MenuNavigationController(view, slideout);
         UIView.Transition(nav.View, 0.3, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.TransitionCrossDissolve,
                           () => nav.PushViewController(slideout, false), null);
     }
     else
     {
         PresentViewController(new ThemedNavigationController(view), true, null);
         viewModel.RequestDismiss.Subscribe(_ => DismissViewController(true, null));
     }
 }
Esempio n. 12
0
        private void GoToMenu()
        {
            var vc = new MenuViewController();
            var slideoutController = new SlideoutNavigationController();

            slideoutController.MenuViewController = new MenuNavigationController(vc, slideoutController);

            var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;

            if (appDelegate != null)
            {
                appDelegate.Presenter.SlideoutNavigationController = slideoutController;
            }

            var openButton = new UIBarButtonItem {
                Image = Images.Buttons.ThreeLinesButton
            };
            var mainNavigationController = new MainNavigationController(GetInitialMenuViewController(), slideoutController, openButton);

            slideoutController.SetMainViewController(mainNavigationController, false);

            slideoutController.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve;
            PresentViewController(slideoutController, true, null);
        }
Esempio n. 13
0
        public Pubnub_MessagingSub(string channelName, string cipher, bool enableSSL, Pubnub pubnub)
            : base(UITableViewStyle.Grouped, null)
        {
            Channel     = channelName;
            Ssl         = enableSSL;
            Cipher      = cipher;
            this.pubnub = pubnub;

            string strSsl = "";

            if (Ssl)
            {
                strSsl = "SSL,";
            }

            string strCip = "";

            if (!String.IsNullOrWhiteSpace(Cipher))
            {
                strCip = "Cipher";
            }

            string head = String.Format("{0} {1}", strSsl, strCip);

            Section secAction = new Section();

            bool bIphone = true;

            int viewHeight = 70;

            secAction.HeaderView = CreateHeaderView(viewHeight);

            secOutput = new Section("Output");

            root = new RootElement(head)
            {
                secAction,
                secOutput
            };

            Root = root;
            dvc  = new DialogViewController(root, true);
            var tap = new UITapGestureRecognizer();

            tap.AddTarget(() => {
                dvc.View.EndEditing(true);
            });
            dvc.View.AddGestureRecognizer(tap);

            tap.CancelsTouchesInView = false;
            dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, delegate {
                InvokeInBackground(() => {
                    pubnub.EndPendingRequests();
                });
                AppDelegate.navigation.PopToRootViewController(true);
            });
            Menu         = new SlideoutNavigationController();
            Menu.TopView = dvc;

            Menu.MenuViewLeft = new LeftNavController(Menu, this);

            AppDelegate.navigation.PushViewController(Menu, true);
            Menu.ShowMenuLeft();
            newChannels.Text = Channel;
        }
Esempio n. 14
0
        private void DoTransition(IViewFor fromView, IViewFor toView)
        {
            var toViewController    = (UIViewController)toView;
            var toViewModel         = (IBaseViewModel)toView.ViewModel;
            var fromViewController  = (UIViewController)fromView;
            var routableToViewModel = toViewModel as IRoutingViewModel;
            IReactiveCommand <object> toViewDismissCommand = null;


            if (toViewController is AccountsView || toViewController is WebBrowserView || toViewController is GistCommentView ||
                toViewController is CommitCommentView || toViewController is GistCreateView || toViewController is FeedbackComposerView)
            {
                var appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
                var rootNav     = (UINavigationController)appDelegate.Window.RootViewController;
                toViewDismissCommand = ReactiveCommand.Create().WithSubscription(_ => rootNav.DismissViewController(true, null));
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Cancel, UIBarButtonItemStyle.Plain, (s, e) => toViewDismissCommand.ExecuteIfCan());
                var navController = new ThemedNavigationController(toViewController);
                rootNav.PresentViewController(navController, true, null);
            }
            else if (toViewController is MenuView)
            {
                var appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
                var nav         = ((UINavigationController)appDelegate.Window.RootViewController);
                var slideout    = new SlideoutNavigationController();
                slideout.MenuViewController = new MenuNavigationController(toViewController, slideout);
                UIView.Transition(nav.View, 0.1, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.TransitionCrossDissolve,
                                  () => nav.PushViewController(slideout, false), null);
            }
            else if (toViewController is NewAccountView && fromViewController is StartupView)
            {
                toViewDismissCommand = ReactiveCommand.Create().WithSubscription(_ => toViewController.DismissViewController(true, null));
                fromViewController.PresentViewController(new ThemedNavigationController(toViewController), true, null);
            }
            else if (fromViewController is MenuView)
            {
                fromViewController.NavigationController.PushViewController(toViewController, true);
            }
            else if (toViewController is LanguagesView && fromViewController is RepositoriesTrendingView)
            {
                toViewDismissCommand = ReactiveCommand.Create().WithSubscription(_ => fromViewController.DismissViewController(true, null));
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => toViewDismissCommand.ExecuteIfCan());
                var ctrlToPresent = new ThemedNavigationController(toViewController);
                ctrlToPresent.TransitioningDelegate = new SlideDownTransition();
                fromViewController.PresentViewController(ctrlToPresent, true, null);
            }
            else if (toViewController is EditFileView || toViewController is CreateFileView)
            {
                toViewDismissCommand = ReactiveCommand.Create().WithSubscription(_ => fromViewController.DismissViewController(true, null));
                toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Cancel, UIBarButtonItemStyle.Plain, (s, e) => toViewDismissCommand.ExecuteIfCan());
                fromViewController.PresentViewController(new ThemedNavigationController(toViewController), true, null);
            }
            else
            {
                toViewDismissCommand = ReactiveCommand.Create().WithSubscription(_ => toViewController.NavigationController.PopToViewController(fromViewController, true));
                fromViewController.NavigationController.PushViewController(toViewController, true);
            }

            if (toViewDismissCommand != null)
            {
                routableToViewModel.RequestDismiss.Subscribe(_ =>
                {
                    this.Log().Info("{0} is requesting dismissal", routableToViewModel.GetType().Name);
                    toViewDismissCommand.ExecuteIfCan();
                });
            }

            toViewModel.RequestNavigation.Subscribe(x =>
            {
                var viewType   = _viewModelViewService.GetViewFor(x.GetType());
                var view       = (IViewFor)_serviceConstructor.Construct(viewType);
                view.ViewModel = x;
                Transition(toView, view);
            });
        }
Esempio n. 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MonoTouch.SlideoutNavigation.MenuNavigationController"/> class.
 /// </summary>
 /// <param name="rootViewController">Root view controller.</param>
 /// <param name="slideoutNavigationController">Slideout navigation controller.</param>
 public MenuNavigationController(UIViewController rootViewController, SlideoutNavigationController slideoutNavigationController)
     : base(rootViewController)
 {
     _slideoutNavigationController = slideoutNavigationController;
 }
        public override void Show(MvxViewModelRequest request)
        {
            var viewCreator = Mvx.Resolve <IMvxTouchViewCreator>();
            var view        = viewCreator.CreateView(request);
            var uiView      = view as UIViewController;

            if (uiView == null)
            {
                throw new InvalidOperationException("Asking to show a view which is not a UIViewController!");
            }

            if (uiView is IMvxModalTouchView)
            {
                _currentModal = (IMvxModalTouchView)uiView;
                var modalNavigationController = new UINavigationController(uiView);
                modalNavigationController.NavigationBar.Translucent = false;
                modalNavigationController.Toolbar.Translucent       = false;
                uiView.NavigationItem.LeftBarButtonItem             = new UIBarButtonItem(Theme.CurrentTheme.CancelButton, UIBarButtonItemStyle.Plain, (s, e) =>
                {
                    var vm = ((IMvxModalTouchView)uiView).ViewModel;
                    Mvx.Resolve <Cirrious.MvvmCross.Plugins.Messenger.IMvxMessenger>().Publish(new CodeFramework.Core.Messages.CancelationMessage(vm));
                    modalNavigationController.DismissViewController(true, null);
                    _currentModal = null;
                });
                PresentModalViewController(modalNavigationController, true);
            }
            else if (uiView is StartupView)
            {
                _window.RootViewController = uiView;
            }
            else if (uiView is AccountsView)
            {
                _slideoutController          = null;
                _generalNavigationController = new UINavigationController(uiView);
                _generalNavigationController.NavigationBar.Translucent = false;
                _generalNavigationController.Toolbar.Translucent       = false;
                Transition(_generalNavigationController);
            }
            else if (uiView is MenuBaseViewController)
            {
                _slideoutController = new SimpleSlideoutNavigationController();
                _slideoutController.MenuViewController = new MenuNavigationController(uiView, _slideoutController);
                uiView.NavigationController.NavigationBar.Translucent  = false;
                uiView.NavigationController.Toolbar.Translucent        = false;
                uiView.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(50, 50, 50);
                Transition(_slideoutController);
            }
            else
            {
                if (request.PresentationValues != null && request.PresentationValues.ContainsKey(PresentationValues.SlideoutRootPresentation))
                {
                    var mainNavigationController = new MainNavigationController(uiView, _slideoutController, new UIBarButtonItem(Theme.CurrentTheme.ThreeLinesButton, UIBarButtonItemStyle.Plain, (s, e) => _slideoutController.Open(true)));
                    _generalNavigationController = mainNavigationController;
                    _slideoutController.SetMainViewController(mainNavigationController, true);


                    //_generalNavigationController.NavigationBar.BarTintColor = Theme.CurrentTheme.ApplicationNavigationBarTint;
                    _generalNavigationController.NavigationBar.Translucent = false;
                    _generalNavigationController.Toolbar.Translucent       = false;
                }
                else
                {
                    _generalNavigationController.PushViewController(uiView, true);
                }
            }
        }
Esempio n. 17
0
 public LeftNavController(SlideoutNavigationController menu, Pubnub_MessagingSub pubnub_MessagingSub)
     : base(UITableViewStyle.Plain, new RootElement(""))
 {
     this.pubnub_MessagingSub = pubnub_MessagingSub;
     this.menu = menu;
 }