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);
        }
Ejemplo n.º 2
0
        public void ChangeProfileByName(ModuleModel moduleModel, string profileName)
        {
            if (string.IsNullOrEmpty(profileName))
            {
                profileName = "Default";
            }

            moduleModel.ChangeProfile(ProfileProvider.GetProfile(_deviceManager.ActiveKeyboard, moduleModel, profileName));
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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";
        }