From 898452a55bb8b67a92e46981b718f53957873887 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 26 Dec 2023 17:05:16 +0100 Subject: [PATCH] Storing window location and size for main window and all six dialogs --- src/BreCalClient/App.config | 54 ++++- src/BreCalClient/App.xaml | 2 +- src/BreCalClient/App.xaml.cs | 5 + src/BreCalClient/EditShipcallControl.xaml | 2 +- .../EditTimesAgencyIncomingControl.xaml | 2 +- .../EditTimesAgencyOutgoingControl.xaml | 2 +- .../EditTimesAgencyShiftingControl.xaml | 2 +- src/BreCalClient/EditTimesControl.xaml | 2 +- .../EditTimesTerminalControl.xaml | 2 +- src/BreCalClient/MainWindow.xaml | 3 +- .../Properties/Settings.Designer.cs | 210 +++++++++++++++++- src/BreCalClient/Properties/Settings.settings | 54 ++++- src/BreCalClient/SettingBindingExtension.cs | 30 +++ 13 files changed, 347 insertions(+), 23 deletions(-) create mode 100644 src/BreCalClient/SettingBindingExtension.cs diff --git a/src/BreCalClient/App.config b/src/BreCalClient/App.config index c86f39a..97e0e29 100644 --- a/src/BreCalClient/App.config +++ b/src/BreCalClient/App.config @@ -10,9 +10,6 @@ - - https://brecaldevel.bsmd-emswe.eu - #1D751F @@ -22,6 +19,9 @@ https://www.textbausteine.net/ + + https://brecaldevel.bsmd-emswe.eu + @@ -29,6 +29,54 @@ + + 800 + + + 450 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + \ No newline at end of file diff --git a/src/BreCalClient/App.xaml b/src/BreCalClient/App.xaml index 6702ce6..e74dc10 100644 --- a/src/BreCalClient/App.xaml +++ b/src/BreCalClient/App.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:BreCalClient" - StartupUri="MainWindow.xaml"> + StartupUri="MainWindow.xaml" Exit="Application_Exit"> diff --git a/src/BreCalClient/App.xaml.cs b/src/BreCalClient/App.xaml.cs index 6c98fd5..191a183 100644 --- a/src/BreCalClient/App.xaml.cs +++ b/src/BreCalClient/App.xaml.cs @@ -9,5 +9,10 @@ namespace BreCalClient public partial class App : Application { public static Participant Participant { get; set; } = new Participant(); + + private void Application_Exit(object sender, ExitEventArgs e) + { + BreCalClient.Properties.Settings.Default.Save(); + } } } diff --git a/src/BreCalClient/EditShipcallControl.xaml b/src/BreCalClient/EditShipcallControl.xaml index 70b4145..6acfa9b 100644 --- a/src/BreCalClient/EditShipcallControl.xaml +++ b/src/BreCalClient/EditShipcallControl.xaml @@ -7,7 +7,7 @@ xmlns:p = "clr-namespace:BreCalClient.Resources" xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" - mc:Ignorable="d" + mc:Ignorable="d" Left="{local:SettingBinding W1Left}" Top="{local:SettingBinding W1Top}" Title="{x:Static p:Resources.textEditShipcall}" Height="242" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico"> diff --git a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml index 8b60a7f..c990144 100644 --- a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml +++ b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml @@ -7,7 +7,7 @@ xmlns:p = "clr-namespace:BreCalClient.Resources" xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" - mc:Ignorable="d" + mc:Ignorable="d" Left="{local:SettingBinding W2Left}" Top="{local:SettingBinding W2Top}" Title="{x:Static p:Resources.textEditShipcall}" Height="403" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico"> diff --git a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml index 5448fc4..7984ace 100644 --- a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml +++ b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml @@ -7,7 +7,7 @@ xmlns:p = "clr-namespace:BreCalClient.Resources" xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" - mc:Ignorable="d" + mc:Ignorable="d" Left="{local:SettingBinding W3Left}" Top="{local:SettingBinding W3Top}" Title="{x:Static p:Resources.textEditShipcall}" Height="375" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico"> diff --git a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml index c5b703b..01e76f2 100644 --- a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml +++ b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml @@ -7,7 +7,7 @@ xmlns:p = "clr-namespace:BreCalClient.Resources" xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" - mc:Ignorable="d" + mc:Ignorable="d" Left="{local:SettingBinding W4Left}" Top="{local:SettingBinding W4Top}" Title="{x:Static p:Resources.textEditShipcall}" Height="490" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico"> diff --git a/src/BreCalClient/EditTimesControl.xaml b/src/BreCalClient/EditTimesControl.xaml index bb2d400..f4d8724 100644 --- a/src/BreCalClient/EditTimesControl.xaml +++ b/src/BreCalClient/EditTimesControl.xaml @@ -7,7 +7,7 @@ xmlns:p = "clr-namespace:BreCalClient.Resources" xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" - mc:Ignorable="d" + mc:Ignorable="d" Left="{local:SettingBinding W5Left}" Top="{local:SettingBinding W5Top}" Title="{x:Static p:Resources.textEditTimes}" Height="265" Width="400" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico"> diff --git a/src/BreCalClient/EditTimesTerminalControl.xaml b/src/BreCalClient/EditTimesTerminalControl.xaml index bf69e38..81d08f5 100644 --- a/src/BreCalClient/EditTimesTerminalControl.xaml +++ b/src/BreCalClient/EditTimesTerminalControl.xaml @@ -6,7 +6,7 @@ xmlns:p = "clr-namespace:BreCalClient.Resources" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:local="clr-namespace:BreCalClient" - mc:Ignorable="d" + mc:Ignorable="d" Left="{local:SettingBinding W6Left}" Top="{local:SettingBinding W6Top}" Title="{x:Static p:Resources.textEditTimes}" Loaded="Window_Loaded" Height="295" Width="400" > diff --git a/src/BreCalClient/MainWindow.xaml b/src/BreCalClient/MainWindow.xaml index 647c6b6..18174af 100644 --- a/src/BreCalClient/MainWindow.xaml +++ b/src/BreCalClient/MainWindow.xaml @@ -8,7 +8,8 @@ xmlns:sets="clr-namespace:BreCalClient.Properties" xmlns:p = "clr-namespace:BreCalClient.Resources" mc:Ignorable="d" - Title="{DynamicResource textApplicationTitle}" Height="450" Width="800" Loaded="Window_Loaded" Closing="Window_Closing" Icon="Resources/containership.ico"> + Title="{DynamicResource textApplicationTitle}" Height="{local:SettingBinding Height}" Width="{local:SettingBinding Width}" + Top="{local:SettingBinding Top}" Left="{local:SettingBinding Left}" Loaded="Window_Loaded" Closing="Window_Closing" Icon="Resources/containership.ico"> diff --git a/src/BreCalClient/Properties/Settings.Designer.cs b/src/BreCalClient/Properties/Settings.Designer.cs index 8e2d2d1..f965487 100644 --- a/src/BreCalClient/Properties/Settings.Designer.cs +++ b/src/BreCalClient/Properties/Settings.Designer.cs @@ -23,15 +23,6 @@ namespace BreCalClient.Properties { } } - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("https://brecal.bsmd-emswe.eu")] - public string API_URL { - get { - return ((string)(this["API_URL"])); - } - } - [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("#1D751F")] @@ -70,5 +61,206 @@ namespace BreCalClient.Properties { this["FilterCriteria"] = value; } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("https://brecaldevel.bsmd-emswe.eu")] + public string API_URL { + get { + return ((string)(this["API_URL"])); + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("800")] + public double Width { + get { + return ((double)(this["Width"])); + } + set { + this["Width"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("450")] + public double Height { + get { + return ((double)(this["Height"])); + } + set { + this["Height"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double Left { + get { + return ((double)(this["Left"])); + } + set { + this["Left"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double Top { + get { + return ((double)(this["Top"])); + } + set { + this["Top"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W1Left { + get { + return ((double)(this["W1Left"])); + } + set { + this["W1Left"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W1Top { + get { + return ((double)(this["W1Top"])); + } + set { + this["W1Top"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W2Left { + get { + return ((double)(this["W2Left"])); + } + set { + this["W2Left"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W2Top { + get { + return ((double)(this["W2Top"])); + } + set { + this["W2Top"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W3Left { + get { + return ((double)(this["W3Left"])); + } + set { + this["W3Left"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W3Top { + get { + return ((double)(this["W3Top"])); + } + set { + this["W3Top"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W4Left { + get { + return ((double)(this["W4Left"])); + } + set { + this["W4Left"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W4Top { + get { + return ((double)(this["W4Top"])); + } + set { + this["W4Top"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W5Left { + get { + return ((double)(this["W5Left"])); + } + set { + this["W5Left"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W5Top { + get { + return ((double)(this["W5Top"])); + } + set { + this["W5Top"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W6Left { + get { + return ((double)(this["W6Left"])); + } + set { + this["W6Left"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double W6Top { + get { + return ((double)(this["W6Top"])); + } + set { + this["W6Top"] = value; + } + } } } diff --git a/src/BreCalClient/Properties/Settings.settings b/src/BreCalClient/Properties/Settings.settings index fdf2294..c5c4c3a 100644 --- a/src/BreCalClient/Properties/Settings.settings +++ b/src/BreCalClient/Properties/Settings.settings @@ -2,9 +2,6 @@ - - https://brecal.bsmd-emswe.eu - #1D751F @@ -17,5 +14,56 @@ + + https://brecaldevel.bsmd-emswe.eu + + + 800 + + + 450 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + \ No newline at end of file diff --git a/src/BreCalClient/SettingBindingExtension.cs b/src/BreCalClient/SettingBindingExtension.cs new file mode 100644 index 0000000..51af1ee --- /dev/null +++ b/src/BreCalClient/SettingBindingExtension.cs @@ -0,0 +1,30 @@ +// Copyright (c) 2023 schick Informatik +// Description: Binding extension to allow shorter declaraction of bindings that persist +// to the application settings +// + +using System.Windows.Data; + +namespace BreCalClient +{ + public class SettingBindingExtension : Binding + { + + public SettingBindingExtension() + { + Initialize(); + } + + public SettingBindingExtension(string path) : base(path) + { + Initialize(); + } + + private void Initialize() + { + this.Source = BreCalClient.Properties.Settings.Default; + this.Mode = BindingMode.TwoWay; + } + + } +}