public ToolbarPositionSettings(IEventAggregator eventAggregator, IToolbarService toolbarService) { eventAggregator.GetEvent <WindowClosingEvent>().Subscribe(SaveToolbarPositions); _toolTray = toolbarService as AbstractToolbar; _loadDict = new Dictionary <string, ToolbarSettingItem>(); if (this.Toolbars != null && this.Toolbars.Count > 0) { foreach (var setting in this.Toolbars) { _loadDict[setting.Header] = setting; } for (int i = 0; i < _toolTray.Children.Count; i++) { AbstractToolbar tb = _toolTray.Children[i] as AbstractToolbar; if (_loadDict.ContainsKey(tb.Header)) { ToolbarSettingItem item = _loadDict[tb.Header]; tb.Band = item.Band; tb.BandIndex = item.BandIndex; tb.IsChecked = item.IsChecked; tb.Refresh(); } } } }
public override bool Equals(object obj) { ToolbarSettingItem item = obj as ToolbarSettingItem; return((item != null) && Header.Equals(item.Header)); }