Most windows now remember their previous location
This commit is contained in:
parent
ffc92bbfc6
commit
2b9c6f445b
@ -41,6 +41,24 @@
|
||||
<setting name="MainWindowPlacement" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="Width" serializeAs="String">
|
||||
<value>825</value>
|
||||
</setting>
|
||||
<setting name="Height" serializeAs="String">
|
||||
<value>450</value>
|
||||
</setting>
|
||||
<setting name="W1Left" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="W1Top" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="W2Left" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="W2Top" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
</ENI2.Properties.Settings>
|
||||
</userSettings>
|
||||
<system.serviceModel>
|
||||
|
||||
@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.ComponentModel;
|
||||
using ENI2.Util;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ENI2.Controls
|
||||
{
|
||||
@ -35,6 +36,11 @@ 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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -451,6 +451,7 @@
|
||||
<Compile Include="Util\HighlightService.cs" />
|
||||
<Compile Include="Util\InverseBooleanConverter.cs" />
|
||||
<Compile Include="Util\NullImageConverter.cs" />
|
||||
<Compile Include="Util\SettingBindingExtension.cs" />
|
||||
<Compile Include="Util\TrimStringConverter.cs" />
|
||||
<Compile Include="Util\UIHelper.cs" />
|
||||
<Compile Include="Util\UtcToLocalDateTimeConverter.cs" />
|
||||
|
||||
@ -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">
|
||||
|
||||
<Window.CommandBindings>
|
||||
|
||||
74
ENI2/Properties/Settings.Designer.cs
generated
74
ENI2/Properties/Settings.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,5 +23,23 @@
|
||||
<Setting Name="ConnectionString" Type="System.String" Scope="Application">
|
||||
<Value Profile="(Default)">Initial Catalog=nswtest;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</Value>
|
||||
</Setting>
|
||||
<Setting Name="Width" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">825</Value>
|
||||
</Setting>
|
||||
<Setting Name="Height" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">450</Value>
|
||||
</Setting>
|
||||
<Setting Name="W1Left" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
<Setting Name="W1Top" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
<Setting Name="W2Left" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
<Setting Name="W2Top" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
29
ENI2/Util/SettingBindingExtension.cs
Normal file
29
ENI2/Util/SettingBindingExtension.cs
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user