© 2026 Hedgehog Software, LLC
throw new InvalidOperationException("Call from invalid thread"); once the "+" button is clicked.
if (!String.IsNullOrWhiteSpace(emulatorName))
emulatorName
<ComboBox SelectedItem="{Binding SelectorDomain.SelectorDTO.Name}"/> <Button Content="+" Command="{Binding SelectorVM.AddEmulatorCommand}"/>
public ViewModel(){ var canAddEmulator = this.WhenAnyValue(vm => vm.SelectorDomain.SelectorDTO.Name).Select(name => name != "Select an Emulator"); AddEmulatorCommand = ReactiveCommand.Create(AddEmulator, canAddEmulator); } private async void AddEmulator() { try { String selectedEmulator = SelectorDomain.SelectorDTO.Name?.Trim(); if (String.IsNullOrWhiteSpace(selectedEmulator)) return; String unformattedEmulator = NameFormatter.UnformatEmulatorName(selectedEmulator); await SelectorDomain.SelectorModel.SelectEmulatorAsync(unformattedEmulator); } catch (Exception ex) { Debug.WriteLine($"Exception in AddEmulator: {ex}"); } }
public async Task SelectEmulatorAsync(string emulatorName) { if (!String.IsNullOrWhiteSpace(emulatorName)) { emulatorName = emulatorName.Trim(); var emulator = await Context.Emulators .Where(e => e.Name.Trim() == emulatorName) .FirstOrDefaultAsync(); if (emulator != null) { await Context.SaveChangesAsync(); } } } }