Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WatchTask"/> class.
        /// </summary>
        /// <param name="watchRule">The watch rule.</param>
        public WatchTask(WatchRule watchRule)
        {
            if (watchRule == null)
            {
                throw new ArgumentNullException("watchRule");
            }

            activWatchRule = watchRule;

            InitializeObjects();
            InitLog();
        }
Пример #2
0
        /// <summary>
        /// Creates a new watch task.
        /// Add it to the current activ list.
        /// Starts the watch task.
        /// Saves all watch tasks to config file.
        /// </summary>
        /// <param name="rule">The rule.</param>
        private void CreateWatchTask(WatchRule rule, bool save)
        {
            //create new watchtask
            var task = new WatchTask(rule);

            //add watchtaskt to list
            lstAktivWatchTasks.Add(task);

            //handle created notifications and redirect
            task.WatchNotificationOccured += (message) => NotificationOccuredHandler(message);

            //start task
            task.StartWatchTask();

            if (save)
            {
                SaveConfigRules();
            }
        }