예제 #1
0
        public override void ShowNativeView(string viewName)
        {
            if (viewName.ToLower().IndexOf("storyboard") != -1)
            {
                RootViewModel.Dispatcher.Invoke(() =>
                {
                    var sb         = UIStoryboard.FromName(viewName, null);
                    var controller = sb.InstantiateInitialViewController() as UIViewController;
                    RootView.PresentViewController(controller, false, null);
                });
                return;
            }


            //must be in the main assembly
            var a = Assembly.GetEntryAssembly();

            var t = a.GetType(viewName);

            //is it regsitered?

            if (!Container.IsRegistered(t))
            {
                throw new Exception("Could not find native view: " + t.FullName);
            }

            RootViewModel.Dispatcher.Invoke(() =>
            {
                var controller = Container.Resolve(t) as UIViewController;

                if (controller == null)
                {
                    throw new Exception("Could not resolve navtive view as UIViewController: " + t.FullName);
                }

                RootView.PresentViewController(controller, false, null);
            });
        }