private void DeleteEmulatedDevice(EmulatedDevice device) { int i = EmulatedDevices.IndexOf(device); EmulatedDevices.Remove(device); if (EmulatedDevices.Count == 0) { SelectedEmulatedDevice = null; } else { if (i == 0) { SelectedEmulatedDevice = EmulatedDevices[0]; } else { SelectedEmulatedDevice = EmulatedDevices[i - 1]; } } SelectedRegionBrush.SelectedEmulatedDevice = SelectedEmulatedDevice; if (SelectedRegionBrush.SelectedEmulatedDevice == null) { SelectedRegionBrush.SelectedEmulatedKey = null; } }
private void OkNewEmulatedDevice(object obj) { bool was_empty = EmulatedDevices.Count == 0; EmulatedDevices.Add(new EmulatedDevice { Name = NewEmulatedDeviceInput }); NewEmulatedDeviceInput = ""; SelectedEmulatedDevice = EmulatedDevices[EmulatedDevices.Count - 1]; IsEditingNewEmulatedDeviceName = false; if (was_empty) { SelectedRegionBrush.SelectedEmulatedDevice = SelectedEmulatedDevice; } }