/* * public MXViewPerspective GetViewPerspectiveForViewType(Type viewType) * { * return _typeMap.First(keyValuePair => keyValuePair.Value == viewType).Key; * } */ internal void RenderView <TViewModel>(MXShowViewRequest <TViewModel> showViewRequest) { IMXView view = CreateView(showViewRequest.ViewPerspective); if (view == null) { // No view perspective found for model throw new ArgumentException("No View Perspective found for: " + showViewRequest.ViewPerspective.ToString(), "viewPerspective"); } view.SetModel(showViewRequest.ViewModel); view.Render(); }
public virtual void ShowPerspective(IMXView fromView, IMXController controller, MXShowViewRequest showViewRequest) { // quick check (viable for ALL platforms) to see if there is some kind of a mapping set up if (!Instance.Views.ContainsKey(showViewRequest.ViewPerspective)) { throw new MonoCrossException("There is no View mapped for " + showViewRequest.ViewPerspective.ToString()); } #warning Stuart has removed "more of a courtesy to the derived container that anything" /* * // if we have a view lying around assign it from the map, more of a curtesy to the derived container that anything * controller.View = Instance.Views.GetView(viewModelAndPerspective); * if (controller.View != null) * controller.View.SetModel(viewModelAndPerspective.ViewModel); */ // give the derived container the ability to do something // with the fromView if it exists or to create it if it doesn't Instance.OnControllerLoadComplete(fromView, controller, showViewRequest); }
/// <summary> /// Raises the load complete event after the Controller has completed loading its Model, the View may be populated /// and the derived classs should check if it exists and do something with it if needed for the platform, either free it, /// pop off the views in a stack above it or whatever makes sense to the platform /// </summary> /// <param name='controller'> /// Controller. /// </param> /// <param name='viewPerspective'> /// View perspective. /// </param> protected abstract void OnControllerLoadComplete(IMXView fromView, IMXController controller, MXShowViewRequest showViewRequest);