private async Task SaveOrEditAsync(Hotkey hotkey) { int result = CurrentProfile.AddOrEditHotkeyIfExisting(hotkey); if (result >= 0) { await _profileManager.SaveProfileAsync(CurrentProfile).ConfigureAwait(false); } switch (result) { case -1: CustomMessageDialog messageDialog = new CustomMessageDialog("No more hotkey is available"); messageDialog.ShowDialog(); break; case 0: await _eventAggregator.PublishOnUIThreadAsync(new HotkeyModifiedEvent { Hotkey = hotkey, ModifiedEvent = EHotkeyModifiedEvent.Modified }); break; case 1: await _eventAggregator.PublishOnUIThreadAsync(new HotkeyModifiedEvent { Hotkey = hotkey, ModifiedEvent = EHotkeyModifiedEvent.Added }); break; default: break; } }