Exemplo n.º 1
0
        //Profile - Keypad remove profile
        void Btn_Settings_KeypadProcessProfile_Remove_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                if (selectedProfile.Name != "Default")
                {
                    //Remove mapping from list
                    vDirectKeypadMapping.Remove(selectedProfile);

                    //Save changes to Json file
                    JsonSaveObject(vDirectKeypadMapping, "DirectKeypadMapping");

                    //Select the default profile
                    combobox_KeypadProcessProfile.SelectedIndex = 0;

                    NotificationDetails notificationDetails = new NotificationDetails();
                    notificationDetails.Icon = "RemoveCross";
                    notificationDetails.Text = "Application removed";
                    App.vWindowOverlay.Notification_Show_Status(notificationDetails);
                    Debug.WriteLine("Removed the keypad profile.");
                }
                else
                {
                    NotificationDetails notificationDetails = new NotificationDetails();
                    notificationDetails.Icon = "Close";
                    notificationDetails.Text = "Cannot remove default";
                    App.vWindowOverlay.Notification_Show_Status(notificationDetails);
                    Debug.WriteLine("Default profile cannot be removed.");
                }
            }
            catch { }
        }
Exemplo n.º 2
0
        //Load keypad profile
        void JsonLoadList_KeypadProfile()
        {
            try
            {
                Debug.WriteLine("Loading keypad profile.");

                //Get current selected profile
                KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;

                //Load keypad opacity
                textblock_KeypadOpacity.Text = textblock_KeypadOpacity.Tag + ": " + selectedProfile.KeypadOpacity.ToString("0.00") + "%";
                slider_KeypadOpacity.Value   = selectedProfile.KeypadOpacity;

                //Load keypad display style
                combobox_KeypadDisplayStyle.SelectedIndex = selectedProfile.KeypadDisplayStyle;

                //Load keypad display size
                textblock_KeypadDisplaySize.Text = textblock_KeypadDisplaySize.Tag + ": " + selectedProfile.KeypadDisplaySize + "%";
                slider_KeypadDisplaySize.Value   = selectedProfile.KeypadDisplaySize;

                //Load keypad repeat interval
                textblock_KeypadRepeatIntervalMs.Text = textblock_KeypadRepeatIntervalMs.Tag + ": " + selectedProfile.ButtonRepeatIntervalMs + "ms";
                slider_KeypadRepeatIntervalMs.Value   = selectedProfile.ButtonRepeatIntervalMs;

                //Update all keypad key tool tips
                UpdateKeypadToolTips();
            }
            catch { }
        }
Exemplo n.º 3
0
        //Update keypad interface
        void UpdateKeypadInterface()
        {
            try
            {
                //Get current selected profile
                KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;

                //Load keypad opacity
                textblock_KeypadOpacity.Text = textblock_KeypadOpacity.Tag + ": " + selectedProfile.KeypadOpacity.ToString("0.00") + "%";
                slider_KeypadOpacity.Value   = selectedProfile.KeypadOpacity;

                //Load keypad display style
                combobox_KeypadDisplayStyle.SelectedIndex = selectedProfile.KeypadDisplayStyle;

                //Load keypad display size
                textblock_KeypadDisplaySize.Text = textblock_KeypadDisplaySize.Tag + ": " + selectedProfile.KeypadDisplaySize + "%";
                slider_KeypadDisplaySize.Value   = selectedProfile.KeypadDisplaySize;

                //Load keypad mouse enabled
                cb_SettingsKeypadMouseMoveEnabled.IsChecked = selectedProfile.KeypadMouseMoveEnabled;

                //Load keypad mouse sensitivity
                textblock_SettingsKeypadMouseMoveSensitivity.Text = textblock_SettingsKeypadMouseMoveSensitivity.Tag + ": " + selectedProfile.KeypadMouseMoveSensitivity.ToString("0.00");
                slider_SettingsKeypadMouseMoveSensitivity.Value   = selectedProfile.KeypadMouseMoveSensitivity;

                //Update all keypad tooltips
                UpdateKeypadToolTips();

                Debug.WriteLine("Updated keypad interface.");
            }
            catch { }
        }
Exemplo n.º 4
0
        //Set the keypad mapping profile
        void SetKeypadMappingProfile()
        {
            try
            {
                string        processNameLower           = vProcessForeground.Name.ToLower();
                string        processTitleLower          = vProcessForeground.Title.ToLower();
                KeypadMapping directKeypadMappingProfile = vDirectKeypadMapping.Where(x => x.Name.ToLower() == processNameLower || processTitleLower.Contains(x.Name.ToLower())).FirstOrDefault();
                if (directKeypadMappingProfile == null)
                {
                    directKeypadMappingProfile = vDirectKeypadMapping.Where(x => x.Name == "Default").FirstOrDefault();
                }

                //Show keypad mapping profile notification
                if (vKeypadMappingProfile != directKeypadMappingProfile)
                {
                    NotificationDetails notificationDetails = new NotificationDetails();
                    notificationDetails.Icon = "Keypad";
                    notificationDetails.Text = "Profile set to " + directKeypadMappingProfile.Name;
                    App.vWindowOverlay.Notification_Show_Status(notificationDetails);
                }

                //Update the keypad mapping profile
                vKeypadMappingProfile = directKeypadMappingProfile;
            }
            catch { }
        }
Exemplo n.º 5
0
 public static string GenerateJsonNameKeypadMapping(KeypadMapping keypadMapping)
 {
     try
     {
         return(@"User\DirectKeypadMapping\" + FileNameReplaceInvalidChars(keypadMapping.Name.ToLower(), string.Empty));
     }
     catch { }
     return(string.Empty);
 }
Exemplo n.º 6
0
        //Profile - Keypad add profile
        async void Btn_Settings_KeypadProcessProfile_Add_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string profileNameString = textbox_Settings_KeypadProcessProfile_Name.Text;
                string placeholderString = (string)textbox_Settings_KeypadProcessProfile_Name.GetValue(TextboxPlaceholder.PlaceholderProperty);

                //Check if profile name is set
                if (string.IsNullOrWhiteSpace(profileNameString) || profileNameString == placeholderString)
                {
                    NotificationDetails notificationDetailsNameSet = new NotificationDetails();
                    notificationDetailsNameSet.Icon = "Close";
                    notificationDetailsNameSet.Text = "No application name set";
                    await App.vWindowOverlay.Notification_Show_Status(notificationDetailsNameSet);

                    return;
                }

                //Check if profile name exists
                if (vDirectKeypadMapping.Any(x => x.Name.ToLower() == profileNameString.ToLower()))
                {
                    NotificationDetails notificationDetailsExists = new NotificationDetails();
                    notificationDetailsExists.Icon = "Close";
                    notificationDetailsExists.Text = "Keypad profile already exists";
                    await App.vWindowOverlay.Notification_Show_Status(notificationDetailsExists);

                    return;
                }

                //Add empty mapping to list
                KeypadMapping keypadMapping = new KeypadMapping();
                keypadMapping.Name = profileNameString;

                //Add profile to list
                vDirectKeypadMapping.Add(keypadMapping);

                //Save profile to Json file
                JsonSaveObject(keypadMapping, GenerateJsonNameKeypadMapping(keypadMapping));

                //Show notification
                NotificationDetails notificationDetails = new NotificationDetails();
                notificationDetails.Icon = "Plus";
                notificationDetails.Text = "Added keypad profile";
                await App.vWindowOverlay.Notification_Show_Status(notificationDetails);

                Debug.WriteLine("Added keypad profile.");
            }
            catch { }
        }
