diff --git a/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs b/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs index 6111568..d342466 100644 --- a/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs +++ b/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs @@ -111,7 +111,7 @@ public partial class CharacterListControl : UserControl if (group != null) listItem[2] = group.Name; else - listItem[2] = character.Owner; + listItem[2] = character.Owner!.Name; } private Character? GetSelectedChar() diff --git a/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.cs b/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.cs index 9ddac32..fee1d92 100644 --- a/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.cs +++ b/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.cs @@ -1,7 +1,11 @@ using OwnChar.App.Desktop.Api; using OwnChar.App.Desktop.LangRes; +using OwnChar.Manager; using Pilz.UI; +using System; +using System.Collections.Generic; using System.Windows.Forms; +using Telerik.WinControls.UI; using static System.Runtime.InteropServices.JavaScript.JSType; namespace OwnChar.App.Desktop.UI.MainTabs.Controls; @@ -19,6 +23,7 @@ public partial class GroupListControl : UserControl { this.mainApi = mainApi; PrepareList(); + LoadList(); } private void PrepareList() @@ -33,6 +38,42 @@ public partial class GroupListControl : UserControl radListView_GroupList.EndUpdate(); } + public void LoadList() + { + radListView_GroupList.BeginUpdate(); + radListView_GroupList.Columns.Clear(); + + var groups = mainApi!.Manager?.Groups.GetGroups(); + + if (groups != null) + { + foreach (Model.Group group in groups) + { + AddGroupToList(group); + } + } + + radListView_GroupList.EndUpdate(); + } + + public void AddGroupToList(Model.Group group) + { + radListView_GroupList.BeginUpdate(); + + var newItem = new ListViewDataItem(); + UpdateCharListViewItem(newItem, group); + newItem.Value = group; + + radListView_GroupList.EndUpdate(); + } + + private void UpdateCharListViewItem(ListViewDataItem listItem, Model.Group group) + { + listItem[0] = group.Name; + listItem[1] = group.Fandom; + listItem[2] = mainApi!.Manager?.Groups.GetOwner(group)!.Name; + } + // E V E N T S private void RadMenuItem_CreateGroup_Click(object sender, System.EventArgs e)