コード例 #1
0
        /// <summary>
        /// Clear all the configurations.
        /// This is done when a new project is selected.
        /// </summary>
        private void ClearConfig()
        {
            _SelectedDvlVM = null;

            foreach (var vm in _dvlVMDict.Values)
            {
                vm.Dispose();
            }

            _dvlVMDict.Clear();
            this.NotifyOfPropertyChange(() => this.DvlVMList);
        }
コード例 #2
0
        /// <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 (!_dvlVMDict.ContainsKey(config))
            {
                if (_dvlVMDict.TryAdd(config, new ViewDataDvlViewModel(config)))
                {
                    this.NotifyOfPropertyChange(() => this.DvlVMList);

                    // Select a tab is nothing is selected
                    if (_SelectedDvlVM == null)
                    {
                        if (DvlVMList.Count > 0)
                        {
                            SelectedDvlVM = DvlVMList[0];
                        }
                    }
                }
            }
        }
コード例 #3
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 (_dvlVMDict.ContainsKey(closeVmEvent.SubsysDataConfig))
            {
                // Dispose the display then remove the display
                _dvlVMDict[closeVmEvent.SubsysDataConfig].Dispose();
                ViewDataDvlViewModel vm = null;
                if (_dvlVMDict.TryRemove(closeVmEvent.SubsysDataConfig, out vm))
                {
                    this.NotifyOfPropertyChange(() => this.DvlVMList);

                    // Select a tab is nothing is selected
                    if (_SelectedDvlVM == null)
                    {
                        if (DvlVMList.Count > 0)
                        {
                            SelectedDvlVM = DvlVMList[0];
                        }
                    }
                }
            }
        }