/// <summary> /// Clear all the configurations. /// This is done when a new project is selected. /// </summary> private void ClearConfig() { _SelectedAveragingVM = null; foreach (var vm in _averagingVMDict.Values) { vm.Dispose(); } _averagingVMDict.Clear(); this.NotifyOfPropertyChange(() => this.AveragingVMList); }
/// <summary> /// Remove the display based off the SubsystemDataConfig /// given in the event. /// </summary> /// <param name="closeVmEvent">Contains the SubsystemDataConfig to remove the display.</param> public void Handle(CloseVmEvent closeVmEvent) { // Check if the display exist if (_averagingVMDict.ContainsKey(closeVmEvent.SubsysDataConfig)) { // Dispose the display then remove the display _averagingVMDict[closeVmEvent.SubsysDataConfig].Dispose(); AveragingViewModel vm = null; if (_averagingVMDict.TryRemove(closeVmEvent.SubsysDataConfig, out vm)) { this.NotifyOfPropertyChange(() => this.AveragingVMList); // Select a tab is nothing is selected if (_SelectedAveragingVM == null) { if (AveragingVMList.Count > 0) { SelectedAveragingVM = AveragingVMList[0]; } } } } }