private async void tw_UserStreamEventArrived(object sender, UserStreamEventReceivedEventArgs e)
{
try
{
if (InvokeRequired && !IsDisposed)
{
await this.InvokeAsync(() => this.tw_UserStreamEventArrived(sender, e));
return;
}
}
catch (ObjectDisposedException)
{
return;
}
catch (InvalidOperationException)
{
return;
}
var ev = e.EventData;
StatusLabel.Text = "Event: " + ev.Event;
//if (ev.Event == "favorite")
//{
// NotifyFavorite(ev);
//}
NotifyEvent(ev);
if (ev.Event == "favorite" || ev.Event == "unfavorite")
{
if (_curTab != null && _statuses.Tabs[_curTab.Text].Contains(ev.Id))
{
this.PurgeListViewItemCache();
((DetailsListView)_curTab.Tag).Update();
}
if (ev.Event == "unfavorite" && ev.Username.ToLowerInvariant().Equals(tw.Username.ToLowerInvariant()))
{
var favTab = this._statuses.GetTabByType(MyCommon.TabUsageType.Favorites);
favTab.EnqueueRemovePost(ev.Id, setIsDeleted: false);
}
}
}