Exemplo n.º 7
0
        //Unmap keypad button
        void Btn_MapKeypad_MouseRight(object sender, RoutedEventArgs args)
        {
            try
            {
                Button sendButton    = sender as Button;
                string mapNameString = sendButton.Tag.ToString();
                Debug.WriteLine("Unmapped button: " + mapNameString);
                txt_KeypadMap_Status.Text = "Unmapped '" + mapNameString + "' from the keypad.";

                //Get keypad mapping profile
                KeypadMapping directKeypadMappingProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;

                //Store new keypad mapping in Json
                if (sendButton == btn_SetPadDPadLeft)
                {
                    directKeypadMappingProfile.DPadLeftMod = null;
                    directKeypadMappingProfile.DPadLeft    = null;
                }
                else if (sendButton == btn_SetPadDPadUp)
                {
                    directKeypadMappingProfile.DPadUpMod = null;
                    directKeypadMappingProfile.DPadUp    = null;
                }
                else if (sendButton == btn_SetPadDPadRight)
                {
                    directKeypadMappingProfile.DPadRightMod = null;
                    directKeypadMappingProfile.DPadRight    = null;
                }
                else if (sendButton == btn_SetPadDPadDown)
                {
                    directKeypadMappingProfile.DPadDownMod = null;
                    directKeypadMappingProfile.DPadDown    = null;
                }
                else if (sendButton == btn_SetPadThumbLeftLeft)
                {
                    directKeypadMappingProfile.ThumbLeftLeftMod = null;
                    directKeypadMappingProfile.ThumbLeftLeft    = null;
                }
                else if (sendButton == btn_SetPadThumbLeftUp)
                {
                    directKeypadMappingProfile.ThumbLeftUpMod = null;
                    directKeypadMappingProfile.ThumbLeftUp    = null;
                }
                else if (sendButton == btn_SetPadThumbLeftRight)
                {
                    directKeypadMappingProfile.ThumbLeftRightMod = null;
                    directKeypadMappingProfile.ThumbLeftRight    = null;
                }
                else if (sendButton == btn_SetPadThumbLeftDown)
                {
                    directKeypadMappingProfile.ThumbLeftDownMod = null;
                    directKeypadMappingProfile.ThumbLeftDown    = null;
                }
                else if (sendButton == btn_SetPadThumbRightLeft)
                {
                    directKeypadMappingProfile.ThumbRightLeftMod = null;
                    directKeypadMappingProfile.ThumbRightLeft    = null;
                }
                else if (sendButton == btn_SetPadThumbRightUp)
                {
                    directKeypadMappingProfile.ThumbRightUpMod = null;
                    directKeypadMappingProfile.ThumbRightUp    = null;
                }
                else if (sendButton == btn_SetPadThumbRightRight)
                {
                    directKeypadMappingProfile.ThumbRightRightMod = null;
                    directKeypadMappingProfile.ThumbRightRight    = null;
                }
                else if (sendButton == btn_SetPadThumbRightDown)
                {
                    directKeypadMappingProfile.ThumbRightDownMod = null;
                    directKeypadMappingProfile.ThumbRightDown    = null;
                }
                else if (sendButton == btn_SetPadA)
                {
                    directKeypadMappingProfile.ButtonAMod = null;
                    directKeypadMappingProfile.ButtonA    = null;
                }
                else if (sendButton == btn_SetPadB)
                {
                    directKeypadMappingProfile.ButtonBMod = null;
                    directKeypadMappingProfile.ButtonB    = null;
                }
                else if (sendButton == btn_SetPadX)
                {
                    directKeypadMappingProfile.ButtonXMod = null;
                    directKeypadMappingProfile.ButtonX    = null;
                }
                else if (sendButton == btn_SetPadY)
                {
                    directKeypadMappingProfile.ButtonYMod = null;
                    directKeypadMappingProfile.ButtonY    = null;
                }
                else if (sendButton == btn_SetPadShoulderLeft)
                {
                    directKeypadMappingProfile.ButtonShoulderLeftMod = null;
                    directKeypadMappingProfile.ButtonShoulderLeft    = null;
                }
                else if (sendButton == btn_SetPadShoulderRight)
                {
                    directKeypadMappingProfile.ButtonShoulderRightMod = null;
                    directKeypadMappingProfile.ButtonShoulderRight    = null;
                }
                else if (sendButton == btn_SetPadBack)
                {
                    directKeypadMappingProfile.ButtonBackMod = null;
                    directKeypadMappingProfile.ButtonBack    = null;
                }
                else if (sendButton == btn_SetPadStart)
                {
                    directKeypadMappingProfile.ButtonStartMod = null;
                    directKeypadMappingProfile.ButtonStart    = null;
                }
                else if (sendButton == btn_SetPadThumbLeft)
                {
                    directKeypadMappingProfile.ButtonThumbLeftMod = null;
                    directKeypadMappingProfile.ButtonThumbLeft    = null;
                }
                else if (sendButton == btn_SetPadThumbRight)
                {
                    directKeypadMappingProfile.ButtonThumbRightMod = null;
                    directKeypadMappingProfile.ButtonThumbRight    = null;
                }
                else if (sendButton == btn_SetPadTriggerLeft)
                {
                    directKeypadMappingProfile.ButtonTriggerLeftMod = null;
                    directKeypadMappingProfile.ButtonTriggerLeft    = null;
                }
                else if (sendButton == btn_SetPadTriggerRight)
                {
                    directKeypadMappingProfile.ButtonTriggerRightMod = null;
                    directKeypadMappingProfile.ButtonTriggerRight    = null;
                }

                //Save changes to Json file
                JsonSaveObject(vDirectKeypadMapping, "DirectKeypadMapping");

                //Update the key names
                App.vWindowKeypad.UpdateKeypadNames();
            }
            catch { }
        }
