Exemple #1
0
        //Note that the custom code goes in this method the rest of the class stays the same.
        //It will trap if BOTH keys are pressed down.
        private static int HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode < 0)
            {
                return((int)CallNextHookEx(_hookId, nCode, wParam, lParam));
            }
            if (nCode != HcAction)
            {
                return((int)CallNextHookEx(_hookId, nCode, wParam, lParam));
            }
            var keyData       = (Keys)wParam;
            var keyDataString = keyData.ToString();
            var shortCutList  = new List <string>
            {
                Settings.Default.ScUpperCase,
                Settings.Default.ScLowerCase,
                Settings.Default.ScProperCase,
                Settings.Default.ScSentenceCase,
                Settings.Default.ScToggleCase,
                Settings.Default.ScAlternateCase
            };

            if (!shortCutList.Contains(keyData.ToString()))
            {
                return((int)CallNextHookEx(_hookId, nCode, wParam, lParam));
            }
            if (!BindingFunctions.IsKeyDown(Keys.ControlKey) || !BindingFunctions.IsKeyDown(Keys.ShiftKey) ||
                !BindingFunctions.IsKeyDown(keyData))
            {
                return((int)CallNextHookEx(_hookId, nCode, wParam, lParam));
            }
            if (keyDataString == Settings.Default.ScUpperCase)
            {
                ChangeCase.Cc(AppStrings.UpperCase);
            }
            else if (keyDataString == Settings.Default.ScLowerCase)
            {
                ChangeCase.Cc(AppStrings.LowerCase);
            }
            else if (keyDataString == Settings.Default.ScSentenceCase)
            {
                ChangeCase.Cc(AppStrings.SentenceCase);
            }
            else if (keyDataString == Settings.Default.ScProperCase)
            {
                ChangeCase.Cc(AppStrings.ProperCase);
            }
            else if (keyDataString == Settings.Default.ScToggleCase)
            {
                ChangeCase.Cc(AppStrings.ToggelCase);
            }
            else if (keyDataString == Settings.Default.ScAlternateCase)
            {
                ChangeCase.Cc(AppStrings.AlternateCase);
            }
            return((int)CallNextHookEx(_hookId, nCode, wParam, lParam));
        }
Exemple #2
0
 private void ToggleCase_Click(object sender, RibbonControlEventArgs e)
 {
     ChangeCase.Cc(AppStrings.ToggelCase);
 }
Exemple #3
0
 private void AlternateCase_Click(object sender, RibbonControlEventArgs e)
 {
     ChangeCase.Cc(AppStrings.AlternateCase);
 }
Exemple #4
0
 private void ProperCase_Click(object sender, RibbonControlEventArgs e)
 {
     ChangeCase.Cc(AppStrings.ProperCase);
 }