protected override void Initialize(bool initData) { base.Initialize(initData); if (initData) { // predefined styles string[] names = G2DPlotStyleCollectionTemplates.GetAvailableNames(); _predefinedStyleSetsAvailable = new SelectableListNodeList(); for (int i = 0; i < names.Length; ++i) { _predefinedStyleSetsAvailable.Add(new SelectableListNode(names[i], i, false)); } // single styles _singleStylesAvailable = new SelectableListNodeList(); Type[] avtypes = ReflectionService.GetNonAbstractSubclassesOf(typeof(IG2DPlotStyle)); for (int i = 0; i < avtypes.Length; i++) { if (avtypes[i] != typeof(G2DPlotStyleCollection)) { _singleStylesAvailable.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(avtypes[i]), avtypes[i], false)); } } BuildCurrentStyleListNodeList(); } if (null != _view) { _view.InitializePredefinedStyles(_predefinedStyleSetsAvailable); _view.InitializeAvailableStyleList(_singleStylesAvailable); _view.InitializeStyleList(_currentItems); } }
public void InitializePredefinedStyles() { string[] names = G2DPlotStyleCollectionTemplates.GetAvailableNamesPlusCustom(); int idx = G2DPlotStyleCollectionTemplates.GetIndexOfAvailableNamesPlusCustom(_doc); if (_view != null) { _view.InitializePredefinedStyles(names, idx); } }
public void EhView_PredefinedStyleSelected(int selectedindex) { if (selectedindex == 0) { return; } G2DPlotStyleCollection template = G2DPlotStyleCollectionTemplates.GetTemplate(selectedindex - 1); _tempdoc.Clear(); for (int i = 0; i < template.Count; i++) { _tempdoc.Add(template[i]); } UpdateStyleList(new int[0]); OnCollectionChangeCommit(); }
public void EhView_PredefinedStyleSelected() { var sel = _predefinedStyleSetsAvailable.FirstSelectedNode; if (null == sel) { return; } G2DPlotStyleCollection template = G2DPlotStyleCollectionTemplates.GetTemplate((int)sel.Tag, _doc.GetPropertyContext()); _currentItems.Clear(() => _doc.Clear()); for (int i = 0; i < template.Count; i++) { var listNode = new SelectableListNode(Current.Gui.GetUserFriendlyClassName(template[i].GetType()), template[i], false); _currentItems.Add <IG2DPlotStyle>(listNode, (docNode) => _doc.Add(docNode)); } OnCollectionChangeCommit(); }