コード例 #1
0
 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);
 }
コード例 #2
0
        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);
                }
            });
        }
コード例 #3
0
 public void AddNewBlinkStick()
 {
     AddBlinkStick();
     SelectedLedDevice = LedDevices.Last();
     RowDoubleClick();
 }