Esempio n. 1
0
        /// <summary>Creates a RSS Watcher for the specified RSS target.</summary>
        /// <param name="info">Target Information.</param>
        /// <returns>true if succeeded, false otherwise.</returns>
        public bool AddWatcher(RssTargetInfo info)
        {
            foreach (RssWatcher watcher in _watchers)
            {
                if (watcher.TargetInfo.Url.Equals(info.Url))
                {
                    return(false);
                }
            }

            _mutex.WaitOne();

            RssWatcher newWatcher = new RssWatcher(this, info);

            _watchers.Add(newWatcher);

            if (_status.Equals(Status.Activated))
            {
                newWatcher.Start();
            }

            _mutex.ReleaseMutex();

            info.Save();
            return(true);
        }
Esempio n. 2
0
        /// <summary>Loads RssWatchers.</summary>
        /// <returns>true if succeeded, false otherwise.</returns>
        public bool LoadWatchers()
        {
            _watchers.Clear();

            ArrayList targetInfos = RssTargetInfo.Load();

            if (targetInfos == null || targetInfos.Count <= 0)
            {
                return(false);
            }

            _mutex.WaitOne();

            foreach (RssTargetInfo targetInfo in targetInfos)
            {
                RssWatcher watcher = new RssWatcher(this, targetInfo);
                _watchers.Add(watcher);
            }

            _mutex.ReleaseMutex();

            return(true);
        }