Esempio n. 1
0
        public void EditLayer(LayerModel layerModel)
        {
            if (layerModel == null)
            {
                return;
            }

            ProfileEditorModel.EditLayer(layerModel, _moduleModel.DataModel);
            UpdateLayerList(layerModel);
        }
Esempio n. 2
0
        public void EditLayer()
        {
            if (SelectedLayer == null)
            {
                return;
            }

            ProfileEditorModel.EditLayer(SelectedLayer, _moduleModel.DataModel);
            UpdateLayerList(SelectedLayer);
        }
        public void EditLayer(LayerModel layerModel)
        {
            if (layerModel == null)
            {
                return;
            }

            KeepActive = true;
            ProfileEditorModel.EditLayer(layerModel, _moduleModel.DataModel);
            UpdateLayerList(layerModel);
            KeepActive = false;
        }
        public void EditLayer()
        {
            if (SelectedLayer == null)
            {
                return;
            }

            KeepActive = true;
            ProfileEditorModel.EditLayer(SelectedLayer, _moduleModel.DataModel);
            UpdateLayerList(SelectedLayer);
            KeepActive = false;
        }
        public async void RenameProfile()
        {
            if (SelectedProfile == null)
            {
                return;
            }

            var renameProfile = SelectedProfile;
            await ProfileEditorModel.RenameProfile(SelectedProfile);

            LoadProfiles();
            _moduleModel.ChangeProfile(renameProfile);
        }
Esempio n. 6
0
        public async void RenameProfile()
        {
            if (SelectedProfile == null)
            {
                return;
            }

            var renameProfile = SelectedProfile;
            await ProfileEditorModel.RenameProfile(SelectedProfile);

            LoadProfiles();
            SelectedProfileName = "Default";
            SelectedProfileName = renameProfile.Name;
        }
        public async void DeleteProfile()
        {
            if (SelectedProfile == null)
            {
                return;
            }

            var confirmed = await ProfileEditorModel.DeleteProfile(SelectedProfile, _moduleModel);

            if (!confirmed)
            {
                return;
            }

            LoadProfiles();
            ProfileEditorModel.ChangeProfileByName(_moduleModel, null);
        }
        public async void DuplicateProfile()
        {
            if (SelectedProfile == null)
            {
                return;
            }

            var newProfle = await ProfileEditorModel.DuplicateProfile(SelectedProfile);

            if (newProfle == null)
            {
                return;
            }

            LoadProfiles();
            _moduleModel.ChangeProfile(newProfle);
        }
 public void EditLua()
 {
     if (SelectedProfile == null)
     {
         return;
     }
     try
     {
         ProfileEditorModel.OpenLuaEditor(_moduleModel);
     }
     catch (Exception e)
     {
         _dialogService.ShowMessageBox("Couldn't open LUA file",
                                       "Please make sure you have a text editor associated with the .lua extension.\n\n" +
                                       "Windows error message: \n" + e.Message);
     }
 }
Esempio n. 10
0
        public async void DuplicateProfile()
        {
            if (SelectedProfile == null)
            {
                return;
            }

            var newProfle = await ProfileEditorModel.DuplicateProfile(SelectedProfile);

            if (newProfle == null)
            {
                return;
            }

            LoadProfiles();
            SelectedProfileName = newProfle.Name;
        }
        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);
        }
Esempio n. 12
0
        public ProfileEditorViewModel(ProfileEditorModel profileEditorModel, DeviceManager deviceManager,
                                      LoopManager loopManager, ModuleModel moduleModel, MetroDialogService dialogService)
        {
            _deviceManager = deviceManager;
            _loopManager   = loopManager;
            _moduleModel   = moduleModel;
            _dialogService = dialogService;

            ProfileNames       = new ObservableCollection <string>();
            Layers             = new ObservableCollection <LayerModel>();
            ProfileEditorModel = profileEditorModel;
            ShowAll            = true;

            PropertyChanged += EditorStateHandler;
            _deviceManager.OnKeyboardChanged += DeviceManagerOnOnKeyboardChanged;
            _moduleModel.ProfileChanged      += ModuleModelOnProfileChanged;
            LoadProfiles();
        }
Esempio n. 13
0
        public async void ImportProfile()
        {
            if (_deviceManager.ActiveKeyboard == null)
            {
                _dialogService.ShowMessageBox("Cannot import profile.",
                                              "To import a profile, please select a keyboard in the options menu first.");
                return;
            }

            var importProfile = await ProfileEditorModel.ImportProfile(_moduleModel);

            if (importProfile == null)
            {
                return;
            }

            LoadProfiles();
            SelectedProfileName = importProfile.Name;
        }
        public ProfileEditorViewModel(ProfileEditorModel profileEditorModel, DeviceManager deviceManager, LoopManager loopManager, LuaManager luaManager, ModuleModel moduleModel, MetroDialogService dialogService)
        {
            _deviceManager       = deviceManager;
            _loopManager         = loopManager;
            _moduleModel         = moduleModel;
            _dialogService       = dialogService;
            _copyKeybind         = new KeybindModel("copy", new HotKey(Key.C, ModifierKeys.Control), PressType.Down, LayerToClipboard);
            _pasteKeybind        = new KeybindModel("paste", new HotKey(Key.V, ModifierKeys.Control), PressType.Up, ClipboardToLayer);
            _placeholderKeyboard = KeyboardPreview = ImageUtilities.BitmapToBitmapImage(Resources.none);
            ProfileNames         = new ObservableCollection <string>();
            Layers             = new ObservableCollection <LayerModel>();
            ProfileEditorModel = profileEditorModel;
            LuaManager         = luaManager;
            ShowAll            = true;

            PropertyChanged += EditorStateHandler;
            _deviceManager.OnKeyboardChanged += DeviceManagerOnOnKeyboardChanged;
            _moduleModel.ProfileChanged      += ModuleModelOnProfileChanged;

            LoadProfiles();
        }
Esempio n. 15
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";
        }
 public void RemoveLayer(LayerModel layer)
 {
     ProfileEditorModel.RemoveLayer(layer, SelectedProfile);
     UpdateLayerList(null);
 }