Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'UVtools.WPF/MainWindow.axaml.cs')
-rw-r--r--UVtools.WPF/MainWindow.axaml.cs52
1 files changed, 37 insertions, 15 deletions
diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs
index efdda1d..d2b2fb5 100644
--- a/UVtools.WPF/MainWindow.axaml.cs
+++ b/UVtools.WPF/MainWindow.axaml.cs
@@ -431,20 +431,9 @@ public partial class MainWindow : WindowEx
UpdateTitle();
- var clientSizeObs = this.GetObservable(ClientSizeProperty);
- clientSizeObs.Subscribe(size => UpdateLayerTrackerHighlightIssues());
- var windowStateObs = this.GetObservable(WindowStateProperty);
- windowStateObs.Subscribe(windowsState => UpdateLayerTrackerHighlightIssues());
-
-
+
DataContext = this;
- AddHandler(DragDrop.DropEvent, (sender, e) =>
- {
- if (!_isGUIEnabled) return;
- ProcessFiles(e.Data.GetFileNames()?.ToArray());
- });
-
_menuFileSendTo = this.FindControl<MenuItem>("MainMenu.File.SendTo");
this.FindControl<MenuItem>("MainMenu.File").SubmenuOpened += (sender, e) =>
{
@@ -853,9 +842,28 @@ public partial class MainWindow : WindowEx
base.OnOpened(e);
var windowSize = this.GetScreenWorkingArea();
- if (Settings.General.StartMaximized
- || ClientSize.Width > windowSize.Width
- || ClientSize.Height > windowSize.Height)
+ var clientSizeObs = this.GetObservable(ClientSizeProperty);
+ clientSizeObs.Subscribe(size =>
+ {
+ Settings.General._lastWindowBounds.Width = (int)size.Width;
+ Settings.General._lastWindowBounds.Height = (int)size.Height;
+ UpdateLayerTrackerHighlightIssues();
+ });
+ var windowStateObs = this.GetObservable(WindowStateProperty);
+ windowStateObs.Subscribe(windowsState => UpdateLayerTrackerHighlightIssues());
+ PositionChanged += (sender, args) =>
+ {
+ Settings.General._lastWindowBounds.X = Math.Max(0, Position.X);
+ Settings.General._lastWindowBounds.Y = Math.Max(0, Position.Y);
+ };
+
+ AddHandler(DragDrop.DropEvent, (sender, args) =>
+ {
+ if (!_isGUIEnabled) return;
+ ProcessFiles(args.Data.GetFileNames()?.ToArray());
+ });
+
+ if (!Settings.General.StartMaximized && (ClientSize.Width >= windowSize.Width || ClientSize.Height >= windowSize.Height))
{
WindowState = WindowState.Maximized;
}
@@ -898,6 +906,18 @@ public partial class MainWindow : WindowEx
}*/
}
+ protected override void OnClosed(EventArgs e)
+ {
+ base.OnClosed(e);
+
+ if (!UserSettings.Instance.General.StartMaximized &&
+ (UserSettings.Instance.General.RestoreWindowLastPosition ||
+ UserSettings.Instance.General.RestoreWindowLastSize))
+ {
+ UserSettings.Save();
+ }
+ }
+
private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
Debug.WriteLine(e.PropertyName);
@@ -1348,6 +1368,8 @@ public partial class MainWindow : WindowEx
}
}
+ //title += $" [{RuntimeInformation.RuntimeIdentifier}]";
+
#if DEBUG
title += " [DEBUG]";
#endif