Example #1
0
 void _reader_OnStatusChange(object Sender, clsVideoFeedReader.enumFeedReaderState NewState)
 {
     lb.Items.Add(NewState.ToString());
 }
 private void _feed_reader_updated(object sender, clsVideoFeedReader.enumFeedReaderState status)
 {
     if (OnFeedReaderUpdated != null)
         OnFeedReaderUpdated(sender, status);
 }
        public void AddAccount(clsCredentials Account)
        {
            foreach (clsVideoFeedReader r in _feed_readers)
                if (r.Username == Account.Username)
                    return;

            clsVideoFeedReader new_feed = new clsVideoFeedReader(_dev_key, _app_name, Account.Username);
            if (Account.Password != "-")
                new_feed.SetCredentials(Account.Username, Account.Password);

            new_feed.OnEntryFetched += new clsVideoFeedReader.EntryFetchedHandler(new_feed_OnEntryFetched);
            new_feed.OnStatusChange += new clsVideoFeedReader.StatusChangeHandler(new_feed_OnStatusChange);
            new_feed.OnException += new clsVideoFeedReader.ExceptionHandler(new_feed_OnException);
            _feed_readers.Add(new_feed);
        }
 private void new_feed_OnStatusChange(object Sender, clsVideoFeedReader.enumFeedReaderState NewState)
 {
     _feed_reader_updated(Sender, NewState);
 }
        // constructor
        public clsStatMonger(string DeveloperKey, string ApplicationName, List<clsCredentials> Credentials, clsSettings settings)
        {
            _file_logger = new clsFileLogger("CollectorData.log");
            _settings = settings;
            _settings.OnAccountAdded += new clsSettings.AccountAddedHandler(_settings_OnAccountAdded);
            _settings.OnAccountRemoved += new clsSettings.AccountRemovedHandler(_settings_OnAccountRemoved);

            _dev_key = DeveloperKey;
            _app_name = ApplicationName;

            this.Enabled = false;

            _update_timer = new System.Timers.Timer();
            _update_timer.Enabled = false;
            _update_timer.Interval = _settings.Collect_Interval * 1000 * 60;
            _update_timer.Elapsed += new ElapsedEventHandler(_update_timer_Elapsed);

            _accounts = Credentials;
            foreach (clsCredentials c in _accounts)
            {
                clsVideoFeedReader new_feed = new clsVideoFeedReader(DeveloperKey, ApplicationName, c.Username);
                if (c.Password != string.Empty && c.Password != "-")
                    new_feed.SetCredentials(c.Username, c.Password);
                new_feed.OnEntryFetched += new clsVideoFeedReader.EntryFetchedHandler(new_feed_OnEntryFetched);
                new_feed.OnStatusChange += new clsVideoFeedReader.StatusChangeHandler(new_feed_OnStatusChange);
                _feed_readers.Add(new_feed);
            }
        }