From 62d98b054b9e5bd966343269fdc1f3f367bff023 Mon Sep 17 00:00:00 2001 From: luxick Date: Thu, 12 Mar 2020 22:10:27 +0100 Subject: [PATCH] GTK: Show seasons for enemies in grid --- EstusShots.Gtk/Pages/EnemiesPage.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/EstusShots.Gtk/Pages/EnemiesPage.cs b/EstusShots.Gtk/Pages/EnemiesPage.cs index ec689e3..da8ea9b 100644 --- a/EstusShots.Gtk/Pages/EnemiesPage.cs +++ b/EstusShots.Gtk/Pages/EnemiesPage.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using EstusShots.Gtk.Controls; using EstusShots.Gtk.Dialogs; @@ -15,7 +16,7 @@ namespace EstusShots.Gtk [UI] private readonly Box _enemiesPage = null; [UI] private readonly TreeView _enemiesTreeView = null; [UI] private readonly Button _newEnemyButton = null; - + private BindableListControl _enemiesControl; private void InitEnemiesPage() @@ -23,11 +24,16 @@ namespace EstusShots.Gtk var columns = new List { new DataColumnText(nameof(Enemy.Name)), - new DataColumnBool(nameof(Enemy.Boss)){Title = "Is Boss?"}, - new DataColumnBool(nameof(Enemy.Defeated)){Title = "Defeated?"} + new DataColumnBool(nameof(Enemy.Boss)) {Title = "Is Boss?"}, + new DataColumnBool(nameof(Enemy.Defeated)) {Title = "Defeated?"}, + new DataColumnText(nameof(Enemy.Seasons)) + { + Title = "Game", + DisplayConverter = seasons => string.Join(", ", ((IEnumerable) seasons).Select(x => x.Game)) + } }; _enemiesControl = new BindableListControl(columns, nameof(Enemy.EnemyId), _enemiesTreeView); - + _newEnemyButton.Clicked += NewEnemyButtonOnClicked; } @@ -53,7 +59,7 @@ namespace EstusShots.Gtk ErrorDialog.Show(res.OperationResult); return; } - + await ReloadEnemies(); }