From 82ec7e48c663e1eb48738810d78d24330eaffa67 Mon Sep 17 00:00:00 2001 From: Zoe Fenris Date: Sat, 22 Jun 2024 13:36:27 +0200 Subject: [PATCH] work on characterlist --- .../LangRes/CharListControlLangRes.Designer.cs | 18 ++++++++++++++++++ .../LangRes/CharListControlLangRes.resx | 6 ++++++ .../MainTabs/Controls/CharacterListControl.cs | 16 +++++++++++++--- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/OwnChar.App.Desktop/LangRes/CharListControlLangRes.Designer.cs b/OwnChar.App.Desktop/LangRes/CharListControlLangRes.Designer.cs index f0c2346..8dff4c0 100644 --- a/OwnChar.App.Desktop/LangRes/CharListControlLangRes.Designer.cs +++ b/OwnChar.App.Desktop/LangRes/CharListControlLangRes.Designer.cs @@ -96,6 +96,24 @@ namespace OwnChar.App.Desktop.LangRes { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Do you really want to delete the character {0}? ähnelt. + /// + internal static string MsgBox_ConfirmDeletion_Text { + get { + return ResourceManager.GetString("MsgBox_ConfirmDeletion_Text", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Delete Character ähnelt. + /// + internal static string MsgBox_ConfirmDeletion_Title { + get { + return ResourceManager.GetString("MsgBox_ConfirmDeletion_Title", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Unnamed Character ähnelt. /// diff --git a/OwnChar.App.Desktop/LangRes/CharListControlLangRes.resx b/OwnChar.App.Desktop/LangRes/CharListControlLangRes.resx index e1781f6..cadc4e8 100644 --- a/OwnChar.App.Desktop/LangRes/CharListControlLangRes.resx +++ b/OwnChar.App.Desktop/LangRes/CharListControlLangRes.resx @@ -129,6 +129,12 @@ Owner + + Do you really want to delete the character {0}? + + + Delete Character + Unnamed Character diff --git a/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs b/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs index 4b36636..2da580f 100644 --- a/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs +++ b/OwnChar.App.Desktop/UI/MainTabs/Controls/CharacterListControl.cs @@ -4,7 +4,9 @@ using OwnChar.Model; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Windows.Forms; +using Telerik.WinControls; using Telerik.WinControls.UI; +using Telerik.Windows.Documents.Fixed.Model.Navigation; namespace OwnChar.App.Desktop.UI.MainTabs.Controls; @@ -55,7 +57,7 @@ public partial class CharacterListControl : UserControl radListView_CharList.BeginUpdate(); radListView_CharList.Items.Clear(); - if (profile != null && mainApi?.Manager?.Characters.GetCharacters(profile) is IEnumerable characters) + if (profile != null && mainApi.Manager?.Characters.GetCharacters(profile) is IEnumerable characters) { foreach (Character character in characters) { @@ -95,9 +97,17 @@ public partial class CharacterListControl : UserControl AddCharToList(newChar); } - private void DelChar() + private void TryDelChar() { + var selChar = GetSelectedChar(); + if (selChar != null) + { + if (RadMessageBox.Show(string.Format(CharListControlLangRes.MsgBox_ConfirmDeletion_Text, selChar.Name), CharListControlLangRes.MsgBox_ConfirmDeletion_Title, MessageBoxButtons.YesNo, RadMessageIcon.Exclamation) == DialogResult.Yes) + { + + } + } } private void TryOpenChar(Character? character) @@ -120,7 +130,7 @@ public partial class CharacterListControl : UserControl private void RadMenuItem_DeleteChar_Click(object sender, System.EventArgs e) { - DelChar(); + TryDelChar(); } private void RadMenuItem_OpenChar_Click(object sender, System.EventArgs e)