Пример #1
0
        public StateManager(Form1 Toolbar, ShortcutKeyWorker shortCutKeyWorker, FormsEyeXHost EyeXHost)
        {
            eyeXHost = EyeXHost;
            toolbar  = Toolbar;

            SystemFlags.currentState = SystemState.Wait;

            fixationWorker = new FixationDetection(eyeXHost, 25);

            scrollWorker = new ScrollControl(200, 5, 50, 20, eyeXHost);

            SystemFlags.currentState = SystemState.Wait;

            SystemFlags.hasSelectedButtonColourBeenReset = true;

            // Instantiate the ZoomLens, this is the form that is given to magnifier
            zoomer = new ZoomLens();
            // Instantiate the magnifier, this is Sam Medlocks refactored magnifier
            // This calls the low-level API
            magnifier = CreateMagnifier();

            //Console.WriteLine(scrollWorker.deadZoneRect.LeftBound + "," + scrollWorker.deadZoneRect.RightBound + "," + scrollWorker.deadZoneRect.TopBound + "," + scrollWorker.deadZoneRect.BottomBound);

            this.shortCutKeyWorker = shortCutKeyWorker;

            Run();
        }
Пример #2
0
        public Form1()
        {
            InitializeComponent();
            contextMenu        = new ContextMenu();
            menuItemExit       = new MenuItem();
            menuItemStartOnOff = new MenuItem();
            settingsItem       = new MenuItem();
            initMenuItem();

            highlightPannerList = new List <Panel>();
            highlightPannerList.Add(pnlHiLteRightClick);
            highlightPannerList.Add(pnlHighLightSingleLeft);
            highlightPannerList.Add(pnlHighLightDoubleClick);
            //highlightPannerList.Add(pnlHighLightDragAndDrop);
            highlightPannerList.Add(pnlHighLightScrol);
            highlightPannerList.Add(pnlHighLightKeyboard);
            highlightPannerList.Add(pnlHighLightSettings);
            setButtonPanelHight(highlightPannerList);


            eyeXHost = new FormsEyeXHost();
            eyeXHost.Start();

            keyboardInitializer    = new OptiKey.GazeKeyboard();
            keyboard               = keyboardInitializer.CreateKeyboard();
            keyboard.ShowInTaskbar = false;

            connectBehaveMap();
        }
        public ZoomMagnifier(Form displayform, Point fixationPoint)
        {
            ZOOM_MAX      = Program.readSettings.maxZoom;               //Max zoom amount
            Magnification = DO_ZOOM ? 1 : Program.readSettings.maxZoom; //Set magnification to the max if not zooming
            form          = displayform;
            form.TopMost  = true;
            updateTimer   = new Timer();

            FixationPoint = fixationPoint;
            InitLens();

            //Event handlers
            form.Resize      += new EventHandler(form_Resize);
            form.FormClosing += new FormClosingEventHandler(form_FormClosing);
            updateTimer.Tick += new EventHandler(timer_Tick);

            updateTimer.Interval = UPDATE_SPEED;
            updateTimer.Enabled  = false;
            Offset          = new Point(0, 0);
            SecondaryOffset = new Point(0, 0);

            eyeXHost = new FormsEyeXHost();
            eyeXHost.Start();
            gazeStream       = eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            gazeStream.Next += (s, e) => SetLook(e.X, e.Y);

            form.Left   = -4000;
            form.Top    = -5000;
            form.Width  = 1;
            form.Height = 1;
        }
Пример #4
0
        public FixationDetection(FormsEyeXHost EyeXHost)
        {
            customfixStream = new CustomFixationDataStream(EyeXHost);

            customfixStream.next += detectFixation;

            //Timer to run selected interaction with OS\aapplication user is trying to interact with, once gaze is longer than specified limit
            //the delegate that has been set in SelectedFixationAcion is run but the timer elapsed event.
            FixationDetectionTimeLength = 1500;
            FixationExtensionBuffer     = 100;

            FixationTimeOutLength = 7000;

            timeOutTimer = new Timer(FixationTimeOutLength);

            timeOutTimer.AutoReset = false;

            timeOutTimer.Elapsed += fixationTimeOut;


            fixationTimer = new System.Timers.Timer(FixationDetectionTimeLength);

            fixationTimer.AutoReset = false;

            fixationTimer.Elapsed += runActionWhenTimerReachesLimit;
        }
Пример #5
0
        public UserPresenceForm()
        {
            // Initialize components.
            InitializeComponent();

            // Create the EyeX host.
            _eyeXHost = new FormsEyeXHost();
        }
