fix last remaining issues in MainWindow

This commit is contained in:
Florian Stinglmayr 2024-11-08 09:55:48 +01:00
parent 1693d8882d
commit 93d9dc7860

View File

@ -150,9 +150,6 @@ public partial class MainWindow : Window {
DateTime today = DateTime.Today; DateTime today = DateTime.Today;
DateTime tomorrow = today.AddDays(1); DateTime tomorrow = today.AddDays(1);
// HOCHKULTUR
startdate.Culture = enddate.Culture = CultureInfo.GetCultureInfo("de-AT");
startdate.SelectedDate = today; startdate.SelectedDate = today;
enddate.SelectedDate = tomorrow; enddate.SelectedDate = tomorrow;
} }
@ -169,7 +166,7 @@ public partial class MainWindow : Window {
builder.Append(message); builder.Append(message);
builder.Append("\n"); builder.Append("\n");
log.AppendText(builder.ToString()); log.Text = log.Text + builder.ToString();
} }
private void Log(string message) { private void Log(string message) {
@ -364,7 +361,7 @@ public partial class MainWindow : Window {
} }
private void RefreshView() { private void RefreshView() {
entries.Items.Refresh(); //entries.Items.Refresh();
GenerateLog(); GenerateLog();
} }
@ -524,7 +521,7 @@ public partial class MainWindow : Window {
startdate.SelectedDate = ResetTimeToZero(d.Value); startdate.SelectedDate = ResetTimeToZero(d.Value);
} }
d = enddate.SelectedDate; d = enddate.SelectedDate?.Date;
if (d != null) { if (d != null) {
enddate.SelectedDate = ResetTimeToZero(d.Value); enddate.SelectedDate = ResetTimeToZero(d.Value);
} }
@ -608,7 +605,7 @@ public partial class MainWindow : Window {
Name = "Discord Server Name", Name = "Discord Server Name",
Webhook = "..." Webhook = "..."
}); });
Webhooks.Items.Refresh(); //Webhooks.Items.Refresh();
RefreshPostMenu(); RefreshPostMenu();
} }
@ -624,17 +621,17 @@ public partial class MainWindow : Window {
foreach (var item in selection) { foreach (var item in selection) {
Config.Global.Webhooks.Remove(item); Config.Global.Webhooks.Remove(item);
} }
Webhooks.Items.Refresh(); //Webhooks.Items.Refresh();
RefreshPostMenu(); RefreshPostMenu();
} }
private void Webhooks_KeyUp(object sender, KeyEventArgs e) { private void Webhooks_KeyUp(object sender, KeyEventArgs e) {
DataGridCell cell = e.OriginalSource as DataGridCell; DataGridCell cell = e.Source as DataGridCell;
/* We also get keypresses from DataGridCells that are currently /* We also get keypresses from DataGridCells that are currently
* editing their content. Filter those out. We don't want to delete * editing their content. Filter those out. We don't want to delete
* the row when the user presses DEL while editing the cells content * the row when the user presses DEL while editing the cells content
*/ */
if (cell == null || cell.IsEditing) { if (cell == null) {
return; return;
} }
if (e.Key == Key.Delete) { if (e.Key == Key.Delete) {