void EventAction(TwitterUserStreamEvent p)
{
Console.WriteLine(p.ToString());
switch (p.Event)
{
case "favorite":
var fs = p.TargetObject as TwitterStatus;
if (p.Source == CurrentUser) break;
if (p.Target != CurrentUser) break;
MainMention.Dispatcher.BeginInvoke(new Action(() =>
{
MainMention.Items.Insert(0, CreateFavoritePanel(fs, p.Source));
}));
NotifyFavorited(p);
foreach (var pl in FavoritePlugins) pl.OnFavorite(Service, p.Source, fs);
break;
case "unfavorite":
var fs2 = p.TargetObject as TwitterStatus;
if (p.Source == CurrentUser) break;
if (p.Target != CurrentUser) break;
MainMention.Dispatcher.BeginInvoke(new Action(() =>
{
MainMention.Items.Insert(0, CreateUnfavoritePanel(fs2, p.Source));
}));
NotifyUnfavorited(p);
foreach (var pl in UnfavoritePlugins) pl.OnUnfavorite(Service, p.Source, fs2);
break;
case "user_update":
Console.WriteLine("やったぜ。");
break;
default:
Console.WriteLine(p.RawSource.ToString());
break;
}
if (MainMention.Items.Count > MentionMax)
{
MainMention.Dispatcher.BeginInvoke(new Action(() =>
{
MainMention.Items.RemoveAt(MentionMax);
}));
}
}