Exemplo n.º 8
0
        //Save keypad button mapping
        bool KeypadSaveMapping(KeysVirtual usedVirtualKey, KeysVirtual?usedModifierKey)
        {
            try
            {
                //Check if keypad mapping is enabled
                if (vMappingKeypadStatus == MappingStatus.Mapping)
                {
                    //Get keypad mapping profile
                    KeypadMapping directKeypadMappingProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;

                    string mapNameString = vMappingKeypadButton.Tag.ToString();
                    Debug.WriteLine("Mapped button " + mapNameString + " to: " + usedModifierKey + " / " + usedVirtualKey);

                    if (vMappingKeypadButton == btn_SetPadDPadLeft)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.DPadLeftMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.DPadLeftMod = null;
                        }
                        directKeypadMappingProfile.DPadLeft = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadDPadUp)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.DPadUpMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.DPadUpMod = null;
                        }
                        directKeypadMappingProfile.DPadUp = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadDPadRight)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.DPadRightMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.DPadRightMod = null;
                        }
                        directKeypadMappingProfile.DPadRight = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadDPadDown)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.DPadDownMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.DPadDownMod = null;
                        }
                        directKeypadMappingProfile.DPadDown = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadThumbLeftLeft)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ThumbLeftLeftMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ThumbLeftLeftMod = null;
                        }
                        directKeypadMappingProfile.ThumbLeftLeft = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadThumbLeftUp)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ThumbLeftUpMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ThumbLeftUpMod = null;
                        }
                        directKeypadMappingProfile.ThumbLeftUp = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadThumbLeftRight)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ThumbLeftRightMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ThumbLeftRightMod = null;
                        }
                        directKeypadMappingProfile.ThumbLeftRight = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadThumbLeftDown)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ThumbLeftDownMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ThumbLeftDownMod = null;
                        }
                        directKeypadMappingProfile.ThumbLeftDown = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadThumbRightLeft)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ThumbRightLeftMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ThumbRightLeftMod = null;
                        }
                        directKeypadMappingProfile.ThumbRightLeft = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadThumbRightUp)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ThumbRightUpMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ThumbRightUpMod = null;
                        }
                        directKeypadMappingProfile.ThumbRightUp = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadThumbRightRight)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ThumbRightRightMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ThumbRightRightMod = null;
                        }
                        directKeypadMappingProfile.ThumbRightRight = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadThumbRightDown)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ThumbRightDownMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ThumbRightDownMod = null;
                        }
                        directKeypadMappingProfile.ThumbRightDown = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadA)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonAMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonAMod = null;
                        }
                        directKeypadMappingProfile.ButtonA = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadB)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonBMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonBMod = null;
                        }
                        directKeypadMappingProfile.ButtonB = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadX)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonXMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonXMod = null;
                        }
                        directKeypadMappingProfile.ButtonX = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadY)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonYMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonYMod = null;
                        }
                        directKeypadMappingProfile.ButtonY = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadShoulderLeft)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonShoulderLeftMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonShoulderLeftMod = null;
                        }
                        directKeypadMappingProfile.ButtonShoulderLeft = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadShoulderRight)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonShoulderRightMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonShoulderRightMod = null;
                        }
                        directKeypadMappingProfile.ButtonShoulderRight = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadBack)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonBackMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonBackMod = null;
                        }
                        directKeypadMappingProfile.ButtonBack = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadStart)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonStartMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonStartMod = null;
                        }
                        directKeypadMappingProfile.ButtonStart = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadThumbLeft)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonThumbLeftMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonThumbLeftMod = null;
                        }
                        directKeypadMappingProfile.ButtonThumbLeft = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadThumbRight)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonThumbRightMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonThumbRightMod = null;
                        }
                        directKeypadMappingProfile.ButtonThumbRight = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadTriggerLeft)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonTriggerLeftMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonTriggerLeftMod = null;
                        }
                        directKeypadMappingProfile.ButtonTriggerLeft = usedVirtualKey;
                    }
                    else if (vMappingKeypadButton == btn_SetPadTriggerRight)
                    {
                        if (usedModifierKey != null)
                        {
                            directKeypadMappingProfile.ButtonTriggerRightMod = usedModifierKey;
                        }
                        else
                        {
                            directKeypadMappingProfile.ButtonTriggerRightMod = null;
                        }
                        directKeypadMappingProfile.ButtonTriggerRight = usedVirtualKey;
                    }

                    //Reset controller button mapping
                    vMappingKeypadStatus = MappingStatus.Done;
                    vMappingKeypadButton = null;

                    //Save changes to Json file
                    JsonSaveObject(vDirectKeypadMapping, "DirectKeypadMapping");
                    return(true);
                }
            }
            catch { }
            return(false);
        }
Exemplo n.º 9
0
        //Update all keypad key tool tips
        public void UpdateKeypadToolTips()
        {
            try
            {
                //Get current selected profile
                KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;

                //Update the keypad tool tips
                btn_SetPadDPadLeft.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.DPadLeftMod, selectedProfile.DPadLeft, btn_SetPadDPadLeft.Tag.ToString())
                };
                btn_SetPadDPadUp.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.DPadUpMod, selectedProfile.DPadUp, btn_SetPadDPadUp.Tag.ToString())
                };
                btn_SetPadDPadRight.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.DPadRightMod, selectedProfile.DPadRight, btn_SetPadDPadRight.Tag.ToString())
                };
                btn_SetPadDPadDown.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.DPadDownMod, selectedProfile.DPadDown, btn_SetPadDPadDown.Tag.ToString())
                };

                btn_SetPadThumbLeftLeft.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ThumbLeftLeftMod, selectedProfile.ThumbLeftLeft, btn_SetPadThumbLeftLeft.Tag.ToString())
                };
                btn_SetPadThumbLeftUp.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ThumbLeftUpMod, selectedProfile.ThumbLeftUp, btn_SetPadThumbLeftUp.Tag.ToString())
                };
                btn_SetPadThumbLeftRight.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ThumbLeftRightMod, selectedProfile.ThumbLeftRight, btn_SetPadThumbLeftRight.Tag.ToString())
                };
                btn_SetPadThumbLeftDown.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ThumbLeftDownMod, selectedProfile.ThumbLeftDown, btn_SetPadThumbLeftDown.Tag.ToString())
                };
                btn_SetPadThumbLeft.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonThumbLeftMod, selectedProfile.ButtonThumbLeft, btn_SetPadThumbLeft.Tag.ToString())
                };

                btn_SetPadThumbRightLeft.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ThumbRightLeftMod, selectedProfile.ThumbRightLeft, btn_SetPadThumbRightLeft.Tag.ToString())
                };
                btn_SetPadThumbRightUp.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ThumbRightUpMod, selectedProfile.ThumbRightUp, btn_SetPadThumbRightUp.Tag.ToString())
                };
                btn_SetPadThumbRightRight.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ThumbRightRightMod, selectedProfile.ThumbRightRight, btn_SetPadThumbRightRight.Tag.ToString())
                };
                btn_SetPadThumbRightDown.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ThumbRightDownMod, selectedProfile.ThumbRightDown, btn_SetPadThumbRightDown.Tag.ToString())
                };
                btn_SetPadThumbRight.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonThumbRightMod, selectedProfile.ButtonThumbRight, btn_SetPadThumbRight.Tag.ToString())
                };

                btn_SetPadBack.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonBackMod, selectedProfile.ButtonBack, btn_SetPadBack.Tag.ToString())
                };
                btn_SetPadStart.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonStartMod, selectedProfile.ButtonStart, btn_SetPadStart.Tag.ToString())
                };

                btn_SetPadX.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonXMod, selectedProfile.ButtonX, btn_SetPadX.Tag.ToString())
                };
                btn_SetPadY.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonYMod, selectedProfile.ButtonY, btn_SetPadY.Tag.ToString())
                };
                btn_SetPadA.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonAMod, selectedProfile.ButtonA, btn_SetPadA.Tag.ToString())
                };
                btn_SetPadB.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonBMod, selectedProfile.ButtonB, btn_SetPadB.Tag.ToString())
                };

                btn_SetPadShoulderLeft.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonShoulderLeftMod, selectedProfile.ButtonShoulderLeft, btn_SetPadShoulderLeft.Tag.ToString())
                };
                btn_SetPadTriggerLeft.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonTriggerLeftMod, selectedProfile.ButtonTriggerLeft, btn_SetPadTriggerLeft.Tag.ToString())
                };
                btn_SetPadShoulderRight.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonShoulderRightMod, selectedProfile.ButtonShoulderRight, btn_SetPadShoulderRight.Tag.ToString())
                };
                btn_SetPadTriggerRight.ToolTip = new ToolTip()
                {
                    Content = GenerateKeypadKeyToolTip(selectedProfile.ButtonTriggerRightMod, selectedProfile.ButtonTriggerRight, btn_SetPadTriggerRight.Tag.ToString())
                };
            }
            catch { }
        }
