protected void StartViewForController(IMXView fromView, IMXController controller, MXShowViewRequest showViewRequest)
        {
            var viewPerspective = showViewRequest.ViewPerspective;
            Type viewType = PhoneContainerInstance.Views.GetViewType(viewPerspective);
            if (viewType == null)
            {
                throw new TypeLoadException("View not found for " + viewPerspective.ToString());
            }

#warning TODO - make this Uri look up better!
            Uri viewUri = new Uri("/" + viewType.Name + ".xaml", UriKind.Relative);
            
            // get the uri from the MXPhoneView attribute, if present
            object[] attributes = viewType.GetCustomAttributes(true);
            for (int i = 0; i < attributes.Length; i++)
            {
                if (attributes[i] is MXPhoneViewAttribute)
                {
                    viewUri = new Uri(((MXPhoneViewAttribute)attributes[i]).Uri, UriKind.Relative);
                    break;
                }
            }           
            
            // stash the model away so we can get it back when the view shows up!
            _cachedViewModel = showViewRequest.ViewModel;

#warning TODO - make this navigation better - pwn the history stack
            //var page = fromView as PhoneApplicationPage;
            //((MXPhonePage)fromView).NavigationService.n

            _rootFrame.Source = viewUri;

            //_rootFrame.Navigate(viewUri);
        }
Exemplo n.º 2
0
        public void Perform(IMXContainer container, IMXView fromView, IMXController controller)
        {
            // nothing to do
            var viewPerspective = new MXViewPerspective <T>(_viewPerspective);
            var request         = new MXShowViewRequest <T>(viewPerspective, _viewModel);

            container.ShowPerspective(fromView, controller, request);
        }
        public void OnControllerLoadComplete(IMXController controller, MXShowViewRequest showViewRequest)
        {
            if (_lastSeenViewModel != null)
            {
                // TODO - this requestStop is possibly called too late... but not sure we have any 
                _lastSeenViewModel.RequestStop();
                _lastSeenViewModel = null;
            }

            var model = showViewRequest.ViewModel;
            _lastSeenViewModel = model as IMXViewModel;
            if (_lastSeenViewModel != null)
            {
                _lastSeenViewModel.ViewDispatcher = _dispatcherFactory();
            }
        }
        public void OnControllerLoadComplete(IMXController controller, MXShowViewRequest showViewRequest)
        {
            if (_lastSeenViewModel != null)
            {
                // TODO - this requestStop is possibly called too late... but not sure we have any
                _lastSeenViewModel.RequestStop();
                _lastSeenViewModel = null;
            }

            var model = showViewRequest.ViewModel;

            _lastSeenViewModel = model as IMXViewModel;
            if (_lastSeenViewModel != null)
            {
                _lastSeenViewModel.ViewDispatcher = _dispatcherFactory();
            }
        }
 protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller,
                                                  MXShowViewRequest showViewRequest)
 {
     _viewModelLifeCycleHelper.OnControllerLoadComplete(controller, showViewRequest);
     base.OnControllerLoadComplete(fromView, controller, showViewRequest);
 }
        protected void StartViewForController(IMXView fromView, IMXController controller, MXShowViewRequest showViewRequest)
        {
            var  viewPerspective = showViewRequest.ViewPerspective;
            Type viewType        = PhoneContainerInstance.Views.GetViewType(viewPerspective);

            if (viewType == null)
            {
                throw new TypeLoadException("View not found for " + viewPerspective.ToString());
            }

#warning TODO - make this Uri look up better!
            Uri viewUri = new Uri("/" + viewType.Name + ".xaml", UriKind.Relative);

            // get the uri from the MXPhoneView attribute, if present
            object[] attributes = viewType.GetCustomAttributes(true);
            for (int i = 0; i < attributes.Length; i++)
            {
                if (attributes[i] is MXPhoneViewAttribute)
                {
                    viewUri = new Uri(((MXPhoneViewAttribute)attributes[i]).Uri, UriKind.Relative);
                    break;
                }
            }

            // stash the model away so we can get it back when the view shows up!
            _cachedViewModel = showViewRequest.ViewModel;

#warning TODO - make this navigation better - pwn the history stack
            //var page = fromView as PhoneApplicationPage;
            //((MXPhonePage)fromView).NavigationService.n

            _rootFrame.Source = viewUri;

            //_rootFrame.Navigate(viewUri);
        }
 protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXShowViewRequest showViewRequest)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() => { StartViewForController(fromView, controller, showViewRequest); });
 }
 protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXShowViewRequest showViewRequest)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() => { StartViewForController(fromView, controller, showViewRequest); });
 }
 protected override void OnControllerLoadComplete(IMXView fromView, IMXController controller,
                                                  MXShowViewRequest showViewRequest)
 {
     _viewModelLifeCycleHelper.OnControllerLoadComplete(controller, showViewRequest);
     base.OnControllerLoadComplete(fromView, controller, showViewRequest);
 }