private void SetupStream(Event e) { TwitterStream stream = new TwitterStream(e, ConsumerKey, ConsumerSecret, AccessToken, AccessTokenSecret); stream.ConfigureStream(); streams.Add(e.Name, stream); }
public bool ChangeUserCredentials(string handle, string hash, string eventName) { UserCredential uc = Users.Find(u => u.Handle == handle); if (uc != null && uc.VerifyHash(hash)) { TwitterStream ts = GetStream(eventName); ts.AccessToken = uc.GetAccessToken(); ts.AccessTokenSecret = uc.GetAccessSecret(); ts.UpdateCredentials(); return(true); } return(false); }
public void RemoveEvent(int eventId) { Event ev = _eventRepo.Find(e => e.Id == eventId).SingleOrDefault(); if (ev != null) { TwitterStream ts = GetStream(ev.Name); if (ts != null) { ts.Stop(); streams.Remove(ev.Name); _eventRepo.Remove(ev.Id); } } }