Skip to content

Commit 8527035

Browse files
authored
Merge pull request #2738 from onesounds/240529-Fix-SettingWindow-Centering
Fix Setting Window Centering Logic when First Launch
2 parents fe71d1e + 664dde9 commit 8527035

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ public string Theme
8888

8989
public double SettingWindowWidth { get; set; } = 1000;
9090
public double SettingWindowHeight { get; set; } = 700;
91-
public double SettingWindowTop { get; set; }
92-
public double SettingWindowLeft { get; set; }
91+
public double? SettingWindowTop { get; set; } = null;
92+
public double? SettingWindowLeft { get; set; } = null;
9393
public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal;
9494

9595
public int CustomExplorerIndex { get; set; } = 0;

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ private void Window_StateChanged(object sender, EventArgs e)
110110

111111
public void InitializePosition()
112112
{
113-
if (_settings.SettingWindowTop == null)
113+
if (_settings.SettingWindowTop == null || _settings.SettingWindowLeft == null)
114114
{
115115
Top = WindowTop();
116116
Left = WindowLeft();
117117
}
118118
else
119119
{
120-
Top = _settings.SettingWindowTop;
121-
Left = _settings.SettingWindowLeft;
120+
Top = _settings.SettingWindowTop.Value;
121+
Left = _settings.SettingWindowLeft.Value;
122122
}
123123
WindowState = _settings.SettingWindowState;
124124
}

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ public double SettingWindowHeight
5252
set => Settings.SettingWindowHeight = value;
5353
}
5454

55-
public double SettingWindowTop
55+
public double? SettingWindowTop
5656
{
5757
get => Settings.SettingWindowTop;
5858
set => Settings.SettingWindowTop = value;
5959
}
6060

61-
public double SettingWindowLeft
61+
public double? SettingWindowLeft
6262
{
6363
get => Settings.SettingWindowLeft;
6464
set => Settings.SettingWindowLeft = value;

0 commit comments

Comments
 (0)