void LoadController(IMXView fromView, IMXController controller, Dictionary <string, string> parameters) { string perspective = controller.Load(parameters); if (!Instance.CancelLoad && perspective != null) // done if failed { MXViewPerspective viewPerspective = new MXViewPerspective(controller.ModelType, perspective); // quick check (viable for ALL platforms) to see if there is some kind of a mapping set up if (!Instance.Views.ContainsKey(viewPerspective)) { throw new Exception("There is no View mapped for " + viewPerspective.ToString()); } // 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(viewPerspective); if (controller.View != null) { controller.View.SetModel(controller.GetModel()); } // 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, viewPerspective); } // clear CancelLoad, we're done Instance.CancelLoad = false; }
private void LoadController(IMXView fromView, IMXController controller, string uri, Dictionary <string, string> parameters) { string perspective = controller.Load(uri, parameters); // give the derived container the ability to do something // with the fromView if it exists or to create it if it doesn't OnControllerLoadComplete(fromView, controller, CancelLoad ? null : perspective, uri); // clear CancelLoad, we're done CancelLoad = false; }
/* * void LoadController(IMXView fromView, IMXController controller, Dictionary<string, string> parameters) * { * string perspective = controller.Load(parameters); * * // HACKHACK - the CancelLoad hack from MonoCross team is just horrid so I've added a magic string to it :/ * if (perspective != "Ignore" && !Instance.CancelLoad) // done if failed * { * MXViewPerspective viewPerspective = new MXViewPerspective(controller.ModelType, perspective); * // quick check (viable for ALL platforms) to see if there is some kind of a mapping set up * if (!Instance.Views.ContainsKey(viewPerspective)) * throw new Exception("There is no View mapped for " + viewPerspective.ToString()); * * // 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(viewPerspective); * if (controller.View != null) * controller.View.SetModel(controller.GetModel()); * * // 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, viewPerspective); * } * // clear CancelLoad, we're done * Instance.CancelLoad = false; * } */ void LoadController(IMXView fromView, IMXController controller, Dictionary <string, string> parameters) { var action = controller.Load(parameters); action.Perform(this, fromView, controller); }