private void Favourite_Added(int progid) { if (this.IsDisposed) { return; } if (this.InvokeRequired) { this.Invoke((MethodInvoker)delegate { this.Favourite_Added(progid); }); return; } Model.Favourite info = new Model.Favourite(progid); this.ListFavourites.Items.Add(this.FavouriteListItem(info, null)); if (this.view.CurrentView == ViewState.View.Favourites) { if (this.ListFavourites.SelectedItems.Count == 0) { // Update the displayed statistics this.SetViewDefaults(); } } }
private void Favourite_Updated(int progid) { if (this.IsDisposed) { return; } if (this.InvokeRequired) { this.Invoke((MethodInvoker)delegate { this.Favourite_Updated(progid); }); return; } Model.Favourite info = new Model.Favourite(progid); ListViewItem item = this.ListFavourites.Items[progid.ToString(CultureInfo.InvariantCulture)]; item = this.FavouriteListItem(info, item); if (this.view.CurrentView == ViewState.View.Favourites) { if (item.Selected) { this.ShowFavouriteInfo(progid); } else if (this.ListFavourites.SelectedItems.Count == 0) { // Update the displayed statistics this.SetViewDefaults(); } } }
private void ShowFavouriteInfo(int progid) { Model.Favourite info = new Model.Favourite(progid); List<ToolBarButton> buttons = new List<ToolBarButton>(); buttons.AddRange(new ToolBarButton[] { this.ButtonRemFavourite, this.ButtonCurrentEps }); if (Model.Subscription.IsSubscribed(progid)) { buttons.Add(this.ButtonUnsubscribe); } else { buttons.Add(this.ButtonSubscribe); } this.SetToolbarButtons(buttons.ToArray()); this.SetSideBar(info.Name, info.Description, Model.Programme.GetImage(progid)); }