Exemplo n.º 10
0
        //Save keypad button mapping
        void ComboBox_MapKeypad_Save(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                //Check if combobox saving is enabled
                if (!vComboboxSaveEnabled)
                {
                    return;
                }

                //Get selected keypad buttons
                KeyboardModifiers usedModifierKey0 = (KeyboardModifiers)combobox_SetPad_Modifier0.SelectedItem;
                KeyboardModifiers usedModifierKey1 = (KeyboardModifiers)combobox_SetPad_Modifier1.SelectedItem;
                KeyboardKeys      usedVirtualKey   = (KeyboardKeys)combobox_SetPad_Keyboard.SelectedItem;

                //Get keypad mapping profile
                KeypadMapping keypadMappingProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;

                //Update mapping information
                string mapNameString = vMappingKeypadButton.Tag.ToString();
                Debug.WriteLine("Mapped button: " + mapNameString);
                txt_KeypadMap_Status.Text = "Mapped button " + mapNameString + " to: " + usedModifierKey0 + " / " + usedModifierKey1 + " / " + usedVirtualKey;

                if (vMappingKeypadButton == btn_SetPadDPadLeft)
                {
                    keypadMappingProfile.DPadLeftMod0 = usedModifierKey0;
                    keypadMappingProfile.DPadLeftMod1 = usedModifierKey1;
                    keypadMappingProfile.DPadLeft     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadDPadUp)
                {
                    keypadMappingProfile.DPadUpMod0 = usedModifierKey0;
                    keypadMappingProfile.DPadUpMod1 = usedModifierKey1;
                    keypadMappingProfile.DPadUp     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadDPadRight)
                {
                    keypadMappingProfile.DPadRightMod0 = usedModifierKey0;
                    keypadMappingProfile.DPadRightMod1 = usedModifierKey1;
                    keypadMappingProfile.DPadRight     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadDPadDown)
                {
                    keypadMappingProfile.DPadDownMod0 = usedModifierKey0;
                    keypadMappingProfile.DPadDownMod1 = usedModifierKey1;
                    keypadMappingProfile.DPadDown     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftLeft)
                {
                    keypadMappingProfile.ThumbLeftLeftMod0 = usedModifierKey0;
                    keypadMappingProfile.ThumbLeftLeftMod1 = usedModifierKey1;
                    keypadMappingProfile.ThumbLeftLeft     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftUp)
                {
                    keypadMappingProfile.ThumbLeftUpMod0 = usedModifierKey0;
                    keypadMappingProfile.ThumbLeftUpMod1 = usedModifierKey1;
                    keypadMappingProfile.ThumbLeftUp     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftRight)
                {
                    keypadMappingProfile.ThumbLeftRightMod0 = usedModifierKey0;
                    keypadMappingProfile.ThumbLeftRightMod1 = usedModifierKey1;
                    keypadMappingProfile.ThumbLeftRight     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftDown)
                {
                    keypadMappingProfile.ThumbLeftDownMod0 = usedModifierKey0;
                    keypadMappingProfile.ThumbLeftDownMod1 = usedModifierKey1;
                    keypadMappingProfile.ThumbLeftDown     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightLeft)
                {
                    keypadMappingProfile.ThumbRightLeftMod0 = usedModifierKey0;
                    keypadMappingProfile.ThumbRightLeftMod1 = usedModifierKey1;
                    keypadMappingProfile.ThumbRightLeft     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightUp)
                {
                    keypadMappingProfile.ThumbRightUpMod0 = usedModifierKey0;
                    keypadMappingProfile.ThumbRightUpMod1 = usedModifierKey1;
                    keypadMappingProfile.ThumbRightUp     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightRight)
                {
                    keypadMappingProfile.ThumbRightRightMod0 = usedModifierKey0;
                    keypadMappingProfile.ThumbRightRightMod1 = usedModifierKey1;
                    keypadMappingProfile.ThumbRightRight     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightDown)
                {
                    keypadMappingProfile.ThumbRightDownMod0 = usedModifierKey0;
                    keypadMappingProfile.ThumbRightDownMod1 = usedModifierKey1;
                    keypadMappingProfile.ThumbRightDown     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadA)
                {
                    keypadMappingProfile.ButtonAMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonAMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonA     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadB)
                {
                    keypadMappingProfile.ButtonBMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonBMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonB     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadX)
                {
                    keypadMappingProfile.ButtonXMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonXMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonX     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadY)
                {
                    keypadMappingProfile.ButtonYMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonYMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonY     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadShoulderLeft)
                {
                    keypadMappingProfile.ButtonShoulderLeftMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonShoulderLeftMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonShoulderLeft     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadShoulderRight)
                {
                    keypadMappingProfile.ButtonShoulderRightMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonShoulderRightMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonShoulderRight     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadBack)
                {
                    keypadMappingProfile.ButtonBackMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonBackMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonBack     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadStart)
                {
                    keypadMappingProfile.ButtonStartMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonStartMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonStart     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeft)
                {
                    keypadMappingProfile.ButtonThumbLeftMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonThumbLeftMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonThumbLeft     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRight)
                {
                    keypadMappingProfile.ButtonThumbRightMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonThumbRightMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonThumbRight     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadTriggerLeft)
                {
                    keypadMappingProfile.ButtonTriggerLeftMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonTriggerLeftMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonTriggerLeft     = usedVirtualKey;
                }
                else if (vMappingKeypadButton == btn_SetPadTriggerRight)
                {
                    keypadMappingProfile.ButtonTriggerRightMod0 = usedModifierKey0;
                    keypadMappingProfile.ButtonTriggerRightMod1 = usedModifierKey1;
                    keypadMappingProfile.ButtonTriggerRight     = usedVirtualKey;
                }

                //Save changes to Json file
                JsonSaveObject(keypadMappingProfile, GenerateJsonNameKeypadMapping(keypadMappingProfile));

                //Update the keypad names
                App.vWindowKeypad.UpdateKeypadNames();

                //Update the keypad tooltips
                UpdateKeypadToolTips();
            }
            catch { }
        }
