예제 #1
0
 public IntbusDevice(IntbusInterface intbusInterface, int address)
 {
     this.address = address > 32 | address < 1
         ? throw new Exception("Адрес устройства должен быть от 1 до 32")
         : address;
     this.IntbusInterface = intbusInterface;
     SlaveIntbusDevices   = new ObservableCollection <IntbusDevice>();
     PrefixBytes          = new List <byte>();
     PostfixBytes         = new List <byte>();
 }
예제 #2
0
 private void CommandNew_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (TreeView_IntbusDevices.SelectedItem == null)
     {
         IntbusDevices.Add(new IntbusDevice(IntbusInterface, IntbusAddress)
         {
             Name = IntbusName
         });
     }
     else
     {
         IntbusDevice intbusDevice = TreeView_IntbusDevices.SelectedItem as IntbusDevice;
         intbusDevice.AddIntbusDevice(
             new IntbusDevice(
                 IntbusInterface.Clone() as IntbusInterface,
                 IntbusAddress)
         {
             Name = IntbusName
         }
             );
     }
 }