Example #1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            ChangeCase.EnableShortCuts(false);

            var config = Settings.Default;

            config.enableShortCuts               = CbxEnableShortcuts.Checked;
            config.firstItemInContextMenu        = CbxFirstInContenxtMenu.Checked;
            config.showChangeCaseOptionInHomeTab = CbxShowInHome.Checked;
            config.showChangeCaseTab             = CbxShowInHome.Checked;

            config.ScUpperCase     = CbUc.SelectedItem.ToString();
            config.ScLowerCase     = CbLc.SelectedItem.ToString();
            config.ScSentenceCase  = CbSc.SelectedItem.ToString();
            config.ScProperCase    = CbPc.SelectedItem.ToString();
            config.ScToggleCase    = CbTc.SelectedItem.ToString();
            config.ScAlternateCase = CbAc.SelectedItem.ToString();

            config.Save();

            ChangeCase.EnableShortCuts(config.enableShortCuts);

            MessageBox.Show(Resources.SettingsSaved, Resources.ProductName);
            ChangeCase.RefreshControls();
            Close();
        }
Example #2
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));
        }
Example #3
0
        internal void RefreshTabControls()
        {
            var config = Settings.Default;

            CbEnableShortcuts.Checked        = config.enableShortCuts;
            CbFirstItemInContextMenu.Checked = config.firstItemInContextMenu;
            ChangeCase.ShowChangeCaseTabInRibbon(config.showChangeCaseTab);
            ChangeCase.ShowChangeCaseOptionInHomeTab(config.showChangeCaseOptionInHomeTab);
        }
Example #4
0
        private void BtnDefault_Click(object sender, EventArgs e)
        {
            var restoreConfirmation = MessageBox.Show(Resources.MyCcSettings_BtnDefault_Click_Confirmation, Resources.WindowTitle, MessageBoxButtons.YesNo);

            if (restoreConfirmation != DialogResult.Yes)
            {
                return;
            }
            ChangeCase.RestoreSettings();
            MessageBox.Show(Resources.SettingsRestored, Resources.WindowTitle);
            ChangeCase.RefreshControls();
            Close();
        }
Example #5
0
 private void AlternateCase_Click(object sender, RibbonControlEventArgs e)
 {
     ChangeCase.Cc(AppStrings.AlternateCase);
 }
Example #6
0
 private void ToggleCase_Click(object sender, RibbonControlEventArgs e)
 {
     ChangeCase.Cc(AppStrings.ToggelCase);
 }
Example #7
0
 private void ProperCase_Click(object sender, RibbonControlEventArgs e)
 {
     ChangeCase.Cc(AppStrings.ProperCase);
 }
Example #8
0
 private void CbFirst_Click(object sender, RibbonControlEventArgs e)
 {
     ChangeCase.FirstInMenu(CbFirstItemInContextMenu.Checked);
 }
Example #9
0
 private void CbEnableShortcuts_Click(object sender, RibbonControlEventArgs e)
 {
     ChangeCase.EnableSc(CbEnableShortcuts.Checked);
 }
Example #10
0
 private void BtnHideTab_Click(object sender, RibbonControlEventArgs e)
 {
     ChangeCase.ShowChangeCaseTabInRibbon(false);
 }