Пример #6
0
        public Settings(Form1 form1, FormsEyeXHost EyeXHost)
        {
            eyeXHost = EyeXHost;
            InitializeComponent();
            InitSidebarActions();
            pnlPageKeyboard.Hide();
            pnlCrosshairPage.Hide();
            pnlRearrange.Hide();
            pnlZoomSettings.Hide();
            pnlDefaultConfirm.Hide();
            ChangeButtonColor(btnGeneralSetting, true, true);
            this.form1 = form1;
            //This code make setting form full screen
            FormBorderStyle = FormBorderStyle.None;
            WindowState     = FormWindowState.Maximized;
            //End
            controlRelocateAndResize();
            //tabControlMain.Size = ReletiveSize.TabControlSize;
            onOff = new bool[5];
            for (int i = 0; i < onOff.Length; i++)
            {
                onOff[i] = false;
            }

            shownPanel = pnlGeneral;

            //Store reference to short cut assignment panels in a list so they can be iterated over and set their on screen positions relative form size.
            fKeyPannels = new List <Panel>()
            {
                pnlLeftClick, pnlRightClick, pnlDoubleClick, pnlScroll, pnlMic
            };                                                                                                 // pnlDragAndDrop };
            //Set panel positions.
            setFkeyPanelWidth(fKeyPannels);

            //set initial values of mapped keys to on screen label.
            lbDouble.Text       = form1.FKeyMapDictionary[ActionToBePerformed.DoubleClick];
            lbRight.Text        = form1.FKeyMapDictionary[ActionToBePerformed.RightClick];
            lbLeft.Text         = form1.FKeyMapDictionary[ActionToBePerformed.LeftClick];
            lbScroll.Text       = form1.FKeyMapDictionary[ActionToBePerformed.Scroll];
            lbMicOn.Text        = form1.FKeyMapDictionary[ActionToBePerformed.MicInput];
            lbMicOff.Text       = form1.FKeyMapDictionary[ActionToBePerformed.MicInputOff];
            WaitForUserKeyPress = false;

            stickyLeft = Program.readSettings.stickyLeftClick;
            if (stickyLeft)
            {
                buttonStickyLeftClick.BackColor = Color.White;
            }

            selectionFeedback = Program.readSettings.selectionFeedback;
            if (selectionFeedback)
            {
                btnFeedback.BackColor = Color.White;
            }

            form1.LowLevelKeyBoardHook.OnKeyPressed += GetKeyPress;
        }
Пример #7
0
        static void Main()
        {
            using (EyeXHost = new FormsEyeXHost())
            {
                // Start the EyeX host.
                EyeXHost.Start();

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new PannableForm());
            }
        }
Пример #8
0
        public ZoomLens(FixationDetection FixDet, FormsEyeXHost EyeXHost)
        {
            InitializeComponent();
            lensPoint            = new Point();
            this.Width           = ZOOMLENS_SIZE;
            this.Height          = ZOOMLENS_SIZE;
            offScreenBitmap      = new Bitmap(this.Width, this.Height);
            zoomedScreenshot     = new Bitmap(this.Width / ZOOMLEVEL, this.Height / ZOOMLEVEL);
            mainCanvas           = this.CreateGraphics();
            offScreenGraphics    = Graphics.FromImage(offScreenBitmap);
            graphics             = Graphics.FromImage(zoomedScreenshot);
            this.FormBorderStyle = FormBorderStyle.None;//removes window borders from form
            fixdet = FixDet;

            gazeHighlight = new GazeHighlight(FixDet, offScreenGraphics, EHighlightShaderType.RedToGreen, this);
        }
Пример #9
0
        //Constructor
        public CustomFixationDataStream(FormsEyeXHost EyeXHost)
        {
            gazeStream = EyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            //Create gate points event handler delegate
            EventHandler <GazePointEventArgs> gazeDel = new EventHandler <GazePointEventArgs>(updateGazeCoodinates);

            //register delegate with gaze data stream next event.
            gazeStream.Next += gazeDel;

            gPAverage = new GazePoint();

            xBuffer = new double[bufferSize];
            yBuffer = new double[bufferSize];

            fixationState = EFixationStreamEventType.Waiting;
        }
Пример #10
0
        public Settings(Form1 form1, FormsEyeXHost EyeXHost)
        {
            eyeXHost = EyeXHost;
            InitializeComponent();
            pnlPageKeyboard.Hide();
            ChangeButtonColor(btnGeneralSetting, true, true);
            this.form1 = form1;
            //This code make setting form full screen
            FormBorderStyle = FormBorderStyle.None;
            WindowState     = FormWindowState.Maximized;
            //End
            controlRelocateAndResize();
            //tabControlMain.Size = ReletiveSize.TabControlSize;
            onOff = new bool[5];
            for (int i = 0; i < onOff.Length; i++)
            {
                onOff[i] = false;
            }
            pnlGeneralIsShow  = true;
            pnlKeyboardIsShow = false;

            //Set Short cut key assignment panel to the viable width of the form
            pnlPageKeyboard.Width = ValueNeverChange.SCREEN_SIZE.Width - 20;

            //Set feed back label to the center of the screen.
            lbFKeyFeedback.Location = new Point((pnlPageKeyboard.Width / 2) - (lbFKeyFeedback.Width / 2), lbFKeyFeedback.Location.Y);
            //Store reference to short cut assignment panels in a list so they can be iterated over and set their on screen positions relative form size.
            fKeyPannels = new List <Panel>()
            {
                pnlLeftClick, pnlRightClick, pnlDoubleClick, pnlScroll
            };                                                                                         // pnlDragAndDrop };
            //Set panel positions.
            setFkeyPanelWidth(fKeyPannels);

            //set initial values of mapped keys to on screen label.
            lbDouble.Text = form1.FKeyMapDictionary[ActionToBePerformed.DoubleClick];
            lbRight.Text  = form1.FKeyMapDictionary[ActionToBePerformed.RightClick];
            lbLeft.Text   = form1.FKeyMapDictionary[ActionToBePerformed.LeftClick];
            lbScroll.Text = form1.FKeyMapDictionary[ActionToBePerformed.Scroll];

            WaitForUserKeyPress = false;

            form1.LowLevelKeyBoardHook.OnKeyPressed += GetKeyPress;
        }