Exemplo n.º 11
0
        //Unmap keypad button
        void Btn_MapKeypad_Mouse_Unmap(object sender, RoutedEventArgs args)
        {
            try
            {
                string mapNameString = vMappingKeypadButton.Tag.ToString();
                Debug.WriteLine("Unmapped button: " + mapNameString);
                txt_KeypadMap_Status.Text = "Unmapped button '" + mapNameString + "' from the keypad.";

                //Reset combobox selection
                vComboboxSaveEnabled = false;
                combobox_SetPad_Modifier0.SelectedItem = KeyboardModifiers.None;
                combobox_SetPad_Modifier1.SelectedItem = KeyboardModifiers.None;
                combobox_SetPad_Keyboard.SelectedItem  = KeyboardKeys.None;
                vComboboxSaveEnabled = true;

                //Get keypad mapping profile
                KeypadMapping keypadMappingProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;

                //Store new keypad mapping in Json
                if (vMappingKeypadButton == btn_SetPadDPadLeft)
                {
                    keypadMappingProfile.DPadLeftMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.DPadLeftMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.DPadLeft     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadDPadUp)
                {
                    keypadMappingProfile.DPadUpMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.DPadUpMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.DPadUp     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadDPadRight)
                {
                    keypadMappingProfile.DPadRightMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.DPadRightMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.DPadRight     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadDPadDown)
                {
                    keypadMappingProfile.DPadDownMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.DPadDownMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.DPadDown     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftLeft)
                {
                    keypadMappingProfile.ThumbLeftLeftMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbLeftLeftMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbLeftLeft     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftUp)
                {
                    keypadMappingProfile.ThumbLeftUpMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbLeftUpMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbLeftUp     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftRight)
                {
                    keypadMappingProfile.ThumbLeftRightMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbLeftRightMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbLeftRight     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftDown)
                {
                    keypadMappingProfile.ThumbLeftDownMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbLeftDownMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbLeftDown     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightLeft)
                {
                    keypadMappingProfile.ThumbRightLeftMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbRightLeftMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbRightLeft     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightUp)
                {
                    keypadMappingProfile.ThumbRightUpMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbRightUpMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbRightUp     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightRight)
                {
                    keypadMappingProfile.ThumbRightRightMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbRightRightMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbRightRight     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightDown)
                {
                    keypadMappingProfile.ThumbRightDownMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbRightDownMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ThumbRightDown     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadA)
                {
                    keypadMappingProfile.ButtonAMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonAMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonA     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadB)
                {
                    keypadMappingProfile.ButtonBMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonBMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonB     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadX)
                {
                    keypadMappingProfile.ButtonXMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonXMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonX     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadY)
                {
                    keypadMappingProfile.ButtonYMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonYMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonY     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadShoulderLeft)
                {
                    keypadMappingProfile.ButtonShoulderLeftMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonShoulderLeftMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonShoulderLeft     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadShoulderRight)
                {
                    keypadMappingProfile.ButtonShoulderRightMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonShoulderRightMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonShoulderRight     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadBack)
                {
                    keypadMappingProfile.ButtonBackMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonBackMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonBack     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadStart)
                {
                    keypadMappingProfile.ButtonStartMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonStartMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonStart     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeft)
                {
                    keypadMappingProfile.ButtonThumbLeftMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonThumbLeftMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonThumbLeft     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRight)
                {
                    keypadMappingProfile.ButtonThumbRightMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonThumbRightMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonThumbRight     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadTriggerLeft)
                {
                    keypadMappingProfile.ButtonTriggerLeftMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonTriggerLeftMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonTriggerLeft     = KeyboardKeys.None;
                }
                else if (vMappingKeypadButton == btn_SetPadTriggerRight)
                {
                    keypadMappingProfile.ButtonTriggerRightMod0 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonTriggerRightMod1 = KeyboardModifiers.None;
                    keypadMappingProfile.ButtonTriggerRight     = KeyboardKeys.None;
                }

                //Save changes to Json file
                JsonSaveObject(keypadMappingProfile, GenerateJsonNameKeypadMapping(keypadMappingProfile));

                //Update the keypad names
                App.vWindowKeypad.UpdateKeypadNames();

                //Update the keypad tooltips
                UpdateKeypadToolTips();
            }
            catch { }
        }
Exemplo n.º 12
0
        //Set keypad button
        void Btn_MapKeypad_Mouse_Set(object sender, RoutedEventArgs args)
        {
            try
            {
                //Set button to map
                Button sendButton    = sender as Button;
                string mapNameString = sendButton.Tag.ToString();
                Debug.WriteLine("Set button: " + mapNameString);
                vMappingKeypadButton = sendButton;

                //Get keypad mapping profile
                KeypadMapping keypadMappingProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;

                //Update mapping information
                textblock_SetPad_Name.Text = mapNameString;

                //Disable combobox event
                vComboboxSaveEnabled = false;

                //Select combobox index
                if (vMappingKeypadButton == btn_SetPadDPadLeft)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.DPadLeftMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.DPadLeftMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.DPadLeft;
                }
                else if (vMappingKeypadButton == btn_SetPadDPadUp)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.DPadUpMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.DPadUpMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.DPadUp;
                }
                else if (vMappingKeypadButton == btn_SetPadDPadRight)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.DPadRightMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.DPadRightMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.DPadRight;
                }
                else if (vMappingKeypadButton == btn_SetPadDPadDown)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.DPadDownMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.DPadDownMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.DPadDown;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftLeft)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ThumbLeftLeftMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ThumbLeftLeftMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ThumbLeftLeft;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftUp)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ThumbLeftUpMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ThumbLeftUpMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ThumbLeftUp;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftRight)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ThumbLeftRightMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ThumbLeftRightMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ThumbLeftRight;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeftDown)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ThumbLeftDownMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ThumbLeftDownMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ThumbLeftDown;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightLeft)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ThumbRightLeftMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ThumbRightLeftMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ThumbRightLeft;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightUp)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ThumbRightUpMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ThumbRightUpMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ThumbRightUp;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightRight)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ThumbRightRightMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ThumbRightRightMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ThumbRightRight;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRightDown)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ThumbRightDownMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ThumbRightDownMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ThumbRightDown;
                }
                else if (vMappingKeypadButton == btn_SetPadA)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonAMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonAMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonA;
                }
                else if (vMappingKeypadButton == btn_SetPadB)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonBMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonBMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonB;
                }
                else if (vMappingKeypadButton == btn_SetPadX)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonXMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonXMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonX;
                }
                else if (vMappingKeypadButton == btn_SetPadY)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonYMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonYMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonY;
                }
                else if (vMappingKeypadButton == btn_SetPadShoulderLeft)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonShoulderLeftMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonShoulderLeftMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonShoulderLeft;
                }
                else if (vMappingKeypadButton == btn_SetPadShoulderRight)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonShoulderRightMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonShoulderRightMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonShoulderRight;
                }
                else if (vMappingKeypadButton == btn_SetPadBack)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonBackMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonBackMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonBack;
                }
                else if (vMappingKeypadButton == btn_SetPadStart)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonStartMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonStartMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonStart;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbLeft)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonThumbLeftMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonThumbLeftMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonThumbLeft;
                }
                else if (vMappingKeypadButton == btn_SetPadThumbRight)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonThumbRightMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonThumbRightMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonThumbRight;
                }
                else if (vMappingKeypadButton == btn_SetPadTriggerLeft)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonTriggerLeftMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonTriggerLeftMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonTriggerLeft;
                }
                else if (vMappingKeypadButton == btn_SetPadTriggerRight)
                {
                    combobox_SetPad_Modifier0.SelectedItem = keypadMappingProfile.ButtonTriggerRightMod0;
                    combobox_SetPad_Modifier1.SelectedItem = keypadMappingProfile.ButtonTriggerRightMod1;
                    combobox_SetPad_Keyboard.SelectedItem  = keypadMappingProfile.ButtonTriggerRight;
                }

                //Enable combobox event
                vComboboxSaveEnabled = true;
            }
            catch { }
        }
