コード例 #1
0
ファイル: IntegrationTests.cs プロジェクト: kkot/LzTimer
        public void setUp()
        {
            policies = new TimeTablePolicies();
            var timeTable = new TimeTable(policies);

            activityChecker = new ActivityChecker(GetLastActivityProbeStub(), GetClockStub());
            activityChecker.SetActivityListner(timeTable);
            statsReporter = new StatsReporterImpl(timeTable, policies, GetClockStub());
        }
コード例 #2
0
        public void SetUp()
        {
            policies = new TimeTablePolicies();
            var timeTable = new TimeTable(policies);

            periodsInfoProvider     = timeTable;
            activityPeriodsListener = timeTable;
            clockMock        = A.Fake <Clock>();
            statsReporterSUT = new StatsReporterImpl(periodsInfoProvider, policies, clockMock);
        }
コード例 #3
0
        private void UpdateStats(StatsReporter reporter)
        {
            UpdateLabels(
                (int)reporter.GetTotalActiveToday(DateTime.Now.Date).Round(100.ms()).TotalSeconds,
                (int)reporter.GetLastInactiveTimespan().Round(100.ms()).TotalSeconds
                );

            ActivityPeriod currentActivityPeriod = reporter.GetCurrentLogicalPeriod();

            UpdateNotifyIcon(currentActivityPeriod is ActivePeriod, (int)currentActivityPeriod.Length.TotalMinutes);
            UpdateAlldayIcon(reporter.GetTotalActiveToday(DateTime.Now.Date));
            UpdateHistoryWindow();
        }
コード例 #4
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;
        }
コード例 #5
0
ファイル: HistoryWindow.cs プロジェクト: kkot/LzTimer
 public HistoryWindow(StatsReporter statsReporter)
 {
     this.statsReporter = statsReporter;
     InitializeComponent();
 }