public void SetData(CompletedPomodoro data)
        {
            this.UpdateControl(
                () =>
                {
                    this.PomodoroData = data;
                    this.graphController.SetData(this.PomodoroData);
                    this.tasksController.SetData(this.PomodoroData);
                    this.ratingController.SetData(this.PomodoroData);
                    this.taggingController.SetData(this.PomodoroData);

                    this.PopulateData();
                });
        }
        public void StartPomodoroInternal()
        {
            this.pomodoroData       = new CompletedPomodoro();
            this.pomodoroData.Start = this.Now;

            this.scheduleActionCommand.Do(new SingleActionCommandArgs(
                                              "Finish Pomodoro",
                                              this.Now.Add(this.PomodoroTimeSpan),
                                              () => this.StopPomodoroInternal(true)));

            this.pomodoroStartedEvent.Fire(new PomodoroEventArgs(this.pomodoroData));

            this.addNewTriggerCommand.Do(new TimeTriggerCommandArgs(
                                             "Pomodoro Minute Elapsed",
                                             TriggerUtils.MakeMinutelyTrigger(), // fired on every minute
                                             () => this.pomodoroMinuteElapsed.Fire(new PomodoroEventArgs(this.GetCurrentStatusData()))));
        }
        public void StopPomodoroInternal(bool completed)
        {
            this.previousPomodoro = this.pomodoroData;
            this.pomodoroData     = null;

            var args = new TimeTriggerCommandArgs("Finish Pomodoro");

            this.removeExistingTimeTriggerCommand.Do(args); // should be removed in case the user voided the pomodoro

            // remove the trigger as of no need
            this.removeExistingTriggerCommand.Do(new TimeTriggerCommandArgs("Pomodoro Minute Elapsed"));

            this.previousPomodoro.Successful = completed;

            this.previousPomodoro.Duration = this.Now - this.previousPomodoro.Start;

            this.pomodoroFinishingEvent.Fire(new PomodoroEventArgs(this.previousPomodoro));

            this.pomodoroFinishedEvent.Fire(new PomodoroEventArgs(this.previousPomodoro));
        }
        public bool RegisterPomodoro(CompletedPomodoro pomodoro)
        {
            this.SetPomodorosToday(new PomodorosProductivity(
                                       this.TodayProductivity.Pomodoros + 1,
                                       this.TodayProductivity.Rating + pomodoro.Rating));

            this.allRegisteredPomodoros.Add(pomodoro);

            if (this.databaseConnection != null)
            {
                this.databaseConnection.ExecuteNonQuery(
                    "insert into PomodoroRegistrations (TimeStamp, Duration, Evaluation) values (@p1, @p2, @p3);",
                    pomodoro.Start,
                    pomodoro.Duration.Ticks,
                    pomodoro.Rating);

                return(true);
            }

            return(false);
        }
 public void SetData(CompletedPomodoro data)
 {
     this.pomodoroData = data;
 }
 public PomodoroEventArgs(CompletedPomodoro pomodoroData)
 {
     this.PomodoroData = pomodoroData;
 }
        public void StopPomodoroInternal(CompletedPomodoro pomodoroData)
        {
            if (!this.Enabled) return;

            this.inPomodoro = false;

            this.userActivityHook.Stop();

            pomodoroData.KeyboardActivity = this.PomodoroKeyboardActivity;
            pomodoroData.MouseActivity = this.PomodoroMouseActivity;

            // remove the trigger as of no need
            this.removeExistingTriggerCommand.Do(new TimeTriggerCommandArgs("Second Elapsed for Flow Sensor"));
        }
        public void StopPomodoroInternal(CompletedPomodoro pomodoroData)
        {
            this.AddTaskRegistration(this.processAndWindowSpy.GetActiveTask(), this.Now);
            pomodoroData.TaskRegistrations = this.PomodoroRegistrations;

            // remove the trigger as of no need
            this.removeExistingTriggerCommand.Do(new TimeTriggerCommandArgs("Quarter Second Elapsed for Active Task Sensor"));

            this.lastPoll = default(DateTime);
        }
 public void SetData(CompletedPomodoro data)
 {
     this.pomodoroData = data;
     this.InitializeSummedData();
     this.highlights = null;
 }
 public PomodoroCommandArgs(CompletedPomodoro pomodoroData)
 {
     this.PomodoroData = pomodoroData;
 }
