コード例 #1
0
        public MenuWindow()
        {
            Send.AddWindow(this);

            InitializeComponent();

            Open.Content = InputService.Current.IsKeyboardShowen ? "Close" : "Open";

            Loaded += delegate
            {
                Top  = SystemParameters.WorkArea.Height - ActualHeight + 1;
                Left = SystemParameters.WorkArea.Width - ActualWidth;
                MenuOn.Begin();
            };

            Deactivated += delegate
            {
                Close();
            };

            MenuOn             = (Storyboard)FindResource("MenuOn");
            MenuOff            = (Storyboard)FindResource("MenuOff");
            MenuOff.Completed += delegate
            {
                base.Close();
            };
        }
コード例 #2
0
        void Window_Loaded(object sender, RoutedEventArgs e)
        {
            App.Current.MainWindow = this;

            Send.AddWindow(this);

            Closed += MainWindow_Closed;

            InputService.Init();

            NotifyIcon = new NotifyIcon();
            using (var stream = Util.GetResourceStream("Resources/icon.ico"))
                NotifyIcon.Icon = new System.Drawing.Icon(stream);
            NotifyIcon.Visible     = true;
            NotifyIcon.MouseClick += delegate
            {
                if (MenuWindow == null)
                {
                    OpenMenu();
                }
                else
                {
                    MenuWindow.Close();
                }
            };
            NotifyIcon.Text = "NeuralAction";

            InputService.Current.Owner = this;
            InputService.Current.Start();

#if DEBUG
            InputDebugWindow.Default.Show();
#endif
        }
コード例 #3
0
        public KeyWindow(InputService service)
        {
            Send.AddWindow(this);
            this.service = service;

            InitializeComponent();

            Loaded += delegate
            {
                Keyboard.KeymapChange(Keyboard.GetKeymapArray(Keyboard.CurrentLanguage));
                UpdateScreen();
                WinApi.NotWindowsFocus(this);
            };

            Keyboard.Closed += delegate
            {
                base.Close();
            };
        }
コード例 #4
0
        public IconGadget()
        {
            Send.AddWindow(this);

            InitializeComponent();

            if (App.Current.MainWindow != this)
            {
                Owner = App.Current.MainWindow;
            }

            Loaded += delegate
            {
                var scr      = InputService.Current.TargetScreen.WorkingArea;
                var wpfScale = InputService.Current.WpfScale;
                Left = (scr.Left + scr.Width) / wpfScale - ActualWidth - 25;
                Top  = (scr.Top + scr.Height) / wpfScale - ActualHeight - 25;
            };
        }
コード例 #5
0
        public CalibrateWindow(EyeGazeCalibrater calib)
        {
            Send.AddWindow(this);

            InitializeComponent();

            calib.Calibarting += Calib_Calibarting;
            calib.Calibrated  += Calib_Calibrated;

            Owner       = App.Current.MainWindow;
            WindowState = WindowState.Maximized;

            Loaded += delegate
            {
                var scale = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice.M11;
                scrScale = scale;
                var scr = InputService.Current.TargetScreen.Bounds;
                var mw  = (scr.Width / scale - ActualWidth) / 2;
                var mh  = (scr.Height / scale - ActualHeight) / 2;
                Grid_Background.Margin = new Thickness(mw, mh, mw, mh);
            };
        }