private void updateAllToolStripMenuItem_Click(object sender, EventArgs e) {/* * //TODO: Don't handle the threads here, set a flag. Probably on feedwin. * foreach (var t in from FeedWin fw in windowlist.Values select new Thread(fw.UpdateNow) { IsBackground = true }) * { * t.SetApartmentState(ApartmentState.STA); * t.Start(); * }*/ Notifier.GetNotifier().ShowNotifier("Hi there", new List <Tuple <string, string> > { new Tuple <string, string>("Hello", "There") }); }
void rssfeed_Updated(object sender, EventArgs e) { Log.Debug("Updated event fired"); FeedConfig.FeedLabel = rssfeed.Title; RedrawWin(); var previouscurrenttopstory = CurrentTopStory; if (rssfeed.FeedItems.Count > 0) { CurrentTopStory = rssfeed.FeedItems[0].Title; } if (FeedConfig.NotifyOnNewItem && rssfeed.FeedItems.Count > 0 && !rssfeed.FeedItems[0].Title.Equals(previouscurrenttopstory) && !string.IsNullOrEmpty(previouscurrenttopstory)) { //TODO: Redo the notifier so it's effectively a singleton var newitemlist = rssfeed.FeedItems.TakeWhile(item => !item.Title.Equals(CurrentTopStory)).Select(item => new Tuple <string, string>(item.Title, item.Link.ToString())).ToList(); Notifier.GetNotifier().ShowNotifier(rssfeed.Title, newitemlist); //I'm sure there's a good reason why this works. Notifier doens't show up otherwise, as we're on our own Thread. //Also, this needs to go right at the end, because everything after this stops working. Hmm. System.Windows.Threading.Dispatcher.Run(); } }