private ArchiveDeviceViewModel AddDeviceInternal(XDevice device, ArchiveDeviceViewModel parentDeviceViewModel) { var deviceViewModel = new ArchiveDeviceViewModel(device); if (parentDeviceViewModel != null) parentDeviceViewModel.AddChild(deviceViewModel); foreach (var childDevice in device.Children) AddDeviceInternal(childDevice, deviceViewModel); return deviceViewModel; }
void AddChildPlainDevices(ArchiveDeviceViewModel parentViewModel) { AllDevices.Add(parentViewModel); foreach (var childViewModel in parentViewModel.Children) AddChildPlainDevices(childViewModel); }