mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 18:29:24 +08:00
Add remember window position support.
This commit is contained in:
parent
fcd3a86589
commit
12b03518ee
2
.gitignore
vendored
2
.gitignore
vendored
@ -117,3 +117,5 @@ UpgradeLog*.XML
|
||||
Wox/Images/websearch/Thumbs.db
|
||||
Wox/Images/Thumbs.db
|
||||
Wox/Wox.csproj
|
||||
|
||||
*.sublime-*
|
||||
|
@ -44,6 +44,12 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
||||
[JsonProperty]
|
||||
public List<WebSearch> WebSearches { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
public double WindowLeft { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
public double WindowTop { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
public List<ProgramSource> ProgramSources { get; set; }
|
||||
|
||||
|
@ -140,13 +140,26 @@ namespace Wox {
|
||||
}
|
||||
|
||||
void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||
UserSettingStorage.Instance.WindowLeft = Left;
|
||||
UserSettingStorage.Instance.WindowTop = Top;
|
||||
UserSettingStorage.Instance.Save();
|
||||
this.HideWox();
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) {
|
||||
Left = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2;
|
||||
Top = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 3;
|
||||
if (UserSettingStorage.Instance.WindowLeft == 0
|
||||
&& UserSettingStorage.Instance.WindowTop == 0)
|
||||
{
|
||||
Left = UserSettingStorage.Instance.WindowLeft
|
||||
= (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2;
|
||||
Top = UserSettingStorage.Instance.WindowTop
|
||||
= (SystemParameters.PrimaryScreenHeight - ActualHeight) / 5;
|
||||
}
|
||||
else {
|
||||
Left = UserSettingStorage.Instance.WindowLeft;
|
||||
Top = UserSettingStorage.Instance.WindowTop;
|
||||
}
|
||||
|
||||
Plugins.Init();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user