コード例 #1
0
        private static void OnSettingsChanged(object sender, EventArgs e)
        {
            // Adjust to new calibration zone size.
            for (int i = 0; i < Instance.Shifts.Count - 1;)
            {
                bool did_remove = false;
                for (int j = i + 1; j < Instance.Shifts.Count; j++)
                {
                    if (Instance.Shifts[j].Position.GetDistance(Instance.Shifts[i].Position) < Options.Instance.calibration_mode.zone_size)
                    {
                        did_remove = true;
                        Instance.Shifts.RemoveAt(i);
                        break;
                    }
                }

                if (!did_remove)
                {
                    i++;
                }
            }

            // Adjust to new calibration zones count.
            while (Instance.Shifts.Count > Options.Instance.calibration_mode.max_zones_count)
            {
                Instance.Shifts.RemoveAt(0);
            }

            AsyncSaver.Save(Filepath, Instance.GetDeepCopy);
            Instance.NotifyOnChange();
        }
コード例 #2
0
        private static void Shutdown(object sender, EventArgs e)
        {
            if (MessageBox.Show(
                    "This will prevent you from controlling mouse with your eyes.\nSure you want to quit?",
                    Helpers.application_name,
                    MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                input_manager.Stop();
                eye_tracking_mouse.StopControlling();
                Helpers.tray_icon.Visible = false;

                AsyncSaver.FlushSynchroniously();
                System.Windows.Application.Current.Shutdown();
            }
        }
コード例 #3
0
        public void AddShift(Position cursor_position, Point shift)
        {
            var indices = GetClosestShiftIndexes(cursor_position, 2);

            if (indices != null && indices[0].Item2 < Options.Instance.calibration_mode.zone_size)
            {
                Shifts[indices[0].Item1] = new ShiftItem(cursor_position, shift);
                if (indices.Count > 1 && indices[1].Item2 < Options.Instance.calibration_mode.zone_size)
                {
                    Shifts.RemoveAt(indices[1].Item1);
                }
            }
            else if (Shifts.Count() < Options.Instance.calibration_mode.max_zones_count)
            {
                Shifts.Add(new ShiftItem(cursor_position, shift));
            }
            else
            {
                Shifts[GetClosestPointOfHihestDensity(cursor_position)] = new ShiftItem(cursor_position, shift);
            }

            AsyncSaver.Save(Filepath, GetDeepCopy);
            NotifyOnChange();
        }
コード例 #4
0
 private static void OnCalibrationModeChanged(object sender, EventArgs e)
 {
     AsyncSaver.FlushSynchroniously();
     Instance.LoadFromFile();
 }
コード例 #5
0
 public void OnCalibrate()
 {
     items[current_item_key].calibrations++;
     AsyncSaver.Save(Filepath, GetDeepCopy);
 }
コード例 #6
0
 public void OnClick()
 {
     items[current_item_key].clicks++;
     AsyncSaver.Save(Filepath, GetDeepCopy);
 }