diff --git a/IndexerGUI/DefaultUserSettings.xml b/IndexerGUI/DefaultUserSettings.xml index b545d44..eadd771 100644 --- a/IndexerGUI/DefaultUserSettings.xml +++ b/IndexerGUI/DefaultUserSettings.xml @@ -7,4 +7,6 @@ 700 1000 + 500 + 500 \ No newline at end of file diff --git a/IndexerGUI/MainWindow.xaml b/IndexerGUI/MainWindow.xaml index 9895287..822f27d 100644 --- a/IndexerGUI/MainWindow.xaml +++ b/IndexerGUI/MainWindow.xaml @@ -22,7 +22,11 @@ StateChanged="Window_StateChanged" LostKeyboardFocus="Window_LostKeyboardFocus" GotKeyboardFocus="Window_GotKeyboardFocus" - mc:Ignorable="d"> + mc:Ignorable="d" + Top="{Binding Top, Source=indexer:UserSettings.XPos, Mode=TwoWay}" + Left="{Binding Left, Source=indexer:UserSettings.YPos, Mode=TwoWay}" + Height="{Binding Height, Source=indexer:UserSettings.WndHeight, Mode=TwoWay}" + Width="{Binding Height, Source=indexer:UserSettings.WndWidth, Mode=TwoWay}"> diff --git a/IndexerGUI/MainWindow.xaml.cs b/IndexerGUI/MainWindow.xaml.cs index b651485..f361714 100644 --- a/IndexerGUI/MainWindow.xaml.cs +++ b/IndexerGUI/MainWindow.xaml.cs @@ -324,6 +324,8 @@ private void InitPart2() ExcludeHiddenAndSystem = settings.ExcludeHiddenAndSystem; ExcludeFiles = settings.ExcludeFiles; ExcludeFolders = settings.ExcludeFolders; + Left = settings.XPos; + Top = settings.YPos; var initialDirPath = CmdArgumentsParser.FilterDirPath; if (string.IsNullOrWhiteSpace(initialDirPath)) @@ -468,6 +470,8 @@ private void MainWindow_OnClosing(object sender, CancelEventArgs cancelEventArgs { Log.Instance.Debug("MainWindow_OnClosing called."); + UserSettings.Instance.XPos = this.Left; + UserSettings.Instance.YPos = this.Top; UserSettings.Instance.Save(this); if (SystemConfigFlagsWrapper.Instance().PipeManager) diff --git a/IndexerGUI/UserSettings.cs b/IndexerGUI/UserSettings.cs index 2c49470..c8a9355 100644 --- a/IndexerGUI/UserSettings.cs +++ b/IndexerGUI/UserSettings.cs @@ -45,6 +45,8 @@ private UserSettings() ExcludeHiddenAndSystem = saved.ExcludeHiddenAndSystem; ExcludeFolders = saved.ExcludeFolders; ExcludeFiles = saved.ExcludeFiles; + YPos = saved.YPos; + XPos = saved.XPos; } catch (Exception ex) { @@ -75,6 +77,12 @@ private UserSettings() [DataMember] public bool ExcludeFiles { get; set; } + [DataMember] + public double XPos { get; set; } + + [DataMember] + public double YPos { get; set; } + public void Save(MainWindow w) { WndHeight = w.Height; @@ -83,6 +91,8 @@ public void Save(MainWindow w) ExcludeHiddenAndSystem = w.ExcludeHiddenAndSystem; ExcludeFolders = w.ExcludeFolders; ExcludeFiles = w.ExcludeFiles; + XPos = w.Top; + YPos = w.Left; SelectedDrives.Clear();