void Initialize(bool bInit) { if (_view != null) { // look for coordinate system types Type[] subtypes = Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(G2DCoordinateSystem)); ListNodeList list = new ListNodeList(); foreach(Type t in subtypes) list.Add(new ListNode(Current.Gui.GetUserFriendlyClassName(t), t)); // look for a controller-control _view.TypeLabel="Type"; _view.InitializeTypeNames(list, list.IndexOfObject(_tempdoc.GetType())); // To avoid looping when a dedicated controller is unavailable, we first instantiate the controller alone and compare the types _instanceController = (IMVCAController)Current.Gui.GetController(new object[] { _tempdoc }, typeof(IMVCAController)); if (_instanceController != null && (_instanceController.GetType() != this.GetType())) { Current.Gui.FindAndAttachControlTo(_instanceController); if (_instanceController.ViewObject != null) _view.SetInstanceControl(_instanceController.ViewObject); } else { _instanceController = null; _view.SetInstanceControl(null); } } }
void Initialize(bool bInit) { if (_view != null) { // look for coordinate system types Type[] subtypes = Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(G2DCoordinateSystem)); ListNodeList list = new ListNodeList(); foreach (Type t in subtypes) { list.Add(new ListNode(Current.Gui.GetUserFriendlyClassName(t), t)); } // look for a controller-control _view.TypeLabel = "Type"; _view.InitializeTypeNames(list, list.IndexOfObject(_tempdoc.GetType())); // To avoid looping when a dedicated controller is unavailable, we first instantiate the controller alone and compare the types _instanceController = (IMVCAController)Current.Gui.GetController(new object[] { _tempdoc }, typeof(IMVCAController)); if (_instanceController != null && (_instanceController.GetType() != this.GetType())) { Current.Gui.FindAndAttachControlTo(_instanceController); if (_instanceController.ViewObject != null) { _view.SetInstanceControl(_instanceController.ViewObject); } } else { _instanceController = null; _view.SetInstanceControl(null); } } }