private void tw_PostDeleted(object sender, PostDeletedEventArgs e) { try { if (InvokeRequired && !IsDisposed) { Invoke((Action) (() => { _statuses.RemovePostReserve(e.StatusId); if (_curTab != null && _statuses.Tabs[_curTab.Text].Contains(e.StatusId)) { this.PurgeListViewItemCache(); ((DetailsListView)_curTab.Tag).Update(); if (_curPost != null && _curPost.StatusId == e.StatusId) DispSelectedPost(true); } })); return; } } catch (ObjectDisposedException) { return; } catch (InvalidOperationException) { return; } }
private async void tw_PostDeleted(object sender, PostDeletedEventArgs e) { try { if (InvokeRequired && !IsDisposed) { await this.InvokeAsync(async () => { this._statuses.RemovePostFromAllTabs(e.StatusId, setIsDeleted: true); if (_curTab != null && _statuses.Tabs[_curTab.Text].Contains(e.StatusId)) { this.PurgeListViewItemCache(); ((DetailsListView)_curTab.Tag).Update(); if (_curPost != null && _curPost.StatusId == e.StatusId) await this.DispSelectedPost(true); } }); return; } } catch (ObjectDisposedException) { return; } catch (InvalidOperationException) { return; } }