protected override void Initialize(bool initData) { base.Initialize(initData); if (initData) { if (null == _groupStyles && null != _doc.ParentCollection) { _groupStyles = _doc.ParentCollection.GroupStyles; } var plotGroupController = new PlotGroupCollectionController(); plotGroupController.InitializeDocument(_groupStyles); plotGroupController.GroupStyleChanged += new WeakActionHandler(EhPlotGroupChanged, (handler) => plotGroupController.GroupStyleChanged -= handler); _plotGroupController = plotGroupController; // find the style collection controller _styleCollectionController = (IXYPlotStyleCollectionController)Current.Gui.GetControllerAndControl(new object[] { _doc.Style }, typeof(IXYPlotStyleCollectionController), UseDocument.Directly); _styleCollectionController.CollectionChangeCommit += new EventHandler(_styleCollectionController_CollectionChangeCommit); _styleCollectionController.StyleEditRequested += new Action <int>(_styleCollectionController_StyleEditRequested); // Initialize the data controller _dataController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.DataObject, _doc }, typeof(IMVCANController), UseDocument.Directly); // Initialize the style controller list InitializeStyleControllerList(); } if (null != _view) { if (null == _plotGroupController.ViewObject) { Current.Gui.FindAndAttachControlTo(_plotGroupController); } _view.SetPlotGroupCollectionView(_plotGroupController.ViewObject); // add the style controller _view.SetPlotStyleView(_styleCollectionController.ViewObject); View_SetAllTabViews(); } }
void InitializeCollectionAndData() { _dataController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _tempdoc.DataObject, _tempdoc }, typeof(IMVCAController)); if (_dataController != null) { AddTab("Data", _dataController, _dataController.ViewObject); } InitializePlotGroupView(); if (_plotGroupController != null) { AddTab("Grouping", _plotGroupController, _plotGroupController.ViewObject); } _styleCollectionController = (IXYPlotStyleCollectionController)Current.Gui.GetControllerAndControl(new object[] { _tempdoc.Style }, typeof(IXYPlotStyleCollectionController)); AddTab("Styles", _styleCollectionController, _styleCollectionController.ViewObject); _styleCollectionController.CollectionChangeCommit += new EventHandler(_styleCollectionController_CollectionChangeCommit); }
public override IEnumerable <ControllerAndSetNullMethod> GetSubControllers() { yield return(new ControllerAndSetNullMethod(_plotGroupController, () => _plotGroupController = null)); yield return(new ControllerAndSetNullMethod(_dataController, () => _dataController = null)); yield return(new ControllerAndSetNullMethod(_styleCollectionController, () => { if (null != _styleCollectionController) { _styleCollectionController.CollectionChangeCommit -= _styleCollectionController_CollectionChangeCommit; _styleCollectionController.StyleEditRequested -= _styleCollectionController_StyleEditRequested; _styleCollectionController = null; } })); if (null != _styleControllerList) { foreach (var ctrl in _styleControllerList) { yield return(new ControllerAndSetNullMethod(ctrl, null)); } yield return(new ControllerAndSetNullMethod(null, () => _styleControllerList = null)); } if (null != _styleControllerDictionary) { foreach (var ctrl in _styleControllerDictionary.Values) { yield return(new ControllerAndSetNullMethod(ctrl, null)); } yield return(new ControllerAndSetNullMethod(null, () => _styleControllerDictionary = null)); } }
void InitializeCollectionAndData() { _dataController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _tempdoc.DataObject, _tempdoc }, typeof(IMVCAController)); if (_dataController != null) AddTab("Data", _dataController, _dataController.ViewObject); InitializePlotGroupView(); if (_plotGroupController != null) { AddTab("Grouping", _plotGroupController, _plotGroupController.ViewObject); } _styleCollectionController = (IXYPlotStyleCollectionController)Current.Gui.GetControllerAndControl(new object[] { _tempdoc.Style }, typeof(IXYPlotStyleCollectionController)); AddTab("Styles", _styleCollectionController, _styleCollectionController.ViewObject); _styleCollectionController.CollectionChangeCommit += new EventHandler(_styleCollectionController_CollectionChangeCommit); }