Skip to content

Commit 65de0ad

Browse files
committed
Code quality
1 parent e23bab2 commit 65de0ad

File tree

10 files changed

+90
-70
lines changed

10 files changed

+90
-70
lines changed

Flow.Launcher/Resources/Pages/WelcomePage1.xaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
Style="{DynamicResource StyleImageFadeIn}" />
128128
<TextBlock
129129
Canvas.Left="205"
130-
Margin="12,0,0,0"
130+
Margin="12 0 0 0"
131131
VerticalAlignment="Center"
132132
FontSize="30"
133133
Foreground="White"
@@ -151,30 +151,30 @@
151151
Style="{DynamicResource WizardMove}" />
152152

153153

154-
<StackPanel Width="550" Margin="24,20,24,20">
155-
<StackPanel Margin="0,0,24,0">
154+
<StackPanel Width="550" Margin="24 20 24 20">
155+
<StackPanel Margin="0 0 24 0">
156156
<TextBlock
157157
FontSize="20"
158158
FontWeight="SemiBold"
159159
Text="{DynamicResource Welcome_Page1_Title}" />
160160
<TextBlock
161-
Margin="0,10,24,0"
161+
Margin="0 10 24 0"
162162
FontSize="14"
163163
Text="{DynamicResource Welcome_Page1_Text01}"
164164
TextWrapping="WrapWithOverflow" />
165165
<TextBlock
166-
Margin="0,10,24,0"
166+
Margin="0 10 24 0"
167167
FontSize="14"
168168
Text="{DynamicResource Welcome_Page1_Text02}"
169169
TextWrapping="WrapWithOverflow" />
170170
<TextBlock
171-
Margin="0,30,0,0"
171+
Margin="0 30 0 0"
172172
FontSize="14"
173173
FontWeight="SemiBold"
174174
Text="{DynamicResource language}" />
175175
<ComboBox
176176
Width="200"
177-
Margin="0,10,0,0"
177+
Margin="0 10 0 0"
178178
DisplayMemberPath="Display"
179179
ItemsSource="{Binding Languages}"
180180
SelectedValue="{Binding CustomLanguage, Mode=TwoWay}"

Flow.Launcher/Resources/Pages/WelcomePage1.xaml.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
using System.Collections.Generic;
22
using System.Windows.Navigation;
3-
using Flow.Launcher.Infrastructure.UserSettings;
4-
using Flow.Launcher.Core.Resource;
53
using CommunityToolkit.Mvvm.DependencyInjection;
4+
using Flow.Launcher.Core.Resource;
5+
using Flow.Launcher.Infrastructure.UserSettings;
66
using Flow.Launcher.ViewModel;
77

