Beispiel #1
0
        /// <summary>
        /// Remove a subsystem from the serial number.
        /// </summary>
        private void On_RemoveSubsystemCommand()
        {
            if (_SerialNumber.SubSystemsList.Count > 0)
            {
                // Remove the last subsystem in the serial number
                Subsystem ss = _SerialNumber.SubSystemsList.Last();
                _SerialNumber.RemoveSubsystem(ss);

                // Add the Subsystem type back to the list
                RTI.SubsystemList.SubsystemCodeDesc subsysDesc = new RTI.SubsystemList.SubsystemCodeDesc(ss.Code, Subsystem.DescString(ss.Code));
                if (!ListOfSubsystems.Contains(subsysDesc))
                {
                    ListOfSubsystems.Add(subsysDesc);

                    // Set something new to the selected subsystem
                    if (ListOfSubsystems.Count > 0)
                    {
                        SelectedSubsystem = ListOfSubsystems.First();
                    }
                }
            }

            // Update the Subsystem and Serial number string
            this.NotifyOfPropertyChange(() => this.Subsystems);
            this.NotifyOfPropertyChange(() => this.SerialNumStr);

            //// Call this to update the button if should be disabled
            //((DelegateCommand<object>)AddSubsystemCommand).RaiseCanExecuteChanged();
            //((DelegateCommand<object>)RemoveSubsystemCommand).RaiseCanExecuteChanged();
        }
Beispiel #2
0
        /// <summary>
        /// Add a subsystem to the serial number.  Then
        /// update the removed the selected subsystem from the list
        /// and select a new default.
        /// </summary>
        /// <param name="ss">Subsystem to add.</param>
        public void AddSubsystem(Subsystem ss)
        {
            _SerialNumber.AddSubsystem(ss);

            RTI.SubsystemList.SubsystemCodeDesc subsysDesc = new RTI.SubsystemList.SubsystemCodeDesc(ss.Code, Subsystem.DescString(ss.Code));
            if (ListOfSubsystems.Contains(subsysDesc))
            {
                ListOfSubsystems.Remove(subsysDesc);
            }

            // Set something new to the selected subsystem
            if (ListOfSubsystems.Count > 0)
            {
                SelectedSubsystem = ListOfSubsystems.First();
            }

            // Update the Subsystem and Serial number string
            this.NotifyOfPropertyChange(() => this.Subsystems);
            this.NotifyOfPropertyChange(() => this.SerialNumStr);

            // Send event to update Serial number
            UpdateSerialNumberEvent();
        }