/// <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(); }
public void TestSubsystemCodeDescEqual() { RTI.SubsystemList.SubsystemCodeDesc scd1 = new RTI.SubsystemList.SubsystemCodeDesc(Subsystem.SUB_2MHZ_4BEAM_20DEG_PISTON_1, Subsystem.DescString(Subsystem.SUB_2MHZ_4BEAM_20DEG_PISTON_1)); RTI.SubsystemList.SubsystemCodeDesc scd1_ = new RTI.SubsystemList.SubsystemCodeDesc(Subsystem.SUB_2MHZ_4BEAM_20DEG_PISTON_1, Subsystem.DescString(Subsystem.SUB_2MHZ_4BEAM_20DEG_PISTON_1)); RTI.SubsystemList.SubsystemCodeDesc scd2 = new RTI.SubsystemList.SubsystemCodeDesc(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2, Subsystem.DescString(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2)); Assert.IsTrue(scd1 == scd1_, "SubsystemCodeDesc Equal is incorrect."); Assert.IsTrue(scd1 != scd2, "SubsystemCodeDesc Not Equal is incorrect."); }
/// <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(); }