From f46eab015dd7962e4e891a0450016c571ca2f695 Mon Sep 17 00:00:00 2001 From: Zoe Fenris Date: Fri, 21 Jun 2024 20:05:43 +0200 Subject: [PATCH] work on characterlist --- OwnChar | 2 +- .../CharListControlLangRes.Designer.cs | 18 +++ .../LangRes/CharListControlLangRes.resx | 6 + .../OwnChar.App.Desktop.csproj | 2 +- .../Controls/CharacterListControl.Designer.cs | 76 ++++++++++- .../MainTabs/Controls/CharacterListControl.cs | 71 +++++++++-- .../Controls/GroupListControl.Designer.cs | 64 +++++++--- .../UI/MainTabs/Controls/GroupListControl.cs | 5 + .../UI/MainTabs/TabGroupView.resx | 120 ++++++++++++++++++ .../UI/MainTabs/TabUserView.Designer.cs | 2 +- 10 files changed, 331 insertions(+), 35 deletions(-) create mode 100644 OwnChar.App.Desktop/UI/MainTabs/TabGroupView.resx diff --git a/OwnChar b/OwnChar index e381f99..b592dde 160000 --- a/OwnChar +++ b/OwnChar @@ -1 +1 @@ -Subproject commit e381f99b5a4ed4a3f96793b929f5ee2da6703eda +Subproject commit b592dde7bb449c46ccb50677cfa48bee5bf316bb diff --git a/OwnChar.App.Desktop/LangRes/CharListControlLangRes.Designer.cs b/OwnChar.App.Desktop/LangRes/CharListControlLangRes.Designer.cs index 673bbbb..f0c2346 100644 --- a/OwnChar.App.Desktop/LangRes/CharListControlLangRes.Designer.cs +++ b/OwnChar.App.Desktop/LangRes/CharListControlLangRes.Designer.cs @@ -60,6 +60,15 @@ namespace OwnChar.App.Desktop.LangRes { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Fandom ähnelt. + /// + internal static string Column_CharFandom { + get { + return ResourceManager.GetString("Column_CharFandom", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Group ähnelt. /// @@ -86,5 +95,14 @@ namespace OwnChar.App.Desktop.LangRes { return ResourceManager.GetString("Column_CharOwner", resourceCulture); } } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Unnamed Character ähnelt. + /// + internal static string Tab_UnnamedChar { + get { + return ResourceManager.GetString("Tab_UnnamedChar", resourceCulture); + } + } } } diff --git a/OwnChar.App.Desktop/LangRes/CharListControlLangRes.resx b/OwnChar.App.Desktop/LangRes/CharListControlLangRes.resx index e58e747..e1781f6 100644 --- a/OwnChar.App.Desktop/LangRes/CharListControlLangRes.resx +++ b/OwnChar.App.Desktop/LangRes/CharListControlLangRes.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Fandom + Group @@ -126,4 +129,7 @@ Owner + + Unnamed Character + \ No newline at end of file diff --git a/OwnChar.App.Desktop/OwnChar.App.Desktop.csproj b/OwnChar.App.Desktop/OwnChar.App.Desktop.csproj index ff9437b..aac68aa 100644 --- a/OwnChar.App.Desktop/OwnChar.App.Desktop.csproj +++ b/OwnChar.App.Desktop/OwnChar.App.Desktop.csproj @@ -18,7 +18,7 @@ - + diff --git a/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.Designer.cs b/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.Designer.cs index 9c8209e..1c6335b 100644 --- a/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.Designer.cs +++ b/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.Designer.cs @@ -29,30 +29,100 @@ private void InitializeComponent() { radListView_CharList = new Telerik.WinControls.UI.RadListView(); + radMenu1 = new Telerik.WinControls.UI.RadMenu(); + radMenuItem_CreateChar = new Telerik.WinControls.UI.RadMenuItem(); + radMenuItem_DeleteChar = new Telerik.WinControls.UI.RadMenuItem(); + radMenuItem_OpenChar = new Telerik.WinControls.UI.RadMenuItem(); + tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + radTextBoxControl1 = new Telerik.WinControls.UI.RadTextBoxControl(); ((System.ComponentModel.ISupportInitialize)radListView_CharList).BeginInit(); + ((System.ComponentModel.ISupportInitialize)radMenu1).BeginInit(); + tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)radTextBoxControl1).BeginInit(); SuspendLayout(); // // radListView_CharList // radListView_CharList.Dock = System.Windows.Forms.DockStyle.Fill; - radListView_CharList.Location = new System.Drawing.Point(0, 0); + radListView_CharList.Location = new System.Drawing.Point(3, 31); radListView_CharList.Name = "radListView_CharList"; - radListView_CharList.Size = new System.Drawing.Size(500, 500); + radListView_CharList.Size = new System.Drawing.Size(494, 446); radListView_CharList.TabIndex = 0; // + // radMenu1 + // + radMenu1.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem_CreateChar, radMenuItem_DeleteChar, radMenuItem_OpenChar }); + radMenu1.Location = new System.Drawing.Point(0, 0); + radMenu1.Name = "radMenu1"; + radMenu1.Size = new System.Drawing.Size(500, 20); + radMenu1.TabIndex = 0; + // + // radMenuItem_CreateChar + // + radMenuItem_CreateChar.Name = "radMenuItem_CreateChar"; + radMenuItem_CreateChar.Text = "New"; + radMenuItem_CreateChar.Click += RadMenuItem_AddChar_Click; + // + // radMenuItem_DeleteChar + // + radMenuItem_DeleteChar.Name = "radMenuItem_DeleteChar"; + radMenuItem_DeleteChar.Text = "Delete"; + radMenuItem_DeleteChar.Click += RadMenuItem_DeleteChar_Click; + // + // radMenuItem_OpenChar + // + radMenuItem_OpenChar.Name = "radMenuItem_OpenChar"; + radMenuItem_OpenChar.Text = "Open"; + radMenuItem_OpenChar.Click += RadMenuItem_OpenChar_Click; + // + // tableLayoutPanel1 + // + tableLayoutPanel1.ColumnCount = 1; + tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + tableLayoutPanel1.Controls.Add(radListView_CharList, 0, 1); + tableLayoutPanel1.Controls.Add(radTextBoxControl1, 0, 0); + tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + tableLayoutPanel1.Location = new System.Drawing.Point(0, 20); + tableLayoutPanel1.Name = "tableLayoutPanel1"; + tableLayoutPanel1.RowCount = 2; + tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + tableLayoutPanel1.Size = new System.Drawing.Size(500, 480); + tableLayoutPanel1.TabIndex = 1; + // + // radTextBoxControl1 + // + radTextBoxControl1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; + radTextBoxControl1.Location = new System.Drawing.Point(3, 3); + radTextBoxControl1.Name = "radTextBoxControl1"; + radTextBoxControl1.NullText = "Search..."; + radTextBoxControl1.Size = new System.Drawing.Size(494, 22); + radTextBoxControl1.TabIndex = 1; + // // CharacterListControl // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - Controls.Add(radListView_CharList); + Controls.Add(tableLayoutPanel1); + Controls.Add(radMenu1); Name = "CharacterListControl"; Size = new System.Drawing.Size(500, 500); ((System.ComponentModel.ISupportInitialize)radListView_CharList).EndInit(); + ((System.ComponentModel.ISupportInitialize)radMenu1).EndInit(); + tableLayoutPanel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)radTextBoxControl1).EndInit(); ResumeLayout(false); + PerformLayout(); } #endregion private Telerik.WinControls.UI.RadListView radListView_CharList; + private Telerik.WinControls.UI.RadMenu radMenu1; + private Telerik.WinControls.UI.RadMenuItem radMenuItem_CreateChar; + private Telerik.WinControls.UI.RadMenuItem radMenuItem_DeleteChar; + private Telerik.WinControls.UI.RadMenuItem radMenuItem_OpenChar; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private Telerik.WinControls.UI.RadTextBoxControl radTextBoxControl1; } } diff --git a/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs b/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs index 24bda6e..4b36636 100644 --- a/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs +++ b/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs @@ -2,6 +2,7 @@ using OwnChar.App.Desktop.LangRes; using OwnChar.Model; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Windows.Forms; using Telerik.WinControls.UI; @@ -9,16 +10,10 @@ namespace OwnChar.App.Desktop.UI.MainTabs.Controls; public partial class CharacterListControl : UserControl { - - private IMainWindowApi? mainApi; + private IMainWindowApi mainApi = null!; private UserProfile? profile; private Group? group; - public CharacterListControl() - { - InitializeComponent(); - } - public void LoadContent(IMainWindowApi mainApi, UserProfile? profile) { LoadContent(mainApi, profile, null); @@ -34,29 +29,28 @@ public partial class CharacterListControl : UserControl this.mainApi = mainApi; this.profile = profile; this.group = group; + InitializeComponent(); PrepareList(); - LoadList(); + LoadList(group); } - // Laden aller -eigenen- Charaktere - // Spalte zum Anzeigen der Gruppen-Zugehörigkeit - // Hinzufügen und Löschen von Charakteren private void PrepareList() { radListView_CharList.BeginUpdate(); radListView_CharList.Columns.Clear(); radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharName); + radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharFandom); if (profile != null) - radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharGroup); - else if (group != null) radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharOwner); + else if (group != null) + radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharGroup); radListView_CharList.EndUpdate(); } - private void LoadList() + private void LoadList(Group? group) { radListView_CharList.BeginUpdate(); radListView_CharList.Items.Clear(); @@ -82,6 +76,55 @@ public partial class CharacterListControl : UserControl private void UpdateCharListViewItem(ListViewDataItem listItem, Character character) { listItem[0] = character.Name; + listItem[1] = character.Fandom; + if (group != null) + listItem[2] = group.Name; + else + listItem[2] = character.Owner; + } + + private Character? GetSelectedChar() + { + return radListView_CharList.SelectedItem?.Value as Character; + } + + private void NewChar() + { + if (mainApi.Manager?.Characters.AddCharacter() is Character newChar) + AddCharToList(newChar); + } + + private void DelChar() + { + + } + + private void TryOpenChar(Character? character) + { + if (character != null) + OpenCharTab(character); + } + + private void OpenCharTab(Character character) + { + mainApi.OpenTab(new TabCharView(mainApi, character), string.IsNullOrWhiteSpace(character.Name) ? CharListControlLangRes.Tab_UnnamedChar : character.Name); + } + + // E V E N T S + + private void RadMenuItem_AddChar_Click(object sender, System.EventArgs e) + { + NewChar(); + } + + private void RadMenuItem_DeleteChar_Click(object sender, System.EventArgs e) + { + DelChar(); + } + + private void RadMenuItem_OpenChar_Click(object sender, System.EventArgs e) + { + TryOpenChar(GetSelectedChar()); } } diff --git a/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.Designer.cs b/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.Designer.cs index 1d7c467..7e5a1be 100644 --- a/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.Designer.cs +++ b/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.Designer.cs @@ -28,33 +28,67 @@ /// private void InitializeComponent() { - radPageView_groupView = new Telerik.WinControls.UI.RadPageView(); - ((System.ComponentModel.ISupportInitialize)radPageView_groupView).BeginInit(); + radListView1 = new Telerik.WinControls.UI.RadListView(); + radMenuItem1 = new Telerik.WinControls.UI.RadMenuItem(); + radMenuItem2 = new Telerik.WinControls.UI.RadMenuItem(); + radMenuItem3 = new Telerik.WinControls.UI.RadMenuItem(); + radMenu1 = new Telerik.WinControls.UI.RadMenu(); + ((System.ComponentModel.ISupportInitialize)radListView1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)radMenu1).BeginInit(); SuspendLayout(); // - // radPageView_groupView + // radListView1 // - radPageView_groupView.Dock = System.Windows.Forms.DockStyle.Fill; - radPageView_groupView.Location = new System.Drawing.Point(0, 0); - radPageView_groupView.Name = "radPageView_groupView"; - radPageView_groupView.Size = new System.Drawing.Size(500, 500); - radPageView_groupView.TabIndex = 0; - radPageView_groupView.ViewMode = Telerik.WinControls.UI.PageViewMode.NavigationView; - ((Telerik.WinControls.UI.RadPageViewNavigationViewElement)radPageView_groupView.GetChildAt(0)).ExpandedPaneWidth = 175; + radListView1.Dock = System.Windows.Forms.DockStyle.Fill; + radListView1.Location = new System.Drawing.Point(0, 20); + radListView1.Name = "radListView1"; + radListView1.Size = new System.Drawing.Size(500, 480); + radListView1.TabIndex = 0; // - // GroupViewControl + // radMenuItem1 + // + radMenuItem1.Name = "radMenuItem1"; + radMenuItem1.Text = "New"; + radMenuItem1.Click += radMenuItem1_Click; + // + // radMenuItem2 + // + radMenuItem2.Name = "radMenuItem2"; + radMenuItem2.Text = "Delete"; + // + // radMenuItem3 + // + radMenuItem3.Name = "radMenuItem3"; + radMenuItem3.Text = "Open"; + // + // GroupListControl // AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - Controls.Add(radPageView_groupView); - Name = "GroupViewControl"; + // + // radMenu1 + // + radMenu1.Items.AddRange(new Telerik.WinControls.RadItem[] { radMenuItem1, radMenuItem2, radMenuItem3 }); + radMenu1.Location = new System.Drawing.Point(0, 0); + radMenu1.Name = "radMenu1"; + radMenu1.Size = new System.Drawing.Size(500, 20); + radMenu1.TabIndex = 1; + Controls.Add(radListView1); + Controls.Add(radMenu1); + Name = "GroupListControl"; Size = new System.Drawing.Size(500, 500); - ((System.ComponentModel.ISupportInitialize)radPageView_groupView).EndInit(); + ((System.ComponentModel.ISupportInitialize)radListView1).EndInit(); + ((System.ComponentModel.ISupportInitialize)radMenu1).EndInit(); ResumeLayout(false); + PerformLayout(); } #endregion - private Telerik.WinControls.UI.RadPageView radPageView_groupView; + private Telerik.WinControls.UI.RadListView radListView1; + private Telerik.WinControls.UI.RadMenu radMenu1; + private Telerik.WinControls.UI.RadMenuItem radMenuItem1; + private Telerik.WinControls.UI.RadMenuItem radMenuItem2; + private Telerik.WinControls.UI.RadMenuItem radMenuItem3; } } diff --git a/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.cs b/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.cs index b4b4ae2..74af227 100644 --- a/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.cs +++ b/OwnChar.App.Desktop/UI/MainTabs/Controls/GroupListControl.cs @@ -9,6 +9,11 @@ public partial class GroupListControl : UserControl InitializeComponent(); } + private void radMenuItem1_Click(object sender, System.EventArgs e) + { + + } + // Auflistung der Gruppen // Hinzufügen // Löschen + Umbenennen (Wenn Admin/Mod) diff --git a/OwnChar.App.Desktop/UI/MainTabs/TabGroupView.resx b/OwnChar.App.Desktop/UI/MainTabs/TabGroupView.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/OwnChar.App.Desktop/UI/MainTabs/TabGroupView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OwnChar.App.Desktop/UI/MainTabs/TabUserView.Designer.cs b/OwnChar.App.Desktop/UI/MainTabs/TabUserView.Designer.cs index aba08bf..9df4c60 100644 --- a/OwnChar.App.Desktop/UI/MainTabs/TabUserView.Designer.cs +++ b/OwnChar.App.Desktop/UI/MainTabs/TabUserView.Designer.cs @@ -46,7 +46,7 @@ radPageView1.Dock = System.Windows.Forms.DockStyle.Fill; radPageView1.Location = new System.Drawing.Point(0, 0); radPageView1.Name = "radPageView1"; - radPageView1.SelectedPage = radPageViewPage1; + radPageView1.SelectedPage = radPageViewPage2; radPageView1.Size = new System.Drawing.Size(500, 500); radPageView1.TabIndex = 0; radPageView1.ViewMode = Telerik.WinControls.UI.PageViewMode.NavigationView;