Exemplo n.º 1
0
        public virtual void Selected(DialogViewController controller, UITableView tableView, object item, NSIndexPath indexPath)
        {
            if (DataContext.Value == null)
            {
                DataContext.Value = Activator.CreateInstance(DataContext.Member.GetMemberType());
            }

//			if (typeof(Enum).IsAssignableFrom(DataContext.Type))
//			{
//				var parser = new ViewParser();
//
//				var source = parser.ParseList(null, DataContext.Source, DataContext.Member, null);
//			}

            if (DataContext.Value != null)
            {
                var view = DataContext.Value;
                if (NavigateToViewType != null && !view.GetType().Equals(NavigateToViewType))
                {
                    view = ViewCreator.Create(NavigateToViewType, DataContext.Value);
                }

                var dvc = new DialogViewController(Caption, view, controller.Theme, true)
                {
                    Autorotate = true
                };
                var nav = controller.ParentViewController as UINavigationController;

                if (IsModal)
                {
                    dvc.ModalTransitionStyle = TransitionStyle;

                    var navController = new NavigationController()
                    {
                        ViewControllers = new UIViewController[] { dvc }
                    };

                    nav.PresentModalViewController(navController, true);
                }
                else
                {
                    nav.PushViewController(dvc, true);
                }
            }
        }
        public virtual void Selected(DialogViewController controller, UITableView tableView, object item, NSIndexPath indexPath)
        {
            if (NavigateToViewType == null)
            {
                return;
            }

            var dataContext = DataContext.Value;

            if (dataContext == null)
            {
                dataContext = Activator.CreateInstance(DataContext.Member.GetMemberType());
            }

            if (dataContext != null)
            {
                var view = dataContext;
                if (!view.GetType().Equals(NavigateToViewType))
                {
                    view = ViewCreator.Create(NavigateToViewType, dataContext);
                }

                var dvc = new DialogViewController(Caption, view, controller.Theme, true)
                {
                    Autorotate = true
                };
                var nav = controller.ParentViewController as UINavigationController;

                if (IsModal)
                {
                    dvc.ModalTransitionStyle = TransitionStyle;

                    var navController = new NavigationController()
                    {
                        ViewControllers = new UIViewController[] { dvc }
                    };

                    nav.PresentModalViewController(navController, true);
                }
                else
                {
                    nav.PushViewController(dvc, true);
                }
            }
        }