Пример #1
0
 private void KeyboardFormClosed(object sender, FormClosedEventArgs e)
 {
     if (sniffer != null)
     {
         sniffer.KeyPressed -= ReceiveKeyPress;
         sniffer.DeactivateHook();
         sniffer = null;
     }
     KeyboardHelper.UnloadLayout();
 }
Пример #2
0
        private void StartCapture()
        {
            if (sniffer == null)
            {
                sniffer             = new KeySniffer(true);
                sniffer.KeyPressed += OnKeyPress;
            }

            sniffer.ActivateHook();
        }
Пример #3
0
        private void StartCapture()
        {
            if (this._sniffer == null)
            {
                this._sniffer             = new KeySniffer(true);
                this._sniffer.KeyPressed += OnKeyPress;
            }

            this._sniffer.ActivateHook();
        }
Пример #4
0
        public KeyboardForm()
        {
            FormToolTip = new ToolTip();

            InitializeComponent();
            FormsManager.RegisterMainForm(this);

            if (DpiInfo.Dpi < 96)
            {
                menu.Height = (int)(menu.Height * (96F / DpiInfo.Dpi));
                // Menu will always show even is fonts are set to less than 100%
            }
            else if (DpiInfo.Dpi > 96)
            {
                menu.Height = (int)(menu.Height * (DpiInfo.Dpi / 96F));
            }

            LoadUserSettings();

            ResizeToAspect();

            if (DpiInfo.Dpi != 96)
            {
                PositionKeyboardCombo();
            }

            // This needs to be done after location and size of this form are fully determined.
            FormsManager.OpenChildForms();

            lastSize = Size;

            GetKeyboardData();

            // Create event handlers
            ResizeEnd += KeyboardFormResizeEnd;
            KeyboardListCombo.SelectedIndexChanged += KeyboardListSelectedIndexChanged;

            MappingsManager.MappingsChanged         += OnMappingsChanged;
            UserColourSettingManager.ColoursChanged += OnColoursChanged;

            // Sniff for Caps/Num/Scroll lock keys being pressed while app doesn't have focus
            sniffer             = new KeySniffer();
            sniffer.KeyPressed += ReceiveKeyPress;
            sniffer.ActivateHook();

            Redraw();
        }