public void Render(MXTouchViewGroup viewGroup)
        {
            if (_viewGroup != null)
            {
                // already rendered
                return;
            }

            _viewGroup = viewGroup;

            System.Console.WriteLine("MXTouchViewGroupTabController: Render");

            this.Delegate = new TabBarControllerDelegate(this);

            var tabControllers = new UIViewController[viewGroup.Items.Count];

            int index = 0;

            foreach (var tabItem in viewGroup.Items)
            {
                var navCtrl = new UINavigationController();

                navCtrl.NavigationBar.TintColor = UIColor.Red;

                //navCtrl.NavigationBar.TintColor = UIColor.Black; ?? get from where??
                navCtrl.TabBarItem    = new UITabBarItem(tabItem.Title, UIImage.FromFile(tabItem.Icon), index);
                tabControllers[index] = navCtrl;
                index++;
            }

            SetViewControllers(tabControllers, true);
        }
        public void PushToViewGroup(MXTouchViewGroup viewGroup, MXTouchViewGroupItem viewGroupItem, UIViewController viewController)
        {
            // let the group render itself if it needs to
            viewGroup.ViewController.Render(viewGroup);
            UIViewController viewGroupViewController = viewGroup.ViewController as UIViewController;

            // put the item in the proper view group
            int groupIndex = viewGroup.Items.FindIndex(vgi => vgi == viewGroupItem);

            viewGroup.ViewController.RenderItem(groupIndex, viewController);

            // only support the master for now
            if (_splitViewController == null && _masterNavigationController == null)
            {
                // first time through!
                Init(viewGroupViewController);
            }
            else
            {
                _masterNavigationController.DisplayViewController(viewGroupViewController, true);
            }
        }
Пример #3
0
        public void Render(MXTouchViewGroup viewGroup)
        {
            if (_viewGroup != null)
                // already rendered
                return;

            _viewGroup = viewGroup;

            System.Console.WriteLine("MXTouchViewGroupTabController: Render");

            this.Delegate = new TabBarControllerDelegate(this);

            var tabControllers = new UIViewController[viewGroup.Items.Count];

            int index = 0;
            foreach (var tabItem in viewGroup.Items) {
                var navCtrl = new UINavigationController();

                //navCtrl.NavigationBar.TintColor = UIColor.Red;

                //navCtrl.NavigationBar.TintColor = UIColor.Black; ?? get from where??
                navCtrl.TabBarItem = new UITabBarItem (tabItem.Title, UIImage.FromFile(tabItem.Icon), index);
                tabControllers[index] = navCtrl;
                index++;
            }

            SetViewControllers(tabControllers, true);
        }
Пример #4
0
        public void PushToViewGroup(MXTouchViewGroup viewGroup, MXTouchViewGroupItem viewGroupItem, UIViewController viewController)
        {
            // let the group render itself if it needs to
            viewGroup.ViewController.Render(viewGroup);
            UIViewController viewGroupViewController = viewGroup.ViewController as UIViewController;

            // put the item in the proper view group
            int groupIndex = viewGroup.Items.FindIndex( vgi => vgi == viewGroupItem );

            viewGroup.ViewController.RenderItem(groupIndex, viewController);

            // only support the master for now
            if (_splitViewController == null && _masterNavigationController == null)
            {
                // first time through!
                Init(viewGroupViewController);
            }
            else
            {
                _masterNavigationController.DisplayViewController(viewGroupViewController, true);
            }
        }
Пример #5
0
        /*
         * public static IMXController NavigateFromButton(string url, Dictionary<string, string> parameters, UIBarButtonItem button)
         * {
         *      //_stashButton = button;
         *
         *      return Navigate(url, parameters);
         * }
         */

        void LoadViewForController(IMXView fromView, IMXController controller, MXViewPerspective viewPerspective)
        {
            HideLoading();

            if (controller.View == null)
            {
                // get the view, create it if it has yet been created
                controller.View = Views.GetOrCreateView(viewPerspective);
                if (controller.View == null)
                {
                    Console.WriteLine("View not found for perspective!" + viewPerspective.ToString());
                    throw new ArgumentException("View creation failed for perspective!" + viewPerspective.ToString());
                }
            }

            // asign the view it's model and render the contents of the view
            controller.View.SetModel(controller.GetModel());
            controller.View.Render();

            // pull the type from the view
            ViewNavigationContext navigationContext = MXTouchNavigation.GetViewNavigationContext(controller.View);
            UIViewController      viewController    = controller.View as UIViewController;

            if (navigationContext == ViewNavigationContext.Modal)
            {
                // treat as a modal/popup view
                _touchNavigation.PushToModel(viewController);
            }
            else if (navigationContext == ViewNavigationContext.InContext)
            {
                // it's just an in-context view, just slap it on top of the view that navigated it here!
                UIViewController parentViewController = fromView as UIViewController;
                parentViewController.NavigationController.PushViewController(viewController, true);
            }
            else
            {
                // if the view is one of the views in the group
                MXTouchViewGroup     viewGroup     = null;
                MXTouchViewGroupItem viewGroupItem = null;

                foreach (MXTouchViewGroup vg in ViewGroups)
                {
                    viewGroupItem = vg.Items.Find(item => item.ViewType == controller.View.GetType());
                    if (viewGroupItem != null)
                    {
                        viewGroup = vg;
                        break;
                    }
                }

                if (viewGroup != null)
                {
                    // activate the group!
                    _touchNavigation.PushToViewGroup(viewGroup, viewGroupItem, controller.View as UIViewController);
                }
                else
                {
                    switch (navigationContext)
                    {
                    case ViewNavigationContext.Detail:
                        _touchNavigation.PushToDetail(viewController);
                        break;

                    case ViewNavigationContext.Master:
                        _touchNavigation.PushToMaster(viewController);
                        break;
                    }
                }
            }

            // handle initial view display if not already handled
            ShowView();
        }