Beispiel #1
0
        public void Show()
        {
            if (Mag == null)
            {
                Mag    = new MagnifierForm();
                Window = new MagnifyingCursor(this);

                Settings.Listener.PropertyChanged += Listener_PropertyChanged;
                Settings.Listener.SettingChanged  += Listener_SettingChanged;
                Listener_SettingChanged(null, Settings.Current);
            }

            var scr = InputService.Current.TargetScreen.Bounds;

            Mag.Form.Width  = scr.Width;
            Mag.Form.Height = scr.Height;
            Mag.Form.Top    = scr.Top;
            Mag.Form.Left   = scr.Left;
            Mag.Show();

            Window.Left = InputService.Current.Cursor.Window.Left;
            Window.Top  = InputService.Current.Cursor.Window.Top;
            Window.Show();

            Mag.Magnifier.UpdateMaginifier();
            if (moveUpdater == null)
            {
                moveUpdater = new Thread(() =>
                {
                    while (true)
                    {
                        MoveUpdater_Tick(null, null);
                        Thread.Sleep(10);
                    }
                });
                moveUpdater.IsBackground = true;
                moveUpdater.Name         = "MagUpdate";
            }
            moveUpdater.Start();

            var cursor = InputService.Current.Cursor;

            cursor.Window.Visibility = Visibility.Collapsed;
            cursor.GazeTracked      += Cursor_GazeTracked;
            cursor.Clicked          += Cursor_Clicked;
            cursor.Released         += Cursor_Released;

            InputService.Current.KeyboardStartupOption = KeyboardStartupOption.CenterCursor;
            InputService.Current.KeyboardSize          = 1.0 / Settings.Current.MagnifyFactor * 1.25;

            GlobalKeyHook.Hook.KeyboardPressed += Hook_KeyboardPressed;

            IsShowed = true;
        }
Beispiel #2
0
        public void Dispose()
        {
            if (IsShowed)
            {
                Close();
            }

            Mag?.Dispose();
            Mag = null;

            Window?.Close();
            Window = null;

            Settings.Listener.PropertyChanged -= Listener_PropertyChanged;
            Settings.Listener.SettingChanged  -= Listener_SettingChanged;
        }