Example #1
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 (_diagVMDict.ContainsKey(closeVmEvent.SubsysDataConfig))
            {
                // Dispose the display then remove the display
                _diagVMDict[closeVmEvent.SubsysDataConfig].Dispose();
                DiagnosticsViewModel vm = null;
                if (_diagVMDict.TryRemove(closeVmEvent.SubsysDataConfig, out vm))
                {
                    this.NotifyOfPropertyChange(() => this.DiagVMList);

                    // Select a tab is nothing is selected
                    if (_SelectedDiagVM == null)
                    {
                        if (DiagVMList.Count > 0)
                        {
                            SelectedDiagVM = DiagVMList[0];
                        }
                    }
                }
            }
        }