88
namespace Flow.Launcher.Resources.Pages
99
{
1010
public partial class WelcomePage1
1111
{
12+
public Settings Settings { get; private set; }
13+
1214
protected override void OnNavigatedTo(NavigationEventArgs e)
1315
{
14-
Settings = Ioc.Default.GetRequiredService<Settings>();
16+
if (!IsInitialized)
17+
{
18+
Settings = Ioc.Default.GetRequiredService<Settings>();
19+
InitializeComponent();
20+
}
1521
// Sometimes the navigation is not triggered by button click,
1622
// so we need to reset the page number
1723
Ioc.Default.GetRequiredService<WelcomeViewModel>().PageNum = 1;
18-
InitializeComponent();
24+
base.OnNavigatedTo(e);
1925
}
2026

2127
private readonly Internationalization _translater = Ioc.Default.GetRequiredService<Internationalization>();
2228

2329
public List<Language> Languages => _translater.LoadAvailableLanguages();
2430

25-
public Settings Settings { get; set; }
26-
2731
public string CustomLanguage
2832
{
2933
get

Flow.Launcher/Resources/Pages/WelcomePage2.xaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
Margin="0"
5757
Background="{Binding PreviewBackground}">
5858
<StackPanel
59-
Margin="0,80,0,0"
59+
Margin="0 80 0 0"
6060
HorizontalAlignment="Center"
6161
VerticalAlignment="Center"
6262
Orientation="Horizontal">
@@ -89,29 +89,29 @@
8989
</StackPanel>
9090
</Border>
9191

92-
<StackPanel Grid.Row="1" Margin="24,20,24,20">
92+
<StackPanel Grid.Row="1" Margin="24 20 24 20">
9393
<StackPanel>
9494
<TextBlock
9595
FontSize="20"
9696
FontWeight="SemiBold"
9797
Text="{DynamicResource Welcome_Page2_Title}" />
9898
<TextBlock
99-
Margin="0,10,0,0"
99+
Margin="0 10 0 0"
100100
FontSize="14"
101101
Text="{DynamicResource Welcome_Page2_Text01}"
102102
TextWrapping="WrapWithOverflow" />
103103
<TextBlock
104-
Margin="0,10,0,0"
104+
Margin="0 10 0 0"
105105
FontSize="14"
106106
Text="{DynamicResource Welcome_Page2_Text02}"
107107
TextWrapping="WrapWithOverflow" />
108108
<TextBlock
109-
Margin="0,30,0,0"
109+
Margin="0 30 0 0"
110110
FontSize="14"
111111
FontWeight="SemiBold"
112112
Text="{DynamicResource flowlauncherHotkey}" />
113113
<flowlauncher:HotkeyControl
114-
Margin="0,8,0,0"
114+
Margin="0 8 0 0"
115115
ChangeHotkey="{Binding SetTogglingHotkeyCommand}"
116116
DefaultHotkey="Alt+Space"
117117
Type="Hotkey"

Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
1-
using Flow.Launcher.Helper;
2-
using Flow.Launcher.Infrastructure.Hotkey;
3-
using Flow.Launcher.Infrastructure.UserSettings;
1+
using System.Windows.Media;
42
using System.Windows.Navigation;
53
using CommunityToolkit.Mvvm.Input;
6-
using Flow.Launcher.ViewModel;
7-
using System.Windows.Media;
84
using CommunityToolkit.Mvvm.DependencyInjection;
5+
using Flow.Launcher.Helper;
6+
using Flow.Launcher.Infrastructure.Hotkey;
7+
using Flow.Launcher.Infrastructure.UserSettings;
8+
using Flow.Launcher.ViewModel;
99

1010
namespace Flow.Launcher.Resources.Pages
1111
{
1212
public partial class WelcomePage2
1313
{
14-
public Settings Settings { get; set; }
14+
public Settings Settings { get; private set; }
1515

1616
protected override void OnNavigatedTo(NavigationEventArgs e)
1717
{
18-
Settings = Ioc.Default.GetRequiredService<Settings>();
18+
if (!IsInitialized)
19+
{
20+
Settings = Ioc.Default.GetRequiredService<Settings>();
21+
InitializeComponent();
22+
}
1923
// Sometimes the navigation is not triggered by button click,
2024
// so we need to reset the page number
2125
Ioc.Default.GetRequiredService<WelcomeViewModel>().PageNum = 2;
22-
InitializeComponent();
26+
base.OnNavigatedTo(e);
2327
}
2428

2529
[RelayCommand]

Flow.Launcher/Resources/Pages/WelcomePage3.xaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
<Page.Resources>
1414
<Style x:Key="KbdLine" TargetType="Border">
1515
<Setter Property="CornerRadius" Value="8" />
16-
<Setter Property="Margin" Value="0,3,0,3" />
16+
<Setter Property="Margin" Value="0 3 0 3" />
1717
<Setter Property="Background" Value="{DynamicResource Color01B}" />
1818
</Style>
1919
<Style x:Key="Kbd" TargetType="Border">
2020
<Setter Property="CornerRadius" Value="4" />
21-
<Setter Property="Padding" Value="12,4,12,4" />
21+
<Setter Property="Padding" Value="12 4 12 4" />
2222
<Setter Property="Background" Value="{DynamicResource Color00B}" />
2323
<Setter Property="BorderBrush" Value="{DynamicResource Color18B}" />
24-
<Setter Property="BorderThickness" Value="1,1,1,2" />
24+
<Setter Property="BorderThickness" Value="1 1 1 2" />
2525
</Style>
2626
<Style x:Key="KbdText" TargetType="TextBlock">
2727
<Setter Property="TextAlignment" Value="Center" />
@@ -36,71 +36,71 @@
3636
</Grid.RowDefinitions>
3737
<TextBlock
3838
Grid.Row="0"
39-
Margin="24,20,24,14"
39+
Margin="24 20 24 14"
4040
FontSize="20"
4141
FontWeight="SemiBold"
4242
Text="{DynamicResource Welcome_Page3_Title}" />
4343
<ScrollViewer
4444
Grid.Row="1"
4545
Height="478"
46-
Margin="0,0,0,0"
46+
Margin="0 0 0 0"
4747
HorizontalAlignment="Stretch"
4848
FontSize="13">
49-
<StackPanel Margin="24,0,24,0">
49+
<StackPanel Margin="24 0 24 0">
5050
<Border
5151
BorderBrush="{DynamicResource Color03B}"
5252
BorderThickness="0"
5353
CornerRadius="5">
5454
<StackPanel>
5555
<cc:Card
5656
Title="{DynamicResource HotkeyUpDownDesc}"
57-
BorderThickness="0,0,0,0"
57+
BorderThickness="0 0 0 0"
5858
Type="Inside">
5959
<StackPanel Orientation="Horizontal">
6060
<cc:HotkeyDisplay Keys="←+→" Type="Small" />
6161
</StackPanel>
6262
</cc:Card>
6363
<cc:Card
6464
Title="{DynamicResource HotkeyLeftRightDesc}"
65-
BorderThickness="0,0,0,0"
65+
BorderThickness="0 0 0 0"
6666
Type="Inside">
6767
<StackPanel Orientation="Horizontal">
6868
<cc:HotkeyDisplay Keys="↑+↓" Type="Small" />
6969
</StackPanel>
7070
</cc:Card>
7171
<cc:Card
7272
Title="{DynamicResource HotkeyESCDesc}"
73-
BorderThickness="0,0,0,0"
73+
BorderThickness="0 0 0 0"
7474
Type="Inside">
7575
<StackPanel Orientation="Horizontal">
7676
<cc:HotkeyDisplay Keys="ESC" Type="Small" />
7777
</StackPanel>
7878
</cc:Card>
7979
<cc:Card
8080
Title="{DynamicResource HotkeyRunDesc}"
81-
BorderThickness="0,0,0,0"
81+
BorderThickness="0 0 0 0"
8282
Type="Inside">
8383
<cc:HotkeyDisplay Keys="ENTER" Type="Small" />
8484
</cc:Card>
8585
<cc:Card
8686
Title="{DynamicResource HotkeyShiftEnterDesc}"
87-
BorderThickness="0,0,0,0"
87+
BorderThickness="0 0 0 0"
8888
Type="Inside">
8989
<StackPanel Orientation="Horizontal">
9090
<cc:HotkeyDisplay Keys="SHIFT+ENTER" Type="Small" />
9191
</StackPanel>
9292
</cc:Card>
9393
<cc:Card
9494
Title="{DynamicResource HotkeyCtrlEnterDesc}"
95-
BorderThickness="0,0,0,0"
95+
BorderThickness="0 0 0 0"
9696
Type="Inside">
9797
<StackPanel Orientation="Horizontal">
9898
<cc:HotkeyDisplay Keys="CTRL+ENTER" Type="Small" />
9999
</StackPanel>
100100
</cc:Card>
101101
<cc:Card
102102
Title="{DynamicResource HotkeyCtrlShiftEnterDesc}"
103-
BorderThickness="0,0,0,0"
103+
BorderThickness="0 0 0 0"
104104
Type="Inside">
105105
<StackPanel Orientation="Horizontal">
106106
<cc:HotkeyDisplay Keys="CTRL+SHIFT+ENTER" Type="Small" />

Flow.Launcher/Resources/Pages/WelcomePage3.xaml.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@ namespace Flow.Launcher.Resources.Pages
77
{
88
public partial class WelcomePage3
99
{
10+
public Settings Settings { get; private set; }
11+
1012
protected override void OnNavigatedTo(NavigationEventArgs e)
1113
{
12-
Settings = Ioc.Default.GetRequiredService<Settings>();
14+
if (!IsInitialized)
15+
{
16+
Settings = Ioc.Default.GetRequiredService<Settings>();
17+
InitializeComponent();
18+
}
1319
// Sometimes the navigation is not triggered by button click,
1420
// so we need to reset the page number
1521
Ioc.Default.GetRequiredService<WelcomeViewModel>().PageNum = 3;
16-
InitializeComponent();
22+
base.OnNavigatedTo(e);
1723
}
18-
19-
public Settings Settings { get; set; }
2024
}
2125
}

Flow.Launcher/Resources/Pages/WelcomePage4.xaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages"
7-
xmlns:ui="http://schemas.modernwpf.com/2019"
87
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:ui="http://schemas.modernwpf.com/2019"
99
Title="WelcomePage4"
1010
d:DesignHeight="450"
1111
d:DesignWidth="800"
@@ -36,8 +36,8 @@
3636
</Style>
3737
<Style x:Key="RecommendQuery" TargetType="Border">
3838
<Setter Property="CornerRadius" Value="8" />
39-
<Setter Property="Padding" Value="20,7,12,7" />
40-
<Setter Property="Margin" Value="4,4,4,4" />
39+
<Setter Property="Padding" Value="20 7 12 7" />
40+
<Setter Property="Margin" Value="4 4 4 4" />
4141
<Setter Property="Background" Value="{DynamicResource Color01B}" />
4242
</Style>
4343
<Style x:Key="QueryText" TargetType="TextBlock">
@@ -50,7 +50,7 @@
5050
<Setter Property="TextAlignment" Value="Left" />
5151
<Setter Property="TextAlignment" Value="Left" />
5252
<Setter Property="FontSize" Value="13" />
53-
<Setter Property="Margin" Value="0,4,0,0" />
53+
<Setter Property="Margin" Value="0 4 0 0" />
5454
<Setter Property="Foreground" Value="{DynamicResource Color04B}" />
5555
</Style>
5656
</Page.Resources>
@@ -81,26 +81,26 @@
8181
Canvas.Left="0"
8282
Width="450"
8383
Height="280"
84-
Margin="0,0,0,0"
84+
Margin="0 0 0 0"
8585
Source="../../images/page_img01.png"
8686
Style="{DynamicResource StyleImageFadeIn}" />
8787
</Canvas>
8888
</StackPanel>
8989
</Border>
9090

91-
<StackPanel Grid.Row="1" Margin="24,20,24,20">
91+
<StackPanel Grid.Row="1" Margin="24 20 24 20">
9292
<StackPanel>
9393
<TextBlock
9494
FontSize="20"
9595
FontWeight="SemiBold"
9696
Text="{DynamicResource Welcome_Page4_Title}" />
9797
<TextBlock
98-
Margin="0,10,0,10"
98+
Margin="0 10 0 10"
9999
FontSize="14"
100100
Text="{DynamicResource Welcome_Page4_Text01}"
101101
TextWrapping="WrapWithOverflow" />
102102
<UniformGrid
103-
Margin="0,14,0,0"
103+
Margin="0 14 0 0"
104104
Columns="2"
105105
Rows="2">
106106
<Border Style="{DynamicResource RecommendQuery}">
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
using CommunityToolkit.Mvvm.DependencyInjection;
1+
using System.Windows.Navigation;
2+
using CommunityToolkit.Mvvm.DependencyInjection;
23
using Flow.Launcher.Infrastructure.UserSettings;
34
using Flow.Launcher.ViewModel;
4-
using System.Windows.Navigation;
55

66
namespace Flow.Launcher.Resources.Pages
77
{
88
public partial class WelcomePage4
99
{
10+
public Settings Settings { get; private set; }
11+
1012
protected override void OnNavigatedTo(NavigationEventArgs e)
1113
{
12-
Settings = Ioc.Default.GetRequiredService<Settings>();
14+
if (!IsInitialized)
15+
{
16+
Settings = Ioc.Default.GetRequiredService<Settings>();
17+
InitializeComponent();
18+
}
1319
// Sometimes the navigation is not triggered by button click,
1420
// so we need to reset the page number
1521
Ioc.Default.GetRequiredService<WelcomeViewModel>().PageNum = 4;
16-
InitializeComponent();
22+
base.OnNavigatedTo(e);
1723
}
18-
19-
public Settings Settings { get; set; }
2024
}
2125
}

0 commit comments

Comments
 (0)