Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            log.Info("Form load");
            idleIcon = CreateIdleIcon();
            UpdateNotifyIcon(false, 0);

            // loading configuration
            int maxIdleMinutes = int.Parse(Properties.Settings.Default.MaxIdleMinutes.ToString());

            intervalTextBox.Text = maxIdleMinutes.ToString();

            soundPlayer = new SoundPlayer();

            // register shotcuts keys
            shortcutsManager = new ShortcutsManager(this);
            shortcutsManager.Register();

            MoveToPosition();

            this.inputProbe      = new HookActivityProbe();
            this.activityChecker = new ActivityChecker(inputProbe, new SystemClock());
            this.policies        = new TimeTablePolicies {
                IdleTimeout = maxIdleMinutes.mins()
            };

            // for testing
            //this.policies = new TimeTablePolicies { IdleTimeout = 1.secs() };

            periodStorage = new SqlitePeriodStorage("periods.db");
            var timeTable = new TimeTable(policies, periodStorage);

            this.activityChecker.SetActivityListner(timeTable);
            this.statsReporter = new StatsReporterImpl(timeTable, policies, new SystemClock());
            timeTable.RegisterUserActivityListener(this);

            timer1.Interval = PERIOD_LENGTH_MS;
            timer1.Enabled  = true;
        }
Beispiel #2
0
 public TimeTable(TimeTablePolicies policies, PeriodStorage periodStorage)
 {
     this.policies      = policies;
     this.periodStorage = periodStorage;
 }
Beispiel #3
0
 public StatsReporterImpl(PeriodsInfoProvider periodsReader, TimeTablePolicies policies, Clock clock)
 {
     this.periodReader = periodsReader;
     this.policies     = policies;
     this.clock        = clock;
 }
Beispiel #4
0
 public TimeTable(TimeTablePolicies policies) : this(
         policies,
         new MemoryPeriodStorage())
 {
 }