示例#1
0
 private void Form1_Deactivate(object sender, EventArgs e)
 {
     if (SettingsStorage.getInstance().getSettings().AutoHide)
     {
         Hide();
     }
 }
示例#2
0
        public void loadSettings()
        {
            var settings = SettingsStorage.getInstance().getSettings();

            CBautoClose.Checked        = settings.AutoHide;
            CBselectTextOnOpen.Checked = settings.SelectWordInOriginalProgram;
            CBconfirmDelete.Checked    = settings.ConfirmDelete;
        }
示例#3
0
        public SettingsControl()
        {
            InitializeComponent();

            loadSettings();
            SettingsStorage.getInstance().settingsUpdated += (_) => {
                loadSettings();
            };
        }
示例#4
0
        private void CBconfirmDelete_CheckedChanged(object sender, EventArgs e)
        {
            var settings = SettingsStorage.getInstance().getSettings();

            if (settings.ConfirmDelete != CBconfirmDelete.Checked)
            {
                settings.ConfirmDelete = CBconfirmDelete.Checked;
                SettingsStorage.getInstance().update(settings);
            }
        }
示例#5
0
        private void CBautoClose_CheckedChanged(object sender, EventArgs e)
        {
            var settings = SettingsStorage.getInstance().getSettings();

            if (settings.AutoHide != CBautoClose.Checked)
            {
                settings.AutoHide = CBautoClose.Checked;
                SettingsStorage.getInstance().update(settings);
            }
        }
示例#6
0
        private void CBselectTextOnOpen_CheckedChanged(object sender, EventArgs e)
        {
            var settings = SettingsStorage.getInstance().getSettings();

            if (settings.SelectWordInOriginalProgram != CBselectTextOnOpen.Checked)
            {
                settings.SelectWordInOriginalProgram = CBselectTextOnOpen.Checked;
                SettingsStorage.getInstance().update(settings);
            }
        }
 private void Pdelete_Click(object sender, EventArgs e)
 {
     if (SettingsStorage.getInstance().getSettings().ConfirmDelete)
     {
         var confirmResult = MessageBox.Show("Are you sure to delete this item ??",
                                             "Confirm Delete!!",
                                             MessageBoxButtons.YesNo);
         ParentForm.Show();
         if (confirmResult == DialogResult.Yes)
         {
             WordStorage.getInstance().removeWord(Id);
         }
     }
     else
     {
         WordStorage.getInstance().removeWord(Id);
     }
 }
示例#8
0
        private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            int  vkCode    = Marshal.ReadInt32(lParam);
            Keys key       = (Keys)vkCode;
            bool isKeyDown = (IntPtr)WM_KEYDOWN == wParam;

            if (key == Keys.LWin)
            {
                isWindowsPressed = isKeyDown;
            }
            if (isWindowsPressed && key == Keys.J && isKeyDown)
            {
                GetCaretPositionAgain();


                Point caretPosition = new Point();
                var   guiInfo       = GetCaretPosition();
                ClientToScreen(guiInfo.hwndCaret, out caretPosition);

                caretPosition.X = caretPosition.X + (int)guiInfo.rcCaret.Left + 25;
                caretPosition.Y = caretPosition.Y + (int)guiInfo.rcCaret.Bottom + 25;


                if (SettingsStorage.getInstance().getSettings().SelectWordInOriginalProgram)
                {
                    GetLastWord((lastWord) => {
                        runOnGui(() => {
                            onCombination(lastWord, caretPosition);
                        });
                    });
                }
                else
                {
                    runOnGui(() => {
                        onCombination("", caretPosition);
                    });
                }


                //GetLastWord();

                //runOnGui(() => {
                //    //Console.WriteLine("Do the thing!");
                //    //inputSimulator.Keyboard.KeyUp(WindowsInput.Native.VirtualKeyCode.LWIN);
                //    //SendKeys.SendWait("Hello");
                //    //inputSimulator.Keyboard.TextEntry("You are doomed");
                //    //inputSimulator.Keyboard.KeyDown(WindowsInput.Native.VirtualKeyCode.LWIN);



                //    //var guiInfo = GetCaretPosition();
                //    //var word = GetLastWord(guiInfo.hwndActive);

                //    //Console.WriteLine(guiInfo.cbSize);

                //    //Point caretPosition = new Point();

                //    //System.Windows.Input.
                //    //System.Runtime.InteropServices.KeyInterop.
                //    //Console.WriteLine(caretPosition);
                //    //Console.WriteLine("name: " + GetActiveProcess());

                //});
                //SendKeys.Send("You are doomed");
            }



            return(CallNextHookEx(_hookID, nCode, wParam, lParam));
        }