diff --git a/ENI2/App.config b/ENI2/App.config index c4795a17..74c08f09 100644 --- a/ENI2/App.config +++ b/ENI2/App.config @@ -41,6 +41,24 @@ + + 825 + + + 450 + + + 0 + + + 0 + + + 0 + + + 0 + diff --git a/ENI2/Controls/EditWindowBase.cs b/ENI2/Controls/EditWindowBase.cs index 29790786..ae0f6f06 100644 --- a/ENI2/Controls/EditWindowBase.cs +++ b/ENI2/Controls/EditWindowBase.cs @@ -12,6 +12,8 @@ using Xceed.Wpf.Toolkit; using bsmd.database; using ENI2.Util; +using System.Windows.Data; +using System.Xml.Linq; namespace ENI2.Controls { @@ -47,6 +49,12 @@ namespace ENI2.Controls cancelButton.Click += (s, e) => { if (this.IsModal()) DialogResult = false; CancelClicked?.Invoke(); this.Close(); }; addButton.Click += (s, e) => AddClicked?.Invoke(); this.Closing += Window_Closing; + + SettingBindingExtension stBinding = new SettingBindingExtension("W1Top"); + BindingOperations.SetBinding(this, Window.TopProperty, stBinding); + + SettingBindingExtension slBinding = new SettingBindingExtension("W1Left"); + BindingOperations.SetBinding(this, Window.LeftProperty, slBinding); }; } diff --git a/ENI2/Controls/StatusWindowBase.cs b/ENI2/Controls/StatusWindowBase.cs index e555e56c..e461435a 100644 --- a/ENI2/Controls/StatusWindowBase.cs +++ b/ENI2/Controls/StatusWindowBase.cs @@ -8,6 +8,7 @@ using System.Windows; using System.Windows.Controls; using System.ComponentModel; using ENI2.Util; +using System.Windows.Data; namespace ENI2.Controls { @@ -34,7 +35,12 @@ namespace ENI2.Controls closeButton.Click += (s, e) => { if (this.IsModal()) DialogResult = true; CloseClicked?.Invoke(); this.Close(); }; refreshButton.Click += (s, e) => { RefreshClicked?.Invoke(); }; - + + SettingBindingExtension stBinding = new SettingBindingExtension("W2Top"); + this.SetBinding(Window.TopProperty, stBinding); + + SettingBindingExtension slBinding = new SettingBindingExtension("W2Left"); + this.SetBinding (Window.LeftProperty, slBinding); }; } diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 2b2e0ac4..d86e6ce6 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -451,6 +451,7 @@ + diff --git a/ENI2/MainWindow.xaml b/ENI2/MainWindow.xaml index 46cf0c6a..3eae5232 100644 --- a/ENI2/MainWindow.xaml +++ b/ENI2/MainWindow.xaml @@ -10,7 +10,9 @@ xmlns:util="clr-namespace:ENI2.Util" xmlns:local="clr-namespace:ENI2" mc:Ignorable="d" - Title="ENI 2 Testversion" Height="450" Width="825" Icon="Resources/logo_schwarz.ico" Loaded="Window_Loaded" Closing="Window_Closing" + Title="ENI 2 Testversion" + Height="{util:SettingBinding Height}" Width="{util:SettingBinding Width}" + Icon="Resources/logo_schwarz.ico" Loaded="Window_Loaded" Closing="Window_Closing" SourceInitialized="Window_SourceInitialized"> diff --git a/ENI2/Properties/Settings.Designer.cs b/ENI2/Properties/Settings.Designer.cs index 3d4052ac..af2170c4 100644 --- a/ENI2/Properties/Settings.Designer.cs +++ b/ENI2/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace ENI2.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -89,5 +89,77 @@ namespace ENI2.Properties { return ((string)(this["ConnectionString"])); } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("825")] + public string Width { + get { + return ((string)(this["Width"])); + } + set { + this["Width"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("450")] + public string Height { + get { + return ((string)(this["Height"])); + } + set { + this["Height"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public string W1Left { + get { + return ((string)(this["W1Left"])); + } + set { + this["W1Left"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public string W1Top { + get { + return ((string)(this["W1Top"])); + } + set { + this["W1Top"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public string W2Left { + get { + return ((string)(this["W2Left"])); + } + set { + this["W2Left"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public string W2Top { + get { + return ((string)(this["W2Top"])); + } + set { + this["W2Top"] = value; + } + } } } diff --git a/ENI2/Properties/Settings.settings b/ENI2/Properties/Settings.settings index b52a955d..b0a6c47a 100644 --- a/ENI2/Properties/Settings.settings +++ b/ENI2/Properties/Settings.settings @@ -23,5 +23,23 @@ Initial Catalog=nswtest;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false + + 825 + + + 450 + + + 0 + + + 0 + + + 0 + + + 0 + \ No newline at end of file diff --git a/ENI2/Util/SettingBindingExtension.cs b/ENI2/Util/SettingBindingExtension.cs new file mode 100644 index 00000000..5615beca --- /dev/null +++ b/ENI2/Util/SettingBindingExtension.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2023- schick Informatik +// Description: +// + +using System.Windows.Data; + +namespace ENI2.Util +{ + public class SettingBindingExtension : Binding + { + + public SettingBindingExtension() + { + Initialize(); + } + + public SettingBindingExtension(string path) : base(path) + { + Initialize(); + } + + private void Initialize() + { + this.Source = ENI2.Properties.Settings.Default; + this.Mode = BindingMode.TwoWay; + } + + } +}