61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace HorseViewer
|
|
{
|
|
public partial class ViewEditTable : Form
|
|
{
|
|
public string TabName { get; private set; }
|
|
public List<string> SelectedProperties { get; private set; } = new();
|
|
public ViewEditTable()
|
|
{
|
|
InitializeComponent();
|
|
// Hole alle Properties von HorseGridViewItem
|
|
var properties = typeof(HorseGridViewItem).GetProperties()
|
|
.Select(p => p.Name)
|
|
.ToList();
|
|
|
|
// Fülle die CheckedListBox
|
|
foreach (var property in properties)
|
|
{
|
|
checkedListBoxProperties.Items.Add(property, true); // Standardmäßig alle angehakt
|
|
}
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
TabName = txtTabName.Text.Trim();
|
|
if (string.IsNullOrWhiteSpace(TabName))
|
|
{
|
|
MessageBox.Show("Bitte einen Namen für den Tab eingeben.");
|
|
return;
|
|
}
|
|
|
|
// Hole die ausgewählten Properties
|
|
SelectedProperties = checkedListBoxProperties.CheckedItems.Cast<string>().ToList();
|
|
|
|
if (SelectedProperties.Count == 0)
|
|
{
|
|
MessageBox.Show("Bitte mindestens eine Eigenschaft auswählen.");
|
|
return;
|
|
}
|
|
|
|
DialogResult = DialogResult.OK;
|
|
Close();
|
|
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.Cancel;
|
|
Close();
|
|
}
|
|
}
|
|
}
|