[chore:] added CSV-Separator Settings.cs

This commit is contained in:
Elias Fierke
2025-10-09 08:39:49 +02:00
parent 4ee852b37c
commit 316c9511d3
3 changed files with 34 additions and 0 deletions

View File

@@ -230,6 +230,7 @@ public partial class MainWindow : Window
private void TbSettingsCustomerName_OnTextChanged(object? sender, TextChangedEventArgs e)
{
if (LstSettingsCustomers.SelectedIndex == null || LstSettingsCustomers.SelectedIndex == -1) return;
foreach (var customer in Settings._instance.customers.customers)
if (customer.ID == Settings._instance.customers.current)
customer.name = TbSettingsCustomerName.Text;
@@ -247,6 +248,7 @@ public partial class MainWindow : Window
{
TbSettingsCustomerDescription.Text = customer.description;
TbSettingsCustomerName.Text = customer.name;
TbSettingsCustomerCsvSeparator.Text = customer.separator.ToString();
if (customer.patch != null)
TbSettingsCustomerPatchInfo.Text = customer.patch.ToString();
else
@@ -277,6 +279,7 @@ public partial class MainWindow : Window
private void TbSettingsCustomerDescription_OnTextChanged(object? sender, TextChangedEventArgs e)
{
if (LstSettingsCustomers.SelectedIndex == null || LstSettingsCustomers.SelectedIndex == -1) return;
foreach (var customer in Settings._instance.customers.customers)
if (customer.ID == Settings._instance.customers.current)
customer.description = TbSettingsCustomerDescription.Text;
@@ -417,4 +420,26 @@ public partial class MainWindow : Window
Settings.Save();
}
private void TbSettingsCustomerCsvSeparator_OnTextChanged(object? sender, TextChangedEventArgs e)
{
if (LstSettingsCustomers.SelectedIndex == null || LstSettingsCustomers.SelectedIndex == -1) return;
var sep = !string.IsNullOrEmpty(TbSettingsCustomerCsvSeparator.Text)
? TbSettingsCustomerCsvSeparator.Text
: ",";
foreach (var customer in Settings._instance.customers.customers)
if (customer.ID == Settings._instance.customers.current)
try
{
customer.separator = Convert.ToChar(sep);
}
catch (FormatException ex)
{
MessageBox.Show(this, "Error while converting: " + ex.Message, "Could not parse");
}
catch (Exception ex)
{
MessageBox.Show(this, "Unknown Error: " + ex.Message, "Error");
}
}
}