work on characterlist

This commit is contained in:
Zoe Fenris
2024-06-21 20:05:43 +02:00
parent 181c517ca1
commit f46eab015d
10 changed files with 331 additions and 35 deletions

Submodule OwnChar updated: e381f99b5a...b592dde7bb

View File

@@ -60,6 +60,15 @@ namespace OwnChar.App.Desktop.LangRes {
} }
} }
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Fandom ähnelt.
/// </summary>
internal static string Column_CharFandom {
get {
return ResourceManager.GetString("Column_CharFandom", resourceCulture);
}
}
/// <summary> /// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Group ähnelt. /// Sucht eine lokalisierte Zeichenfolge, die Group ähnelt.
/// </summary> /// </summary>
@@ -86,5 +95,14 @@ namespace OwnChar.App.Desktop.LangRes {
return ResourceManager.GetString("Column_CharOwner", resourceCulture); return ResourceManager.GetString("Column_CharOwner", resourceCulture);
} }
} }
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Unnamed Character ähnelt.
/// </summary>
internal static string Tab_UnnamedChar {
get {
return ResourceManager.GetString("Tab_UnnamedChar", resourceCulture);
}
}
} }
} }

View File

@@ -117,6 +117,9 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="Column_CharFandom" xml:space="preserve">
<value>Fandom</value>
</data>
<data name="Column_CharGroup" xml:space="preserve"> <data name="Column_CharGroup" xml:space="preserve">
<value>Group</value> <value>Group</value>
</data> </data>
@@ -126,4 +129,7 @@
<data name="Column_CharOwner" xml:space="preserve"> <data name="Column_CharOwner" xml:space="preserve">
<value>Owner</value> <value>Owner</value>
</data> </data>
<data name="Tab_UnnamedChar" xml:space="preserve">
<value>Unnamed Character</value>
</data>
</root> </root>

View File

@@ -18,7 +18,7 @@
<PackageReference Include="Pilz.Plugins.Advanced" Version="2.7.3" /> <PackageReference Include="Pilz.Plugins.Advanced" Version="2.7.3" />
<PackageReference Include="Pilz.Plugins.Advanced.UI" Version="1.5.1" /> <PackageReference Include="Pilz.Plugins.Advanced.UI" Version="1.5.1" />
<PackageReference Include="Pilz.Plugins.Advanced.UI.Telerik" Version="1.4.1" /> <PackageReference Include="Pilz.Plugins.Advanced.UI.Telerik" Version="1.4.1" />
<PackageReference Include="UI.for.WinForms.AllControls.Net70" Version="2024.1.312" /> <PackageReference Include="Telerik.UI.for.WinForms.AllControls" Version="2024.2.514" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -29,30 +29,100 @@
private void InitializeComponent() private void InitializeComponent()
{ {
radListView_CharList = new Telerik.WinControls.UI.RadListView(); 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)radListView_CharList).BeginInit();
((System.ComponentModel.ISupportInitialize)radMenu1).BeginInit();
tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)radTextBoxControl1).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// radListView_CharList // radListView_CharList
// //
radListView_CharList.Dock = System.Windows.Forms.DockStyle.Fill; 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.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; 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 // CharacterListControl
// //
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
Controls.Add(radListView_CharList); Controls.Add(tableLayoutPanel1);
Controls.Add(radMenu1);
Name = "CharacterListControl"; Name = "CharacterListControl";
Size = new System.Drawing.Size(500, 500); Size = new System.Drawing.Size(500, 500);
((System.ComponentModel.ISupportInitialize)radListView_CharList).EndInit(); ((System.ComponentModel.ISupportInitialize)radListView_CharList).EndInit();
((System.ComponentModel.ISupportInitialize)radMenu1).EndInit();
tableLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)radTextBoxControl1).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout();
} }
#endregion #endregion
private Telerik.WinControls.UI.RadListView radListView_CharList; 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;
} }
} }

View File