Exemplo n.º 13
0
        //Save - Monitor Application Settings
        void Settings_Save()
        {
            try
            {
                cb_SettingsShortcutDisconnectBluetooth.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutDisconnectBluetooth", cb_SettingsShortcutDisconnectBluetooth.IsChecked.ToString());
                };

                cb_SettingsExclusiveGuide.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ExclusiveGuide", cb_SettingsExclusiveGuide.IsChecked.ToString());
                };

                cb_SettingsWindowsStartup.Click += (sender, e) =>
                {
                    AVSettings.ManageStartupShortcut("DirectXInput-Launcher.exe");
                };

                //Battery settings
                slider_BatteryLowLevel.ValueChanged += async(sender, e) =>
                {
                    string batteryLevelLowString = slider_BatteryLowLevel.Value.ToString();
                    Setting_Save(vConfigurationDirectXInput, "BatteryLowLevel", batteryLevelLowString);
                    textblock_BatteryLowLevel.Text = textblock_BatteryLowLevel.Tag + ": " + batteryLevelLowString + "%";

                    //Check all controllers for low battery level
                    await CheckAllControllersLowBattery(true);
                };

                cb_SettingsBatteryLowBlinkLed.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "BatteryLowBlinkLed", cb_SettingsBatteryLowBlinkLed.IsChecked.ToString());

                    //Check all controllers for low battery level
                    await CheckAllControllersLowBattery(true);
                };

                cb_SettingsBatteryLowShowNotification.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "BatteryLowShowNotification", cb_SettingsBatteryLowShowNotification.IsChecked.ToString());

                    //Check all controllers for low battery level
                    await CheckAllControllersLowBattery(true);
                };

                cb_SettingsBatteryLowPlaySound.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "BatteryLowPlaySound", cb_SettingsBatteryLowPlaySound.IsChecked.ToString());

                    //Check all controllers for low battery level
                    await CheckAllControllersLowBattery(true);
                };

                //Controller settings
                slider_ControllerIdleDisconnectMin.ValueChanged += (sender, e) =>
                {
                    string controllerIdleDisconnectMinString = slider_ControllerIdleDisconnectMin.Value.ToString();
                    Setting_Save(vConfigurationDirectXInput, "ControllerIdleDisconnectMin", controllerIdleDisconnectMinString);
                    textblock_ControllerIdleDisconnectMin.Text = textblock_ControllerIdleDisconnectMin.Tag + ": " + controllerIdleDisconnectMinString + " minutes";
                };

                colorpicker_Controller0.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        Setting_Save(vConfigurationDirectXInput, "ControllerColor0", newBrush.ToString());
                        colorpicker_Controller0.Background = newBrush;
                        vController0.Color = newBrush.Color;
                        if (vController0 == vActiveController())
                        {
                            txt_ActiveControllerName.Foreground = newBrush;
                        }

                        //Controller update led color
                        ControllerLedColor(vController0);
                        await NotifyCtrlUISettingChanged("ControllerColor");
                    }
                };

                colorpicker_Controller1.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        Setting_Save(vConfigurationDirectXInput, "ControllerColor1", newBrush.ToString());
                        colorpicker_Controller1.Background = newBrush;
                        vController1.Color = newBrush.Color;
                        if (vController1 == vActiveController())
                        {
                            txt_ActiveControllerName.Foreground = newBrush;
                        }

                        //Controller update led color
                        ControllerLedColor(vController1);
                        await NotifyCtrlUISettingChanged("ControllerColor");
                    }
                };

                colorpicker_Controller2.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        Setting_Save(vConfigurationDirectXInput, "ControllerColor2", newBrush.ToString());
                        colorpicker_Controller2.Background = newBrush;
                        vController2.Color = newBrush.Color;
                        if (vController2 == vActiveController())
                        {
                            txt_ActiveControllerName.Foreground = newBrush;
                        }

                        //Controller update led color
                        ControllerLedColor(vController2);
                        await NotifyCtrlUISettingChanged("ControllerColor");
                    }
                };

                colorpicker_Controller3.Click += async(sender, e) =>
                {
                    Color?newColor = await new AVColorPicker().Popup(null);
                    if (newColor != null)
                    {
                        SolidColorBrush newBrush = new SolidColorBrush((Color)newColor);
                        Setting_Save(vConfigurationDirectXInput, "ControllerColor3", newBrush.ToString());
                        colorpicker_Controller3.Background = newBrush;
                        vController3.Color = newBrush.Color;
                        if (vController3 == vActiveController())
                        {
                            txt_ActiveControllerName.Foreground = newBrush;
                        }

                        //Controller update led color
                        ControllerLedColor(vController3);
                        await NotifyCtrlUISettingChanged("ControllerColor");
                    }
                };

                //Shortcut settings
                cb_SettingsShortcutLaunchCtrlUI.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutLaunchCtrlUI", cb_SettingsShortcutLaunchCtrlUI.IsChecked.ToString());
                };

                cb_SettingsShortcutKeyboardPopup.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutKeyboardPopup", cb_SettingsShortcutKeyboardPopup.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutAltEnter.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutAltEnter", cb_SettingsShortcutAltEnter.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutAltTab.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutAltTab", cb_SettingsShortcutAltTab.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutScreenshotController.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutScreenshotController", cb_SettingsShortcutScreenshotController.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutScreenshotKeyboard.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutScreenshotKeyboard", cb_SettingsShortcutScreenshotKeyboard.IsChecked.ToString());
                };

                //Keyboard settings
                slider_KeyboardOpacity.ValueChanged += (sender, e) =>
                {
                    textblock_KeyboardOpacity.Text = textblock_KeyboardOpacity.Tag + ": " + slider_KeyboardOpacity.Value.ToString("0.00") + "%";
                    Setting_Save(vConfigurationDirectXInput, "KeyboardOpacity", slider_KeyboardOpacity.Value.ToString("0.00"));
                    App.vWindowKeyboard.UpdatePopupOpacity();
                };

                cb_SettingsKeyboardCloseNoController.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "KeyboardCloseNoController", cb_SettingsKeyboardCloseNoController.IsChecked.ToString());
                };

                cb_SettingsKeyboardResetPosition.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "KeyboardResetPosition", cb_SettingsKeyboardResetPosition.IsChecked.ToString());
                };

                combobox_KeyboardLayout.SelectionChanged += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "KeyboardLayout", combobox_KeyboardLayout.SelectedIndex.ToString());
                    App.vWindowKeyboard.UpdateKeyboardLayout();
                };

                slider_SettingsKeyboardMouseMoveSensitivity.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsKeyboardMouseMoveSensitivity.Text = textblock_SettingsKeyboardMouseMoveSensitivity.Tag.ToString() + slider_SettingsKeyboardMouseMoveSensitivity.Value.ToString("0.00");
                    Setting_Save(vConfigurationDirectXInput, "KeyboardMouseMoveSensitivity", slider_SettingsKeyboardMouseMoveSensitivity.Value.ToString("0.00"));
                };

                slider_SettingsKeyboardMouseScrollSensitivity2.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsKeyboardMouseScrollSensitivity2.Text = textblock_SettingsKeyboardMouseScrollSensitivity2.Tag.ToString() + slider_SettingsKeyboardMouseScrollSensitivity2.Value.ToString();
                    Setting_Save(vConfigurationDirectXInput, "KeyboardMouseScrollSensitivity2", slider_SettingsKeyboardMouseScrollSensitivity2.Value.ToString());
                };

                //Keypad settings
                slider_KeypadOpacity.ValueChanged += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadOpacity = slider_KeypadOpacity.Value;

                    //Save changes to Json file
                    JsonSaveObject(selectedProfile, GenerateJsonNameKeypadMapping(selectedProfile));

                    textblock_KeypadOpacity.Text = textblock_KeypadOpacity.Tag + ": " + slider_KeypadOpacity.Value.ToString("0.00") + "%";
                    App.vWindowKeypad.UpdatePopupOpacity();
                };

                combobox_KeypadDisplayStyle.SelectionChanged += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadDisplayStyle = combobox_KeypadDisplayStyle.SelectedIndex;

                    //Save changes to Json file
                    JsonSaveObject(selectedProfile, GenerateJsonNameKeypadMapping(selectedProfile));

                    App.vWindowKeypad.UpdateKeypadStyle();
                };

                slider_KeypadDisplaySize.ValueChanged += async(sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadDisplaySize = Convert.ToInt32(slider_KeypadDisplaySize.Value);

                    //Save changes to Json file
                    JsonSaveObject(selectedProfile, GenerateJsonNameKeypadMapping(selectedProfile));

                    textblock_KeypadDisplaySize.Text = textblock_KeypadDisplaySize.Tag + ": " + selectedProfile.KeypadDisplaySize + "%";

                    //Update the keypad size
                    double keypadHeight = App.vWindowKeypad.UpdateKeypadSize();

                    //Notify - Fps Overlayer keypad size changed
                    await NotifyFpsOverlayerKeypadSizeChanged(Convert.ToInt32(keypadHeight));
                };

                cb_SettingsKeypadMouseMoveEnabled.Click += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadMouseMoveEnabled = (bool)cb_SettingsKeypadMouseMoveEnabled.IsChecked;

                    //Save changes to Json file
                    JsonSaveObject(selectedProfile, GenerateJsonNameKeypadMapping(selectedProfile));

                    //Update all keypad key names
                    App.vWindowKeypad.UpdateKeypadNames();
                };

                slider_SettingsKeypadMouseMoveSensitivity.ValueChanged += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadMouseMoveSensitivity = slider_SettingsKeypadMouseMoveSensitivity.Value;

                    //Save changes to Json file
                    JsonSaveObject(selectedProfile, GenerateJsonNameKeypadMapping(selectedProfile));

                    textblock_SettingsKeypadMouseMoveSensitivity.Text = textblock_SettingsKeypadMouseMoveSensitivity.Tag + ": " + selectedProfile.KeypadMouseMoveSensitivity.ToString("0.00");
                };

                //Media settings
                combobox_ShortcutMuteFunction.SelectionChanged += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutMuteFunction", combobox_ShortcutMuteFunction.SelectedIndex.ToString());
                };

                slider_SettingsMediaVolumeStep.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsMediaVolumeStep.Text = textblock_SettingsMediaVolumeStep.Tag.ToString() + slider_SettingsMediaVolumeStep.Value.ToString();
                    Setting_Save(vConfigurationDirectXInput, "MediaVolumeStep", slider_SettingsMediaVolumeStep.Value.ToString());
                };
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to save the application settings: " + ex.Message);
            }
        }
