Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window pos #49

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions IndexerGUI/DefaultUserSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
<SelectedDrives xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"></SelectedDrives>
<WndHeight>700</WndHeight>
<WndWidth>1000</WndWidth>
<Xpos>500</Xpos>
<Ypos>500</Ypos>
</UserSettings>
2 changes: 2 additions & 0 deletions IndexerGUI/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public static bool MakeIndexerMainWndVisible()
return false;
}
mainWindow.Show();
mainWindow.Left = UserSettings.Instance.ScreenCoord().X;
mainWindow.Top = UserSettings.Instance.ScreenCoord().Y;
return true;
}

Expand Down
4 changes: 4 additions & 0 deletions IndexerGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ private void InitPart2()
ExcludeHiddenAndSystem = settings.ExcludeHiddenAndSystem;
ExcludeFiles = settings.ExcludeFiles;
ExcludeFolders = settings.ExcludeFolders;
this.Left = settings.ScreenCoord().X;
Stateford marked this conversation as resolved.
Show resolved Hide resolved
this.Top = settings.ScreenCoord().Y;

var initialDirPath = CmdArgumentsParser.FilterDirPath;
if (string.IsNullOrWhiteSpace(initialDirPath))
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions IndexerGUI/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ private UserSettings()
ExcludeHiddenAndSystem = saved.ExcludeHiddenAndSystem;
ExcludeFolders = saved.ExcludeFolders;
ExcludeFiles = saved.ExcludeFiles;
YPos = saved.YPos;
XPos = saved.XPos;
}
catch (Exception ex)
{
Expand Down Expand Up @@ -75,6 +77,17 @@ private UserSettings()
[DataMember]
public bool ExcludeFiles { get; set; }

[DataMember]
public double XPos { get; set; }

[DataMember]
public double YPos { get; set; }

public Point ScreenCoord()
Stateford marked this conversation as resolved.
Show resolved Hide resolved
{
return new Point(XPos, YPos);
}

public void Save(MainWindow w)
{
WndHeight = w.Height;
Expand Down