protected override void OnRowActivated(object o, RowActivatedArgs args) { Store.GetIter(out var i, args.Path); var a = (Anime)Store.GetValue(i, 0); var d = new AnimeDialog(a); var response = (ResponseType)d.Run(); var result = d.Result; d.Destroy(); // We refill instead of doing this the more efficient way, // as to not deal with specific references. This is justifiable // since we are not looking at the list window right now, but the search one. switch (response) { // we're adding a new anime! case ResponseType.Accept: a.Replace(result); Program.AnimeList.Add(a); Program.Win.Fill(typeof(Anime)); break; // we're changing values! case ResponseType.Apply: a.Replace(result); Program.AnimeList.Update(a); Program.Win.Fill(typeof(Anime)); break; default: return; // We just want to cancel } Program.Win.RefreshAnimeLists(); }
protected override void OnRowActivated(object o, RowActivatedArgs args) { Store.GetIter(out var i, args.Path); var a = (Anime)Store.GetValue(i, 0); // original var d = new AnimeDialog(a); var response = (ResponseType)d.Run(); var result = d.Result; // new version d.Destroy(); switch (response) { // We activated a row from the list! No way we could be adding it! case ResponseType.Accept: Debug.WriteLine("Adding an anime that already exists!"); break; // We're changing values! case ResponseType.Apply: // Deleteing from list... if (result.ListStatus == ApiEntry.ListStatuses.NotInList) { Program.AnimeList.Remove(a); Store.Remove(ref i); return; } // We have to move it to a different list! if (a.ListStatus != result.ListStatus) { a.Replace(result); Store.Remove(ref i); Program.Win.AnimeBox.Views[(int)a.ListStatus].Store.AppendValues(a); } // just update the values else { a.Replace(result); } Program.AnimeList.Update(a); Program.Win.RefreshAnimeLists(); break; default: return; // We just want to cancel } }