Exemplo n.º 14
0
        //Save - Monitor Application Settings
        void Settings_Save()
        {
            try
            {
                cb_SettingsShortcutDisconnectBluetooth.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutDisconnectBluetooth", cb_SettingsShortcutDisconnectBluetooth.IsChecked.ToString());
                };

                cb_SettingsExclusiveGuide.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ExclusiveGuide", cb_SettingsExclusiveGuide.IsChecked.ToString());
                };

                cb_SettingsWindowsStartup.Click += (sender, e) => { ManageShortcutStartup(); };

                //Battery settings
                cb_SettingsBatteryShowIconLow.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "BatteryShowIconLow", cb_SettingsBatteryShowIconLow.IsChecked.ToString());

                    //Check all controllers for low battery level
                    CheckAllControllersLowBattery();
                };

                cb_SettingsBatteryShowPercentageLow.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "BatteryShowPercentageLow", cb_SettingsBatteryShowPercentageLow.IsChecked.ToString());

                    //Check all controllers for low battery level
                    CheckAllControllersLowBattery();
                };

                cb_SettingsBatteryPlaySoundLow.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "BatteryPlaySoundLow", cb_SettingsBatteryPlaySoundLow.IsChecked.ToString());
                };

                //Controller settings
                slider_ControllerIdleDisconnectMin.ValueChanged += (sender, e) =>
                {
                    string controllerIdleDisconnectMinString = slider_ControllerIdleDisconnectMin.Value.ToString();
                    Setting_Save(vConfigurationDirectXInput, "ControllerIdleDisconnectMin", controllerIdleDisconnectMinString);
                    textblock_ControllerIdleDisconnectMin.Text = textblock_ControllerIdleDisconnectMin.Tag + ": " + controllerIdleDisconnectMinString + " minutes";
                };

                colorpicker_Controller0.SelectedColorChanged += async(Color color) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ControllerColor0", color.ToString());
                    ControllerOutput(vController0, false, false);
                    App.vWindowOverlay.stackpanel_Battery_Warning_Controller1_Color.Background = new BrushConverter().ConvertFrom(color.ToString()) as SolidColorBrush;
                    await NotifyCtrlUISettingChanged("ControllerColor");
                };

                colorpicker_Controller1.SelectedColorChanged += async(Color color) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ControllerColor1", color.ToString());
                    ControllerOutput(vController1, false, false);
                    App.vWindowOverlay.stackpanel_Battery_Warning_Controller2_Color.Background = new BrushConverter().ConvertFrom(color.ToString()) as SolidColorBrush;
                    await NotifyCtrlUISettingChanged("ControllerColor");
                };

                colorpicker_Controller2.SelectedColorChanged += async(Color color) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ControllerColor2", color.ToString());
                    ControllerOutput(vController2, false, false);
                    App.vWindowOverlay.stackpanel_Battery_Warning_Controller3_Color.Background = new BrushConverter().ConvertFrom(color.ToString()) as SolidColorBrush;
                    await NotifyCtrlUISettingChanged("ControllerColor");
                };

                colorpicker_Controller3.SelectedColorChanged += async(Color color) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ControllerColor3", color.ToString());
                    ControllerOutput(vController3, false, false);
                    App.vWindowOverlay.stackpanel_Battery_Warning_Controller4_Color.Background = new BrushConverter().ConvertFrom(color.ToString()) as SolidColorBrush;
                    await NotifyCtrlUISettingChanged("ControllerColor");
                };

                cb_ControllerShowDebugInformation.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShowDebugInformation", cb_ControllerShowDebugInformation.IsChecked.ToString());
                };

                //Shortcut settings
                cb_SettingsShortcutLaunchCtrlUI.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutLaunchCtrlUI", cb_SettingsShortcutLaunchCtrlUI.IsChecked.ToString());
                };

                cb_SettingsShortcutLaunchKeyboardController.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutLaunchKeyboardController", cb_SettingsShortcutLaunchKeyboardController.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutAltEnter.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutAltEnter", cb_SettingsShortcutAltEnter.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutAltF4.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutAltF4", cb_SettingsShortcutAltF4.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutAltTab.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutAltTab", cb_SettingsShortcutAltTab.IsChecked.ToString());
                    if (cb_SettingsShortcutAltTab.IsChecked == true)
                    {
                        Setting_Save(vConfigurationDirectXInput, "ShortcutWinTab", "False");
                        cb_SettingsShortcutWinTab.IsChecked = false;
                    }
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutWinTab.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutWinTab", cb_SettingsShortcutWinTab.IsChecked.ToString());
                    if (cb_SettingsShortcutWinTab.IsChecked == true)
                    {
                        Setting_Save(vConfigurationDirectXInput, "ShortcutAltTab", "False");
                        cb_SettingsShortcutAltTab.IsChecked = false;
                    }
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutScreenshot.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutScreenshot", cb_SettingsShortcutScreenshot.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                cb_SettingsShortcutMediaPopup.Click += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "ShortcutMediaPopup", cb_SettingsShortcutMediaPopup.IsChecked.ToString());
                    await NotifyCtrlUISettingChanged("Shortcut");
                };

                //Keyboard settings
                slider_KeyboardOpacity.ValueChanged += (sender, e) =>
                {
                    textblock_KeyboardOpacity.Text = textblock_KeyboardOpacity.Tag + ": " + slider_KeyboardOpacity.Value.ToString("0.00") + "%";
                    Setting_Save(vConfigurationDirectXInput, "KeyboardOpacity", slider_KeyboardOpacity.Value.ToString("0.00"));
                    App.vWindowKeyboard.UpdatePopupOpacity(false);
                };

                cb_SettingsKeyboardCloseNoController.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "KeyboardCloseNoController", cb_SettingsKeyboardCloseNoController.IsChecked.ToString());
                };

                cb_SettingsKeyboardResetPosition.Click += (sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "KeyboardResetPosition", cb_SettingsKeyboardResetPosition.IsChecked.ToString());
                };

                combobox_KeyboardLayout.SelectionChanged += async(sender, e) =>
                {
                    Setting_Save(vConfigurationDirectXInput, "KeyboardLayout", combobox_KeyboardLayout.SelectedIndex.ToString());
                    await App.vWindowKeyboard.UpdateKeyboardLayout();
                };

                slider_SettingsMouseMoveSensitivity.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsMouseMoveSensitivity.Text = textblock_SettingsMouseMoveSensitivity.Tag.ToString() + Convert.ToInt32(slider_SettingsMouseMoveSensitivity.Value);
                    Setting_Save(vConfigurationDirectXInput, "MouseMoveSensitivity", Convert.ToInt32(slider_SettingsMouseMoveSensitivity.Value).ToString());
                };

                slider_SettingsMouseScrollSensitivity.ValueChanged += (sender, e) =>
                {
                    textblock_SettingsMouseScrollSensitivity.Text = textblock_SettingsMouseScrollSensitivity.Tag.ToString() + Convert.ToInt32(slider_SettingsMouseScrollSensitivity.Value);
                    Setting_Save(vConfigurationDirectXInput, "MouseScrollSensitivity", Convert.ToInt32(slider_SettingsMouseScrollSensitivity.Value).ToString());
                };

                //Keypad settings
                slider_KeypadOpacity.ValueChanged += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadOpacity = slider_KeypadOpacity.Value;

                    //Save changes to Json file
                    JsonSaveObject(vDirectKeypadMapping, "DirectKeypadMapping");

                    textblock_KeypadOpacity.Text = textblock_KeypadOpacity.Tag + ": " + slider_KeypadOpacity.Value.ToString("0.00") + "%";
                    App.vWindowKeypad.UpdateKeypadOpacity();
                };

                combobox_KeypadDisplayStyle.SelectionChanged += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadDisplayStyle = combobox_KeypadDisplayStyle.SelectedIndex;

                    //Save changes to Json file
                    JsonSaveObject(vDirectKeypadMapping, "DirectKeypadMapping");

                    App.vWindowKeypad.UpdateKeypadStyle();
                };

                slider_KeypadDisplaySize.ValueChanged += async(sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.KeypadDisplaySize = Convert.ToInt32(slider_KeypadDisplaySize.Value);

                    //Save changes to Json file
                    JsonSaveObject(vDirectKeypadMapping, "DirectKeypadMapping");

                    textblock_KeypadDisplaySize.Text = textblock_KeypadDisplaySize.Tag + ": " + selectedProfile.KeypadDisplaySize + "%";

                    //Update the keypad size
                    double keypadHeight = App.vWindowKeypad.UpdateKeypadSize();

                    //Notify - Fps Overlayer keypad size changed
                    await NotifyFpsOverlayerKeypadSizeChanged(Convert.ToInt32(keypadHeight));
                };

                slider_KeypadRepeatIntervalMs.ValueChanged += (sender, e) =>
                {
                    KeypadMapping selectedProfile = (KeypadMapping)combobox_KeypadProcessProfile.SelectedItem;
                    selectedProfile.ButtonRepeatIntervalMs = Convert.ToInt32(slider_KeypadRepeatIntervalMs.Value);

                    //Save changes to Json file
                    JsonSaveObject(vDirectKeypadMapping, "DirectKeypadMapping");

                    textblock_KeypadRepeatIntervalMs.Text = textblock_KeypadRepeatIntervalMs.Tag + ": " + selectedProfile.ButtonRepeatIntervalMs + "ms";
                };
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to save the application settings: " + ex.Message);
            }
        }