public WindowsControllerPlugin()
        {
            this.showDialogCommand = new CherryCommand(
                "Show Window",
                ca => this.ShowWindow((ca as WindowCommandArgs).Window),
                "Shows the provided Windows form using correct thread.");

            this.showWindowNoActiveCommand = new CherryCommand(
                "Show Window No Activate",
                ca => this.ShowNoActivate((ca as WindowCommandArgs).Window),
                "Shows the given Windows form on the backgound and flashes the window in Windows taskbar.");

            this.getActiveWindowCommand = new CherryCommand(
                "Get Active Window",
                ca => new WindowCommandArgs(this.GetActiveForm()),
                "Returns the current visible CherryTomato window.");

            this.setActiveWindowForegroundCommand = new CherryCommand(
                "Set Active Window Foreground",
                ca =>
                {
                    var activeForm = this.GetActiveForm();
                    if (activeForm == null)
                    {
                        return false;
                    }

                    SetForegroundWindow(activeForm.Handle.ToInt32());
                    activeForm.BringToFront();
                    activeForm.Focus();
                    return true;
                },
                "Brings the current CT window to foreground and sets focus to it.");
        }
 public RemindersPanelController()
 {
     this.getRemindersPanelCommand = new CherryCommand(
         "Get Reminders List Panel",
         ca => this.GetPanel(),
         "Returns Control which intended to edit reminders.");
 }
        public TimeProvider()
        {
            this.nowCommand = new CherryCommand(
                "Get Current Time",
                ca => DateTime.Now,
                "Returns current time. Present in the system for unit testing purposes.");
            this.addNewTriggerCommand = new CherryCommand(
                "Add New Time Trigger",
                ca => this.ScheduleTrigger(ca as TimeTriggerCommandArgs),
                "Adds time trigger to the system. Uses standard Quartz trigger. Make sure time is in UTC format.");
            this.removeExistingTriggerCommand = new CherryCommand(
                "Remove Existing Time Trigger",
                ca =>
                {
                    if (!this.sched.IsShutdown)
                    {
                        var jobName = (ca as TimeTriggerCommandArgs).ActionName + jobSuffix;
                        return this.sched.DeleteJob(jobName, jobsGroup);
                    }

                    return true;
                },
                "Removes existing time trigger by its name.");
            this.scheduleActionCommand = new CherryCommand(
                "Schedule Single Action",
                ca => this.ScheduleAction(ca as SingleActionCommandArgs),
                "Schedule action to execute it once. After the execution the time trigger is removed automatically. Make sure time is in local time format.");

            this.InitializeScheduler();
        }
 public NotifyPluginsRepository()
 {
     this.getAllNotifyPluginsCommand = new CherryCommand(
         "Get All Notify Plugins",
         ca => this,
         "Returns NotifyPluginsRepository object, which is the list of INotifier plugins.");
 }
 public ReminderPluginsRepository()
 {
     this.getAllReminderPlugins = new CherryCommand(
         "Get All Reminder Plugins",
         ca => this,
         "Returns reminder plugins repository.");
 }
 public ConditionCheckerPluginsRepository()
 {
     this.getAllConditionCheckerPluginsCommand = new CherryCommand(
         "Get All Condition Checker Plugins",
         ca => this,
         "Returns ConditionCheckerPluginsRepository object, which is the list of IConditionChecker plugins.");
 }
 public SettingsControllerPlugin()
 {
     this.showSettingsCommand = new CherryCommand(
         "Show Settings",
         ca => this.ShowSettings(),
         "Show the settings windows.");
 }
 public ReminderConfigurationController()
 {
     this.editRemindercommand = new CherryCommand(
         "Edit Reminder",
         ca => this.EditReminder((ca as ReminderCommandArgs).Reminder),
         "Shows the reminder edition window.");
 }
 public FakeTimeProvider()
 {
     Now = DateTime.Now;
     this.nowCommand = new CherryCommand("Get Current Time", ca => this.Now);
     this.addNewTriggerCommand = new CherryCommand("Add New Time Trigger", ca => true);
     this.removeExistingTriggerCommand = new CherryCommand("Remove Existing Time Trigger", ca => true);
     this.scheduleActionCommand = new CherryCommand("Schedule Single Action", ca => true);
 }
 public UsbLampController()
 {
     this.flasher = new Flasher(this);
     this.renderer = new Renderer(this);
     this.flashLampCommand = new CherryCommand(
         "Flash Usb Lamp",
         fulca => this.flasher.StartFlashing((fulca as FlashUsbLampCommandArgs).FlashingSettings),
         "Perform USB lamp flashing. Command arguments should bring all necessary data.");
 }
        public FakeIconController()
        {
            this.flashIconCommand = new CherryCommand(
                "Flash Icon",
                fica => true);

            this.showBaloonCommand = new CherryCommand(
                "Show Balloon Tip",
                btca => true);
        }
        public FlowSensor(IUserActivityHook userActivityHook)
        {
            this.Enabled = true;

            this.userActivityHook = userActivityHook;
            this.isUserActivityPluginEnabled = new CherryCommand(
                "Is User Activity Sensor Enabled",
                ca => this.Enabled,
                "Returns bool indicating of the UserActivity plugins is enabled/disabled.");

            this.userActivityHook.KeyDown += this.uah_KeyDown;
            this.userActivityHook.OnMouseActivity += this.uah_OnMouseActivity;
        }
 public NotificationsConfigurationController()
 {
     this.getNotificationsConfigutationControl = new CherryCommand(
         "Get Notifications Configuration Control",
         ca => this.Panel,
         "Returns Control which edits all kind of notifications.");
     this.populateNotificationsConfigutation = new CherryCommand(
         "Populate Notifications Configuration",
         ca => this.Populate((ca as CompositeNotificationCommandArgs).CompositeNotification),
         "Update data on the UI panel with given notifications.");
     this.saveNotificationsConfigutation = new CherryCommand(
         "Save Notifications Configuration",
         ca => this.SaveToCompositeNotification((ca as CompositeNotificationCommandArgs).CompositeNotification),
         "Store all user input data to the notifications object.");
 }
        public void CreateCherryCommandListenerTest()
        {
            CherryCommandArgs sentArgs = new CherryCommandArgs();
            const string listenerName = "listener Name";
            var rl = new CherryCommand(
                listenerName,
                ra =>
                    {
                        Assert.AreEqual(sentArgs, ra);
                        return 1;
                    });

            Assert.AreEqual(listenerName, rl.Name);
            Assert.AreEqual(1, rl.Do(sentArgs));
        }
        public IconController()
        {
            this.flasher = new Flasher(this);
            this.renderer = new Renderer(this);

            this.flashIconCommand = new CherryCommand(
                "Flash Icon",
                fica => this.StartFlashing((fica as FlashIconCommandArgs).FlashingSettings),
                "Start icon flashing. The flashing settings should be set with command arguments.");

            this.showBaloonCommand = new CherryCommand(
                "Show Balloon Tip",
                btca => this.renderer.ShowBalloonTip((btca as BaloonTipCommandArgs).BaloonSettings),
                "Shows standard System Tray balloon notification. The information about balloon should be set with command arguments.");
        }
 public RemindersCorePlugin()
 {
     this.getAllRemindersCommand = new CherryCommand(
         "Get All Reminders",
         ca => this.allReminders,
         "Returns all scheduled reminder objects as IEnumerable.");
     this.addNewRemiderCommand = new CherryCommand(
         "Add New Reminder",
         ca => this.AddReminder((ca as ReminderCommandArgs).Reminder),
         "Add one more reminder object to reminders list.");
     this.removeExistingReminderCommand = new CherryCommand(
         "Remove Existing Reminder",
         ca => this.RemoveReminder((ca as ReminderCommandArgs).Reminder),
         "Remove one of the reminders from the reminders list.");
 }
        public PomodoroSensor()
        {
            this.PomodoroTimeSpan = defaultPomodoroTimeSpan;
            this.TodayProductivity = new PomodorosProductivity();

            this.startPomodoroCommand = new CherryCommand(
                "Start Pomodoro",
                cra => { this.StartPomodoroInternal(); return true; },
                "Starts the pomodoro. The corresponding event is being fired.");

            this.voidPomodoroCommand = new CherryCommand(
                "Void Pomodoro",
                cra => { this.StopPomodoroInternal(false); return true; },
                "Void (cancel) the currently running pomodoro.");

            this.stopPomodoroCommand = new CherryCommand(
                "Stop Pomodoro",
                cra => { this.StopPomodoroInternal(true); return true; },
                "Finishes (successfully) the pomodoro. The corresponding event is being fired.");

            this.getTodayProductivityCommand = new CherryCommand(
                "Get Today Productivity",
                cra => this.TodayProductivity,
                "Returns instance of PomodorosProductivity class which brings information about today productivity.");

            this.getProductivityCommand = new CherryCommand(
                "Get Productivity",
                cra => this.GetProductivity(cra as ProductivityCommandArgs),
                "Returns instance of PomodorosProductivity class which brings information about productivity within requested time.");

            this.isInPomodoroCommand = new CherryCommand(
                "Is In Pomodoro",
                cra => this.IsInPomodoro,
                "Shortcut for 'Get Current Pomodoro Status Data' command. Returns bool indication if currently system is in pomodoro.");

            this.getRunningPomodoroDataCommand = new CherryCommand(
                "Get Current Pomodoro Status Data",
                cra => this.GetCurrentStatusData(),
                "Returns instance of RunningPomodoro class which brings information about running or last finished pomodoro. Returns null if no pomodoros were ever run.");

            this.approvePomodoroCommand = new CherryCommand(
                "Approve Pomodoro",
                pca => this.RegisterPomodoro((pca as PomodoroCommandArgs).PomodoroData),
                "Add one more pomodoro record to the DB.");
        }
        public SoundController()
        {
            this.Enabled = true;

            this.soundSettings.PlayRewindSound = true;
            this.soundSettings.PlayTickingSound = true;
            this.soundSettings.PlayRingSound = true;

            this.getSettingsCommand = new CherryCommand(
                "Get Sound Settings",
                ca => this.soundSettings,
                "Returns current SoundSettings object. The settings were read from configuration.");
            this.setSettingsCommand = new CherryCommand(
                "Set Sound Settings",
                ssca => this.soundSettings = (ssca as SoundSettingsCommandArgs).Settings,
                "Set the new sound settings.");
            this.playSoundCommand = new CherryCommand(
                "Play Sound",
                psca => this.Play((psca as PlaySoundCommandArgs).FileName),
                "Plays the given file. The sound is played once.");
        }
        public OutOfPomodoroReminder()
        {
            this.outOfPomodoroTriggerCommand = new CherryCommand(
                "Out Of Pomodoro Trigger",
                ca =>
                {
                    var minutes = (ca as OutOfPomodoroCommandArgs).RemindAtMinutes;
                    if (minutes == 0)
                    {
                        return false;
                    }

                    // Uncomment to test reminder with 5,10,15 seconds delay. But not minutes!
                    //var triggeringTime = ((DateTime)getCurrentTimeCommand.Do(null)).AddSeconds(minutes);

                    var triggeringTime = ((DateTime)getCurrentTimeCommand.Do(null)).AddMinutes(minutes);
                    this.SetTriggerAt(triggeringTime);
                    return true;
                },
                "Sets next Out Of Pomodoro notification time.");
        }
 public FakeSettingsController()
 {
     this.showSettingsCommand = new CherryCommand(
         "Show Settings",
         ca => true);
 }