示例#1
0
        private XmlTextWriter _writer; // XML writer -- uses _fileNoExt.xml

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create a new logging object. Log will automatically be stored and uploaded periodically.
        /// Log consists of an xml file of movement data, quick feedback, daily feedback, and screenshots.
        /// </summary>
        public Logger(ref Preferences p)
        {
            _preferences = p;
            _screens = new List<Bitmap>();
            _random = new Random();
            NVC.Add("passkey", "alex");
            NVC.Add("id", Properties.Settings.Default.UID.ToString());

            StartStudy();
        }
示例#2
0
        private Point _transpose; // A vector storing the distance the center of the magnifier is offset when

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Pointing Magnifier replaces mouse cursor with an area cursor, which magnifies the underlying area on click.
        /// </summary>
        /// <param name="r"></param>
        /// <param name="s"></param>
        /// <param name="t"></param>
        public Magnifier(ref Preferences p, ref Logger l, ref CursorWrapper c)
        {
            InitializeComponent();

            _logger = l;

            //set default values
            _radius = p.Size;
            _scale = p.Magnification;
            _opacity = p.Transparency;
            _cursor = c;
            _lowerMouseGain = false;
            _crosshairs = true;

            _rim = new RawInputMouse("Raw Input Mouse");
            _rim.OnMouseMove += new EventHandler<MouseEventArgs>(OnRawInputMouseMove);
            _rim.OnMouseDown += new EventHandler<MouseEventArgs>(OnRawInputMouseDown);
            _rim.OnMouseUp += new EventHandler<MouseEventArgs>(OnRawInputMouseUp);
            _rim.OnMouseWheel += new EventHandler<MouseEventArgs>(OnRawInputMouseWheel);

            //Event Handlers
            //mHook = new LowLevelMouseHook("mouse");
            //mHook.OnMouseUp += new EventHandler<MouseEventArgs>(mHook_OnMouseUp);
            //mHook.OnMouseMove += new EventHandler<MouseEventArgs>(mHook_OnMouseMove);
            //mHook.OnMouseWheel += new EventHandler<MouseEventArgs>(mHook_OnMouseWheel);
            //mHook.OnMouseDown += new EventHandler<MouseEventArgs>(mHook_OnMouseDown); //strictly for mouse down

            //mHook.Install();
            this.MouseDown += new MouseEventHandler(PointingMagnifier_MouseDown);
            this.Paint += new PaintEventHandler(PointingMagnifier_Paint);

            //Timers
            _dblclkTimer = new System.Windows.Forms.Timer();
            _dblclkTimer.Interval = Win32.GetDoubleClickTime() + 10;
            _dblclkTimer.Tick += new EventHandler(_dblclkTimer_Tick);
            _dblclkTimer.Enabled = false;

            _tAnimation = new System.Windows.Forms.Timer();
            _tAnimation.Interval = AnimationStep;
            _tAnimation.Tick += new EventHandler(_tAnimation_Tick);
            _tAnimation.Enabled = false;

            _idleTimeout = new System.Timers.Timer(IDLELENGTH);
            _idleTimeout.AutoReset = false;
            _idleTimeout.Elapsed += new System.Timers.ElapsedEventHandler(_idleTimeout_Elapsed);
            _idleTimeout.Enabled = true;
        }
示例#3
0
        private System.Windows.Forms.Timer _updateTime; //must use a timer on the same thread!

        #endregion Fields

        #region Constructors

        public MainForm()
        {
            InitializeComponent();
            //Initialize settings
            preferences = new Preferences();
            _cursorWrapper = new CursorWrapper();
            _logger = new Logger(ref preferences); //load preferences firs5t!

            //Add Keyboard Hook
            kHook = new LowLevelKeyboardHook("kHook");
            kHook.OnKeyDown += new EventHandler<KeyEventArgs>(kHook_OnKeyDown);
            kHook.OnKeyUp += new EventHandler<KeyEventArgs>(kHook_OnKeyUp);

            //Add the Magnifier
            _magnifier = new Magnifier(ref preferences,ref _logger, ref _cursorWrapper);
            _magnifier.Idle += new EventHandler(_magnifier_Idle);

            menuStart.Enabled = !preferences.Study;

            _start = DateTime.Now;
            _updateTime = new System.Windows.Forms.Timer();
            _updateTime.Interval = 1000;
            _updateTime.Tick+=new EventHandler(_updateTime_Tick);
            _updateTime.Enabled = preferences.Logging;

            temp_disable = new System.Windows.Forms.Timer();
            temp_disable.Interval = 300000; //disable for 5 minutes
            temp_disable.Enabled = !preferences.Baseline && preferences.Logging && preferences.Study;
            temp_disable.Tick += new EventHandler(temp_disable_Tick);

            _feedbackReminder = new System.Windows.Forms.Timer();
            _feedbackReminder.Interval = 3600000; //show feedback reminder every hour. Does not neet to be precise
            _feedbackReminder.Enabled = !preferences.Baseline && preferences.Study;
            _feedbackReminder.Tick += new EventHandler(_feedbackReminder_Tick);

            _magnifier.Active = true; //Need to set to true so that the RIM will get initialized properly

            UpdateValues();
        }