@@ -2,6 +2,7 @@
using OwnChar.App.Desktop.LangRes; using OwnChar.App.Desktop.LangRes;
using OwnChar.Model; using OwnChar.Model;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Windows.Forms; using System.Windows.Forms;
using Telerik.WinControls.UI; using Telerik.WinControls.UI;
@@ -9,16 +10,10 @@ namespace OwnChar.App.Desktop.UI.MainTabs.Controls;
public partial class CharacterListControl : UserControl public partial class CharacterListControl : UserControl
{ {
private IMainWindowApi mainApi = null!;
private IMainWindowApi? mainApi;
private UserProfile? profile; private UserProfile? profile;
private Group? group; private Group? group;
public CharacterListControl()
{
InitializeComponent();
}
public void LoadContent(IMainWindowApi mainApi, UserProfile? profile) public void LoadContent(IMainWindowApi mainApi, UserProfile? profile)
{ {
LoadContent(mainApi, profile, null); LoadContent(mainApi, profile, null);
@@ -34,29 +29,28 @@ public partial class CharacterListControl : UserControl
this.mainApi = mainApi; this.mainApi = mainApi;
this.profile = profile; this.profile = profile;
this.group = group; this.group = group;
InitializeComponent();
PrepareList(); 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() private void PrepareList()
{ {
radListView_CharList.BeginUpdate(); radListView_CharList.BeginUpdate();
radListView_CharList.Columns.Clear(); radListView_CharList.Columns.Clear();
radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharName); radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharName);
radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharFandom);
if (profile != null) if (profile != null)
radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharGroup);
else if (group != null)
radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharOwner); radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharOwner);
else if (group != null)
radListView_CharList.Columns.Add(CharListControlLangRes.Column_CharGroup);
radListView_CharList.EndUpdate(); radListView_CharList.EndUpdate();
} }
private void LoadList() private void LoadList(Group? group)
{ {
radListView_CharList.BeginUpdate(); radListView_CharList.BeginUpdate();
radListView_CharList.Items.Clear(); radListView_CharList.Items.Clear();
@@ -82,6 +76,55 @@ public partial class CharacterListControl : UserControl
private void UpdateCharListViewItem(ListViewDataItem listItem, Character character) private void UpdateCharListViewItem(ListViewDataItem listItem, Character character)
{ {
listItem[0] = character.Name; 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());
}
} }

View File

@@ -28,33 +28,67 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
radPageView_groupView = new Telerik.WinControls.UI.RadPageView(); radListView1 = new Telerik.WinControls.UI.RadListView();
((System.ComponentModel.ISupportInitialize)radPageView_groupView).BeginInit(); 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(); SuspendLayout();
// //
// radPageView_groupView // radListView1
// //
radPageView_groupView.Dock = System.Windows.Forms.DockStyle.Fill; radListView1.Dock = System.Windows.Forms.DockStyle.Fill;
radPageView_groupView.Location = new System.Drawing.Point(0, 0); radListView1.Location = new System.Drawing.Point(0, 20);
radPageView_groupView.Name = "radPageView_groupView"; radListView1.Name = "radListView1";
radPageView_groupView.Size = new System.Drawing.Size(500, 500); radListView1.Size = new System.Drawing.Size(500, 480);
radPageView_groupView.TabIndex = 0; radListView1.TabIndex = 0;
radPageView_groupView.ViewMode = Telerik.WinControls.UI.PageViewMode.NavigationView;
((Telerik.WinControls.UI.RadPageViewNavigationViewElement)radPageView_groupView.GetChildAt(0)).ExpandedPaneWidth = 175;
// //
// 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); AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 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); 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); ResumeLayout(false);
PerformLayout();
} }
#endregion #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;
} }
} }

View File

@@ -9,6 +9,11 @@ public partial class GroupListControl : UserControl
InitializeComponent(); InitializeComponent();
} }
private void radMenuItem1_Click(object sender, System.EventArgs e)
{
}
// Auflistung der Gruppen // Auflistung der Gruppen
// Hinzufügen // Hinzufügen
// Löschen + Umbenennen (Wenn Admin/Mod) // Löschen + Umbenennen (Wenn Admin/Mod)

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -46,7 +46,7 @@
radPageView1.Dock = System.Windows.Forms.DockStyle.Fill; radPageView1.Dock = System.Windows.Forms.DockStyle.Fill;
radPageView1.Location = new System.Drawing.Point(0, 0); radPageView1.Location = new System.Drawing.Point(0, 0);
radPageView1.Name = "radPageView1"; radPageView1.Name = "radPageView1";
radPageView1.SelectedPage = radPageViewPage1; radPageView1.SelectedPage = radPageViewPage2;
radPageView1.Size = new System.Drawing.Size(500, 500); radPageView1.Size = new System.Drawing.Size(500, 500);
radPageView1.TabIndex = 0; radPageView1.TabIndex = 0;
radPageView1.ViewMode = Telerik.WinControls.UI.PageViewMode.NavigationView; radPageView1.ViewMode = Telerik.WinControls.UI.PageViewMode.NavigationView;