public override IReminder CreateDefaultReminder(PluginRepository pluginRepository)
        {
            var reminder = new IntervalReminder(pluginRepository)
            {
                FromInterval = new TimeSpan(0, 1, 50, 0),
                ToInterval   = new TimeSpan(0, 2, 10, 0),
            };

            return(reminder);
        }
        public override IReminder CreateDefaultReminder(PluginRepository pluginRepository)
        {
            var reminder = new IntervalReminder(pluginRepository)
            {
                FromInterval = new TimeSpan(0, 1, 50, 0),
                ToInterval = new TimeSpan(0, 2, 10, 0),
            };

            return reminder;
        }
Пример #3
0
        public void SaveConfigTest()
        {
            using (var cs = new CherryService())
            {
                var irp = new IntervalReminderPlugin();
                cs.PluginRepository.RegisterPlugin(new FakeIconController());
                cs.PluginRepository.RegisterPlugin(irp);
                cs.PluginRepository.RegisterPlugin(new CherryTomato.Core.SoundController.SoundController());
                cs.PluginRepository.RegisterPlugin(new CherryTomato.Reminders.SystrayIconNotifier.IconNotifier());
                cs.PluginRepository.RegisterPlugin(new CherryTomato.Reminders.SoundNotifier.SoundNotifier());
                cs.PluginRepository.RegisterPlugin(new NotifyPluginsRepository());
                cs.PluginRepository.RegisterPlugin(new ConditionCheckerPluginsRepository());
                cs.PluginRepository.RegisterPlugin(new FakeTimeProvider());
                cs.PluginRepository.RegisterPlugin(new FakeWindowsController());
                cs.PluginRepository.RegisterPlugin(new DatabaseController());
                cs.PluginRepository.RegisterPlugin(new PomodoroSensor());
                cs.InitializeCherryServiceEventsAndCommands();
                cs.PluginRepository.TieEvents();

                var ir = new CherryTomato.Reminders.IntervalReminder.IntervalReminder(cs.PluginRepository)
                {
                    FromInterval          = new TimeSpan(0, 0, 17, 0),
                    ToInterval            = new TimeSpan(0, 0, 18, 0),
                    Enabled               = false,
                    Name                  = "name",
                    Description           = "description",
                    CompositeNotification = new CompositeNotification(cs.PluginRepository,
                                                                      new IconNotification {
                        Enabled = true, NotificationText = "ToolTipText", FlashCount = 5, FlashIconPath = "res://pomodoro.ico"
                    },
                                                                      new SoundNotification {
                        SoundPath = "spacey.wav"
                    }),
                };

                var xd = new XmlDocument();
                var remindersElement = xd.CreateElement("reminders");

                irp.SaveReminder(ir, remindersElement);

                var expectedConfig = "<reminders>" +
                                     "<reminder enabled=\"False\" typeName=\"Interval Reminder\" name=\"name\" fromInterval=\"00:17:00\" toInterval=\"00:18:00\">" +
                                     "<description>description</description>" +
                                     "<compositeNotification>" +
                                     "<notification typeName=\"IconNotification\" enabled=\"True\" notificationText=\"ToolTipText\" flashIconPath=\"res://pomodoro.ico\" flashCount=\"5\" />" +
                                     "<notification typeName=\"SoundNotification\" enabled=\"False\" soundPath=\"spacey.wav\" />" +
                                     "</compositeNotification>" +
                                     "<compositeCondition />" +
                                     "</reminder>" +
                                     "</reminders>";
                Assert.That(remindersElement.OuterXml, Is.EqualTo(expectedConfig));
            };
        }
Пример #4
0
 public void Save(IntervalReminder reminder)
 {
     reminder.FromInterval = new TimeSpan(0, 0, (int)this.fromIntervalNumericUpDown.Value, 0);
     reminder.ToInterval   = new TimeSpan(0, 0, (int)this.toIntervalNumericUpDown.Value, 0);
 }
Пример #5
0
 public void Populate(IntervalReminder reminder)
 {
     this.fromIntervalNumericUpDown.Value = (int)reminder.FromInterval.TotalMinutes;
     this.toIntervalNumericUpDown.Value   = (int)reminder.ToInterval.TotalMinutes;
 }
 public void Save(IntervalReminder reminder)
 {
     reminder.FromInterval = new TimeSpan(0, 0, (int)this.fromIntervalNumericUpDown.Value, 0);
     reminder.ToInterval = new TimeSpan(0, 0, (int)this.toIntervalNumericUpDown.Value, 0);
 }
 public void Populate(IntervalReminder reminder)
 {
     this.fromIntervalNumericUpDown.Value = (int)reminder.FromInterval.TotalMinutes;
     this.toIntervalNumericUpDown.Value = (int)reminder.ToInterval.TotalMinutes;
 }
        public void SaveConfigTest()
        {
            using (var cs = new CherryService())
            {
                var irp = new IntervalReminderPlugin();
                cs.PluginRepository.RegisterPlugin(new FakeIconController());
                cs.PluginRepository.RegisterPlugin(irp);
                cs.PluginRepository.RegisterPlugin(new CherryTomato.Core.SoundController.SoundController());
                cs.PluginRepository.RegisterPlugin(new CherryTomato.Reminders.SystrayIconNotifier.IconNotifier());
                cs.PluginRepository.RegisterPlugin(new CherryTomato.Reminders.SoundNotifier.SoundNotifier());
                cs.PluginRepository.RegisterPlugin(new NotifyPluginsRepository());
                cs.PluginRepository.RegisterPlugin(new ConditionCheckerPluginsRepository());
                cs.PluginRepository.RegisterPlugin(new FakeTimeProvider());
                cs.PluginRepository.RegisterPlugin(new FakeWindowsController());
                cs.PluginRepository.RegisterPlugin(new DatabaseController());
                cs.PluginRepository.RegisterPlugin(new PomodoroSensor());
                cs.InitializeCherryServiceEventsAndCommands();
                cs.PluginRepository.TieEvents();

                var ir = new CherryTomato.Reminders.IntervalReminder.IntervalReminder(cs.PluginRepository)
                {
                    FromInterval = new TimeSpan(0, 0, 17, 0),
                    ToInterval = new TimeSpan(0, 0, 18, 0),
                    Enabled = false,
                    Name = "name",
                    Description = "description",
                    CompositeNotification = new CompositeNotification(cs.PluginRepository,
                        new IconNotification { Enabled = true, NotificationText = "ToolTipText", FlashCount = 5, FlashIconPath = "res://pomodoro.ico" },
                        new SoundNotification { SoundPath = "spacey.wav" }),
                };

                var xd = new XmlDocument();
                var remindersElement = xd.CreateElement("reminders");

                irp.SaveReminder(ir, remindersElement);

                var expectedConfig = "<reminders>" +
                   "<reminder enabled=\"False\" typeName=\"Interval Reminder\" name=\"name\" fromInterval=\"00:17:00\" toInterval=\"00:18:00\">" +
                   "<description>description</description>" +
                   "<compositeNotification>" +
                   "<notification typeName=\"IconNotification\" enabled=\"True\" notificationText=\"ToolTipText\" flashIconPath=\"res://pomodoro.ico\" flashCount=\"5\" />" +
                    "<notification typeName=\"SoundNotification\" enabled=\"False\" soundPath=\"spacey.wav\" />" +
                   "</compositeNotification>" +
                   "<compositeCondition />" +
                   "</reminder>" +
                   "</reminders>";
                Assert.That(remindersElement.OuterXml, Is.EqualTo(expectedConfig));
            };
        }