private void CommandDelete_Executed(object sender, ExecutedRoutedEventArgs e) { IntbusDevice removingDevice = (TreeView_IntbusDevices.SelectedItem as IntbusDevice); if (IntbusDevices.Contains(removingDevice)) { IntbusDevices.Remove(removingDevice); return; } foreach (IntbusDevice device in IntbusDevices) { if (TryRemoveRecursive(device, removingDevice)) { return; } } }
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 } ); } }