コード例 #1
0
 public void EntryPoint(bool isDown, ref bool isRun)
 {
     if (!_isMove && isDown)
     {
         if (!Enable)
         {
             return;
         }
         var cursorPos = Cursor.Position;
         _windowMove = SystemWindow.WindowFromPoint(cursorPos).RootWindow();
         var filter = SettingsLayer.GetWindowConfig(_windowMove.ProcessName, "");
         if (filter.XMoveStatus == FilterConfig.XMoveMethod.Off)
         {
             return;
         }
         _offsetMove    = _windowMove.OffsetFromPoint(cursorPos);
         Cursor.Current = Cursors.SizeAll;
         isRun          = true;
     }
     if (_isMove && !isDown)
     {
         Cursor.Current = Cursors.Default;
     }
     _isMove = isDown;
 }
コード例 #2
0
        public void EntryPoint(bool isDown, ref bool isRun)
        {
            if (!Enable)
            {
                return;
            }
            var fWindow = SystemWindow.ForegroundWindow().FocusedWindow();

            if (!(fWindow.KeyboardLayout.Equals(new CultureInfo("ru-RU")) ||
                  fWindow.KeyboardLayout.Equals(new CultureInfo("en-US"))))
            {
                return;
            }
            var filter = SettingsLayer.GetWindowConfig(fWindow.ProcessName, fWindow.ClassName);

            if (filter.TextSwitchStatus == FilterConfig.TextSwitchMethod.Off ||
                filter.TextReplaceStatus == TextReplaceMethod.Off)
            {
                return;
            }
            if (SettingsLayer._copyPaster.NotUseClipboardForTextBoxAndRichTextBox)
            {
                foreach (
                    var word in fWindow.ClassName.Split(new char[] { ' ', '.' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    if (word.Equals("RichEdit20W", StringComparison.CurrentCultureIgnoreCase))
                    {
                        filter.TextReplaceStatus = TextReplaceMethod.RichTextBox;
                        break;
                    }
                    if (word.Equals("Edit", StringComparison.CurrentCultureIgnoreCase))
                    {
                        filter.TextReplaceStatus = TextReplaceMethod.TextBox;
                        break;
                    }
                    if (word.Equals("TEdit", StringComparison.CurrentCultureIgnoreCase))
                    {
                        filter.TextReplaceStatus = TextReplaceMethod.TextBox;
                        break;
                    }
                }
            }

            isRun = true;

            CopyPaster copyPaster = new CopyPaster(fWindow, filter.TextReplaceStatus);
            string     text       = "";

            copyPaster.BackupClipboard();
            if (copyPaster.CopyText(ref text))
            {
                if (!string.IsNullOrWhiteSpace(text))
                {
                    text = TextConverter(text, fWindow.KeyboardLayout);
                    copyPaster.PasteText(text);
                }
                copyPaster.RestoreClipboard();
            }
        }