Ejemplo n.º 1
0
        /// <summary>
        /// Clear all the configurations.
        /// This is done when a new project is selected.
        /// </summary>
        private void ClearConfig()
        {
            _SelectedBackscatterVM = null;

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

            _backscatterVMDict.Clear();
            this.NotifyOfPropertyChange(() => this.BackscatterVMList);
        }
Ejemplo n.º 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 (!_backscatterVMDict.ContainsKey(config))
            {
                if (_backscatterVMDict.TryAdd(config, new BackscatterViewModel(config)))
                {
                    this.NotifyOfPropertyChange(() => this.BackscatterVMList);

                    // Select a tab is nothing is selected
                    if (_SelectedBackscatterVM == null)
                    {
                        if (BackscatterVMList.Count > 0)
                        {
                            SelectedBackscatterVM = BackscatterVMList[0];
                        }
                    }
                }
            }
        }
Ejemplo n.º 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 (_backscatterVMDict.ContainsKey(closeVmEvent.SubsysDataConfig))
            {
                // Dispose the display then remove the display
                _backscatterVMDict[closeVmEvent.SubsysDataConfig].Dispose();
                BackscatterViewModel vm = null;
                if (_backscatterVMDict.TryRemove(closeVmEvent.SubsysDataConfig, out vm))
                {
                    this.NotifyOfPropertyChange(() => this.BackscatterVMList);

                    // Select a tab is nothing is selected
                    if (_SelectedBackscatterVM == null)
                    {
                        if (BackscatterVMList.Count > 0)
                        {
                            SelectedBackscatterVM = BackscatterVMList[0];
                        }
                    }
                }
            }
        }