Exemple #11
0
 public PomodoroCommandArgs(CompletedPomodoro pomodoroData)
 {
     this.PomodoroData = pomodoroData;
 }
        public void StopPomodoroInternal(bool completed)
        {
            this.previousPomodoro = this.pomodoroData;
            this.pomodoroData = null;

            var args = new TimeTriggerCommandArgs("Finish Pomodoro");
            this.removeExistingTimeTriggerCommand.Do(args); // should be removed in case the user voided the pomodoro

            // remove the trigger as of no need
            this.removeExistingTriggerCommand.Do(new TimeTriggerCommandArgs("Pomodoro Minute Elapsed"));

            this.previousPomodoro.Successful = completed;

            this.previousPomodoro.Duration = this.Now - this.previousPomodoro.Start;

            this.pomodoroFinishingEvent.Fire(new PomodoroEventArgs(this.previousPomodoro));

            this.pomodoroFinishedEvent.Fire(new PomodoroEventArgs(this.previousPomodoro));
        }
        public void StartPomodoroInternal()
        {
            this.pomodoroData = new CompletedPomodoro();
            this.pomodoroData.Start = this.Now;

            this.scheduleActionCommand.Do(new SingleActionCommandArgs(
                "Finish Pomodoro",
                this.Now.Add(this.PomodoroTimeSpan),
                () => this.StopPomodoroInternal(true)));

            this.pomodoroStartedEvent.Fire(new PomodoroEventArgs(this.pomodoroData));

            this.addNewTriggerCommand.Do(new TimeTriggerCommandArgs(
                "Pomodoro Minute Elapsed",
                TriggerUtils.MakeMinutelyTrigger(), // fired on every minute
                () => this.pomodoroMinuteElapsed.Fire(new PomodoroEventArgs(this.GetCurrentStatusData()))));
        }
        public bool RegisterPomodoro(CompletedPomodoro pomodoro)
        {
            this.SetPomodorosToday(new PomodorosProductivity(
                this.TodayProductivity.Pomodoros + 1,
                this.TodayProductivity.Rating + pomodoro.Rating));

            this.allRegisteredPomodoros.Add(pomodoro);

            if (this.databaseConnection != null)
            {
                this.databaseConnection.ExecuteNonQuery(
                    "insert into PomodoroRegistrations (TimeStamp, Duration, Evaluation) values (@p1, @p2, @p3);",
                    pomodoro.Start,
                    pomodoro.Duration.Ticks,
                    pomodoro.Rating);

                return true;
            }

            return false;
        }
 public void SetData(CompletedPomodoro data)
 {
     this.pomodoroData = data;
     this.chartRenderer.SetData(data);
 }
        private void RunFakeEvaluation()
        {
            var mal = new List<int>();
            var kal = new List<int>();
            int max = 10;
            for (int i = 0; i < 6000; i++)
            {
                mal.Add((int)(i % max * Math.Abs(Math.Sin(i / 100)) * (i % 1000) * (i / 1000.0) / 10000.0));
                kal.Add((int)(i % max * Math.Abs(Math.Cos(i / 100)) * (i % 1000) * (i / 1000.0) / 10000.0));
            }

            CompletedPomodoro data = new CompletedPomodoro()
            {
                Start = DateTime.Now,
                Duration = TimeSpan.FromMinutes(25),
                MouseActivity = mal,
                KeyboardActivity = kal,
                TaskRegistrations = new List<TaskRegistration>()
                {
                    new TaskRegistration()
                    {
                        TaskName = "Task 0",
                        ProcessName = "Process 0",
                        TimeStamp = DateTime.Now,
                        Duration = TimeSpan.FromMinutes(1),
                    },
                    new TaskRegistration()
                    {
                        TaskName = "Task 1",
                        ProcessName = "Process 1",
                        TimeStamp = DateTime.Now + TimeSpan.FromMinutes(1),
                        Duration = TimeSpan.FromMinutes(9),
                    },
                    new TaskRegistration()
                    {
                        TaskName = "Task 2",
                        ProcessName = "Process 1",
                        TimeStamp = DateTime.Now + TimeSpan.FromMinutes(10),
                        Duration = TimeSpan.FromMinutes(5),
                    },
                    new TaskRegistration()
                    {
                        TaskName = "Task 3",
                        ProcessName = "Process 2",
                        TimeStamp = DateTime.Now + TimeSpan.FromMinutes(15),
                        Duration = TimeSpan.FromMinutes(5),
                    },
                    new TaskRegistration()
                    {
                        TaskName = "Task 4",
                        ProcessName = "Process 2",
                        TimeStamp = DateTime.Now + TimeSpan.FromMinutes(20),
                        Duration = TimeSpan.FromMinutes(5),
                    },
                }
            };

            var form = new PomodoroEvaluationForm(this.plugins);
            form.SetData(data);

            this.plugins.CherryCommands["Show Window No Activate"].Do(new WindowCommandArgs(form));
        }
Exemple #17
0
 public PomodoroEventArgs(CompletedPomodoro pomodoroData)
 {
     this.PomodoroData = pomodoroData;
 }