void DeleteBlinkStick(BlinkStickViewModel vm) { _settingsService.Settings.ConfiguredDevices.Remove(vm.Settings?.BlinkStickSettings); if (SelectedLedDevice == vm) { SelectedLedDevice = null; } LedDevices.Remove(vm); Menu.Children.RemoveAll(o => o.ViewModel == vm); _blinkStickViewModelFactory.Release(vm); }
public async void DeleteDevice(LedDeviceViewModel deviceViewModel) { // Todo: implement Generic yes / no Dialog like DialogComboBoxSelectionViewModel var result = await DialogHost.Show(deviceViewModel, delegate(object sender, DialogClosingEventArgs args) { if (!(args.Parameter is DialogAnswer answer) || answer != DialogAnswer.Yes) { return; } if (deviceViewModel is BlinkStickViewModel vm) { DeleteBlinkStick(vm); } }); }
public void AddNewBlinkStick() { AddBlinkStick(); SelectedLedDevice = LedDevices.Last(); RowDoubleClick(); }