work on characterlist

This commit is contained in:
Zoe Fenris
2024-06-22 13:36:27 +02:00
parent f46eab015d
commit 82ec7e48c6
3 changed files with 37 additions and 3 deletions

View File

@@ -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<Character> characters)
if (profile != null && mainApi.Manager?.Characters.GetCharacters(profile) is IEnumerable<Character> 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)