/// <summary> /// Clear all the configurations. /// This is done when a new project is selected. /// </summary> private void ClearConfig() { _SelecteProfile3dVM = null; foreach (var vm in _profile3DVMDict.Values) { vm.Dispose(); } _profile3DVMDict.Clear(); this.NotifyOfPropertyChange(() => this.Profile3DVMList); }
/// <summary> /// Add a configuration. This will create the ViewModel based /// off the configuration given. /// </summary> /// <param name="config">Configuration to use to create the ViewModel.</param> private void AddConfig(SubsystemDataConfig config) { if (!_profile3DVMDict.ContainsKey(config)) { if (_profile3DVMDict.TryAdd(config, new ViewDataProfile3DViewModel(config))) { this.NotifyOfPropertyChange(() => this.Profile3DVMList); // Select a tab is nothing is selected if (_SelecteProfile3dVM == null) { if (Profile3DVMList.Count > 0) { SelecteProfile3DVM = Profile3DVMList[0]; } } } } }
/// <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 (_profile3DVMDict.ContainsKey(closeVmEvent.SubsysDataConfig)) { // Dispose the display then remove the display _profile3DVMDict[closeVmEvent.SubsysDataConfig].Dispose(); ViewDataProfile3DViewModel vm = null; if (_profile3DVMDict.TryRemove(closeVmEvent.SubsysDataConfig, out vm)) { this.NotifyOfPropertyChange(() => this.Profile3DVMList); // Select a tab is nothing is selected if (_SelecteProfile3dVM == null) { if (Profile3DVMList.Count > 0) { SelecteProfile3DVM = Profile3DVMList[0]; } } } } }