File tree Expand file tree Collapse file tree 5 files changed +30
-55
lines changed
Flow.Launcher/Resources/Pages Expand file tree Collapse file tree 5 files changed +30
-55
lines changed Original file line number Diff line number Diff line change @@ -9,24 +9,19 @@ namespace Flow.Launcher.Resources.Pages
9
9
{
10
10
public partial class WelcomePage1
11
11
{
12
- public Settings Settings { get ; private set ; }
13
- private WelcomeViewModel _viewModel ;
12
+ public Settings Settings { get ; } = Ioc . Default . GetRequiredService < Settings > ( ) ;
13
+ private readonly WelcomeViewModel _viewModel = Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) ;
14
14
15
15
protected override void OnNavigatedTo ( NavigationEventArgs e )
16
16
{
17
- // If the navigation is not triggered by button click, view model will be null again
18
- if ( _viewModel == null )
19
- {
20
- Settings = Ioc . Default . GetRequiredService < Settings > ( ) ;
21
- _viewModel = Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) ;
22
- }
17
+ // Sometimes the navigation is not triggered by button click,
18
+ // so we need to reset the page number
19
+ _viewModel . PageNum = 1 ;
20
+
23
21
if ( ! IsInitialized )
24
22
{
25
23
InitializeComponent ( ) ;
26
24
}
27
- // Sometimes the navigation is not triggered by button click,
28
- // so we need to reset the page number
29
- _viewModel . PageNum = 1 ;
30
25
base . OnNavigatedTo ( e ) ;
31
26
}
32
27
Original file line number Diff line number Diff line change @@ -11,24 +11,19 @@ namespace Flow.Launcher.Resources.Pages
11
11
{
12
12
public partial class WelcomePage2
13
13
{
14
- public Settings Settings { get ; private set ; }
15
- private WelcomeViewModel _viewModel ;
14
+ public Settings Settings { get ; } = Ioc . Default . GetRequiredService < Settings > ( ) ;
15
+ private readonly WelcomeViewModel _viewModel = Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) ;
16
16
17
17
protected override void OnNavigatedTo ( NavigationEventArgs e )
18
18
{
19
- // If the navigation is not triggered by button click, view model will be null again
20
- if ( _viewModel == null )
21
- {
22
- Settings = Ioc . Default . GetRequiredService < Settings > ( ) ;
23
- _viewModel = Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) ;
24
- }
19
+ // Sometimes the navigation is not triggered by button click,
20
+ // so we need to reset the page number
21
+ _viewModel . PageNum = 2 ;
22
+
25
23
if ( ! IsInitialized )
26
24
{
27
25
InitializeComponent ( ) ;
28
26
}
29
- // Sometimes the navigation is not triggered by button click,
30
- // so we need to reset the page number
31
- _viewModel . PageNum = 2 ;
32
27
base . OnNavigatedTo ( e ) ;
33
28
}
34
29
Original file line number Diff line number Diff line change @@ -7,24 +7,19 @@ namespace Flow.Launcher.Resources.Pages
7
7
{
8
8
public partial class WelcomePage3
9
9
{
10
- public Settings Settings { get ; private set ; }
11
- private WelcomeViewModel _viewModel ;
10
+ public Settings Settings { get ; } = Ioc . Default . GetRequiredService < Settings > ( ) ;
11
+ private readonly WelcomeViewModel _viewModel = Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) ;
12
12
13
13
protected override void OnNavigatedTo ( NavigationEventArgs e )
14
14
{
15
- // If the navigation is not triggered by button click, view model will be null again
16
- if ( _viewModel == null )
17
- {
18
- Settings = Ioc . Default . GetRequiredService < Settings > ( ) ;
19
- _viewModel = Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) ;
20
- }
15
+ // Sometimes the navigation is not triggered by button click,
16
+ // so we need to reset the page number
17
+ _viewModel . PageNum = 3 ;
18
+
21
19
if ( ! IsInitialized )
22
20
{
23
21
InitializeComponent ( ) ;
24
22
}
25
- // Sometimes the navigation is not triggered by button click,
26
- // so we need to reset the page number
27
- _viewModel . PageNum = 3 ;
28
23
base . OnNavigatedTo ( e ) ;
29
24
}
30
25
}
Original file line number Diff line number Diff line change @@ -7,24 +7,19 @@ namespace Flow.Launcher.Resources.Pages
7
7
{
8
8
public partial class WelcomePage4
9
9
{
10
- public Settings Settings { get ; private set ; }
11
- private WelcomeViewModel _viewModel ;
10
+ public Settings Settings { get ; } = Ioc . Default . GetRequiredService < Settings > ( ) ;
11
+ private readonly WelcomeViewModel _viewModel = Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) ;
12
12
13
13
protected override void OnNavigatedTo ( NavigationEventArgs e )
14
14
{
15
- // If the navigation is not triggered by button click, view model will be null again
16
- if ( _viewModel == null )
17
- {
18
- Settings = Ioc . Default . GetRequiredService < Settings > ( ) ;
19
- _viewModel = Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) ;
20
- }
15
+ // Sometimes the navigation is not triggered by button click,
16
+ // so we need to reset the page number
17
+ _viewModel . PageNum = 4 ;
18
+
21
19
if ( ! IsInitialized )
22
20
{
23
21
InitializeComponent ( ) ;
24
22
}
25
- // Sometimes the navigation is not triggered by button click,
26
- // so we need to reset the page number
27
- _viewModel . PageNum = 4 ;
28
23
base . OnNavigatedTo ( e ) ;
29
24
}
30
25
}
Original file line number Diff line number Diff line change @@ -10,24 +10,19 @@ namespace Flow.Launcher.Resources.Pages
10
10
{
11
11
public partial class WelcomePage5
12
12
{
13
- public Settings Settings { get ; private set ; }
14
- private WelcomeViewModel _viewModel ;
13
+ public Settings Settings { get ; } = Ioc . Default . GetRequiredService < Settings > ( ) ;
14
+ private readonly WelcomeViewModel _viewModel = Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) ;
15
15
16
16
protected override void OnNavigatedTo ( NavigationEventArgs e )
17
17
{
18
- // If the navigation is not triggered by button click, view model will be null again
19
- if ( _viewModel == null )
20
- {
21
- Settings = Ioc . Default . GetRequiredService < Settings > ( ) ;
22
- _viewModel = Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) ;
23
- }
18
+ // Sometimes the navigation is not triggered by button click,
19
+ // so we need to reset the page number
20
+ _viewModel . PageNum = 5 ;
21
+
24
22
if ( ! IsInitialized )
25
23
{
26
24
InitializeComponent ( ) ;
27
25
}
28
- // Sometimes the navigation is not triggered by button click,
29
- // so we need to reset the page number
30
- _viewModel . PageNum = 5 ;
31
26
base . OnNavigatedTo ( e ) ;
32
27
}
33
28
You can’t perform that action at this time.
0 commit comments