예제 #1
0
        public TemtemTableController(TemtemTrackerUI trackerUI, LumaChanceCalculator lumaCalculator, SettingsController settingsController)
        {
            this.trackerUI          = trackerUI;
            this.lumaCalculator     = lumaCalculator;
            this.settingsController = settingsController;

            UIElements = new Dictionary <TemtemDataRow, Tuple <TemtemTableRowUI, IndividualTrackerWindow> >();

            LoadTableFromFile(Paths.TABLE_FILE);

            //Set this as the table controller in the UI
            trackerUI.SetTableController(this);

            //Add event listener(s) for settings updates
            settingsController.TimeToLumaProbabilityChanged += UpdateLumaTimes;

            SetLastChangeTime();
        }
예제 #2
0
 public LumaChanceCalculator(SettingsController settingsController, Config config)
 {
     this.userSettings = settingsController.GetUserSettings();
     this.config       = config;
 }
예제 #3
0
        public TimerController(TemtemTableController tableController, DetectorLoop detectorLoop, Config config, UserSettings userSettings, SettingsController settingsController)
        {
            this.tableController                   = tableController;
            this.detectorLoop                      = detectorLoop;
            this.detectionLoopInterval             = config.detectionLoopInterval;
            this.disableDetectionOnTimerPause      = userSettings.disableDetectionWhileTimerPaused;
            this.userSettings                      = userSettings;
            this.settingsController                = settingsController;
            settingsController.TimerPausedToggled += ToggleTimeTrackerTimerPaused;

            settingsController.DetectionDisabledChanged      += SetDisableDetectionOnTimerPause;
            settingsController.InactivityTimerEnabledChanged += SetInactivityTimerEnabled;

            detectionLoopTimer = new System.Timers.Timer(detectionLoopInterval);
            timeTrackerTimer   = new System.Timers.Timer(TIME_TRACKER_INTERVAL);
            autosaveTimer      = new System.Timers.Timer();
            inactivityTimer    = new System.Timers.Timer(INACTIVITY_CHECK_INTERVAL);

            //Set the interval for the autosave timer from the user settings
            //The interval is in minutes, the timer accepts miliseconds, the function converts
            SetAutosaveTimeInterval(null, userSettings.autosaveInterval);
            settingsController.AutosaveIntervalChanged += SetAutosaveTimeInterval;


            detectionLoopTimer.Elapsed += DetectionLoopListener;
            timeTrackerTimer.Elapsed   += TimeTrackerListener;
            autosaveTimer.Elapsed      += AutosaveListener;
            inactivityTimer.Elapsed    += InactivityListener;

            detectionLoopTimer.AutoReset = true;
            timeTrackerTimer.AutoReset   = true;
            autosaveTimer.AutoReset      = true;
            inactivityTimer.AutoReset    = true;
        }
예제 #4
0
        private bool autoresumeEnabled;                 //This is fetched from settings and set in the constructor

        public DetectorLoop(Config config, TemtemTableController tableController, OCRController ocrController, SettingsController settingsController)
        {
            this.config             = config;
            this.tableController    = tableController;
            this.ocrController      = ocrController;
            this.settingsController = settingsController;

            spot1RGB = ColorTranslator.FromHtml(config.spot1RGB).ToArgb();
            spot2RGB = ColorTranslator.FromHtml(config.spot2RGB).ToArgb();
            spot3RGB = ColorTranslator.FromHtml(config.spot3RGB).ToArgb();
            spot4RGB = ColorTranslator.FromHtml(config.spot4RGB).ToArgb();
            spot5RGB = ColorTranslator.FromHtml(config.spot5RGB).ToArgb();
            spot6RGB = ColorTranslator.FromHtml(config.spot6RGB).ToArgb();
            spot7RGB = ColorTranslator.FromHtml(config.spot7RGB).ToArgb();
            spot8RGB = ColorTranslator.FromHtml(config.spot8RGB).ToArgb();

            this.maxAllowedColorDistance = config.maxAllowedColorDistance;

            this.windowAndProcessNames = config.windowAndProcessNames;

            temtemWindows = new Dictionary <uint, TemtemWindowData>();

            //Get relevant settings from the settings controller
            detectionDisabledWhileTimerPaused = settingsController.GetUserSettings().disableDetectionWhileTimerPaused;
            autoresumeEnabled = settingsController.GetUserSettings().resumeAutopausedTimerOnDetection;

            //Add listeners for relevant setting changes
            settingsController.TimerPausedToggled       += TimerPausedListener;
            settingsController.TimerAutopaused          += TimerAutopauseListener;
            settingsController.DetectionDisabledChanged += DetectionDisabledListener;
            settingsController.AutoresumeEnabledChanged += AutoresumeEnabledListener;
        }