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