public async void AddProfile() { if (_deviceManager.ActiveKeyboard == null) { _dialogService.ShowMessageBox("Cannot add profile.", "To add a profile, please select a keyboard in the options menu first."); return; } var profile = await ProfileEditorModel.AddProfile(_moduleModel); if (profile == null) { return; } LoadProfiles(); _moduleModel.ChangeProfile(profile); }
public void ChangeProfileByName(ModuleModel moduleModel, string profileName) { if (string.IsNullOrEmpty(profileName)) { profileName = "Default"; } moduleModel.ChangeProfile(ProfileProvider.GetProfile(_deviceManager.ActiveKeyboard, moduleModel, profileName)); }
public async Task <bool> DeleteProfile(ProfileModel selectedProfile, ModuleModel moduleModel) { var confirm = await _dialogService.ShowQuestionMessageBox("Delete profile", $"Are you sure you want to delete the profile named: {selectedProfile.Name}?\n\n" + "This cannot be undone."); if (!confirm.Value) { return(false); } var defaultProfile = ProfileProvider.GetProfile(_deviceManager.ActiveKeyboard, moduleModel, "Default"); var deleteProfile = selectedProfile; moduleModel.ChangeProfile(defaultProfile); ProfileProvider.DeleteProfile(deleteProfile); return(true); }
public async void DeleteProfile() { if (SelectedProfile == null) { return; } var confirmed = await ProfileEditorModel.ConfirmDeleteProfile(SelectedProfile, _moduleModel); if (!confirmed) { return; } var deleteProfile = SelectedProfile; _moduleModel.ChangeProfile(null); ProfileProvider.DeleteProfile(deleteProfile); LoadProfiles(); SelectedProfileName = "Default"; }