Пример #11
0
        //Constructor
        public CustomFixationDataStream(FormsEyeXHost EyeXHost)
        {
            //Calculate the amount of pixels away from the top of the screen to set cut of for top of screen threshold adjustment.
            yFixationScreenBoundary = Constants.PRIMARY_SCREEN.Height * (screenBoudaryCutOffPercent / 100);

            gazeStream = EyeXHost.CreateGazePointDataStream(GazePointDataMode.Unfiltered);
            //Create gate points event handler delegate
            EventHandler <GazePointEventArgs> gazeDel = new EventHandler <GazePointEventArgs>(updateGazeCoodinates);

            //register delegate with gaze data stream next event.
            gazeStream.Next += gazeDel;

            gPAverage = new GazePoint();

            xBuffer = new double[bufferSize];
            yBuffer = new double[bufferSize];

            fixationState  = EFixationStreamEventType.Waiting;
            ZoomerFixation = false;
        }
Пример #12
0
        public StateManager(Form1 Toolbar, ShortcutKeyWorker shortCutKeyWorker, FormsEyeXHost EyeXHost)
        {
            eyeXHost = EyeXHost;
            toolbar  = Toolbar;

            SystemFlags.currentState = SystemState.Wait;

            fixationWorker = new FixationDetection(eyeXHost);

            scrollWorker = new ScrollControl(200, 5, 50, 20, eyeXHost);

            SystemFlags.currentState = SystemState.Wait;

            SystemFlags.hasSelectedButtonColourBeenReset = true;

            zoomer = new ZoomLens(fixationWorker, eyeXHost);

            Console.WriteLine(scrollWorker.deadZoneRect.LeftBound + "," + scrollWorker.deadZoneRect.RightBound + "," + scrollWorker.deadZoneRect.TopBound + "," + scrollWorker.deadZoneRect.BottomBound);
            corner = new Corner();

            this.shortCutKeyWorker = shortCutKeyWorker;

            Run();
        }
Пример #13
0
        //Constructor
        public ScrollControl(int scrollStepTimerDuration, int InitialScrollScalarValue, int deadZoneHorizontalPercent, int deadZoneVerticalPercent, FormsEyeXHost EyeXHost)
        {
            //set scroll step timer duration.
            ScrollStepTimerDuration = scrollStepTimerDuration;

            //Connect to eyeX engine gaze stream.
            gazeStream = EyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);

            //Create gate points event handler delegate
            EventHandler <GazePointEventArgs> gazeDel = new EventHandler <GazePointEventArgs>(updateGazeCoodinates);

            //register delegate with gaze data stream next event.
            gazeStream.Next += gazeDel;

            //set up scroll step timer
            scrollStepTimer = new Timer(ScrollStepTimerDuration);
            //Set to auto reset so that it fires events continuously at the ScrollStepTimerDuration
            scrollStepTimer.AutoReset = true;

            //Register scroll method with timer elapsed event.
            scrollStepTimer.Elapsed += scroll;

            //Set initial deadzone size of screen percent.
            DeadZoneHorizontalPercent = deadZoneHorizontalPercent;
            DeadZoneVerticalPercent   = deadZoneVerticalPercent;

            //run SetDeadZoneBounds method to set up the deadZoneRect field initially.
            SetDeadZoneBounds();

            //pass in ScrollscalarValue, this will be set by the users saved settings.
            ScrollScalarValue = InitialScrollScalarValue;
        }
 public FixationDetection(FormsEyeXHost EyeXHost, int bufferSize) : this(EyeXHost)
 {
     pointSmootherBufferSize = bufferSize;
 }
Пример #15
0
        public ShortcutKeyWorker(KeyboardHook KeyboardObserver, Dictionary <ActionToBePerformed, String> KeyAssignments, FormsEyeXHost EyeXHost)//, Dictionary<EToolBarFunction, String> KeyAssignments)
        {
            keyBoardHook = KeyboardObserver;
            keyBoardHook.OnKeyPressed += RunKeyFunction;

            keyAssignments = KeyAssignments;

            //Connect to eyeX engine gaze stream.
            gazeStream = EyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);
            //Create gate points event handler delegate
            gazeDel = new EventHandler <GazePointEventArgs>(updateGazeCoodinates);
            //register delegate with gaze data stream next event.
            gazeStream.Next += gazeDel;
        }