File tree Expand file tree Collapse file tree 3 files changed +34
-17
lines changed Expand file tree Collapse file tree 3 files changed +34
-17
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,10 @@ public MiniGameWidget()
41
41
this . WhenAnyValue ( view => view . ViewModel ! . GameInstallations )
42
42
. Subscribe ( installations =>
43
43
{
44
- var tooltip = string . Join ( ", " , installations ! . Select ( installation => installation . Store . ToString ( ) ) ) ;
44
+ if ( installations is null )
45
+ return ;
46
+
47
+ var tooltip = string . Join ( ", " , installations . Select ( installation => installation . Store . ToString ( ) ) ) ;
45
48
ToolTip . SetTip ( IsFoundTextBlock , tooltip ) ;
46
49
}
47
50
)
Original file line number Diff line number Diff line change 34
34
<TextBlock Text =" Add games to get started"
35
35
Theme =" {StaticResource HeadingXSSemiTheme}"
36
36
Foreground =" {StaticResource NeutralStrongBrush}" />
37
+ <TextBlock x : Name =" NoGamesDetectedText"
38
+ Text =" No games detected"
39
+ Theme =" {StaticResource BodyMDNormalTheme}"
40
+ Foreground =" {StaticResource NeutralSubduedBrush}" />
37
41
<ItemsControl
38
42
x : Name =" DetectedGamesItemsControl" >
39
43
<ItemsControl .ItemsPanel>
Original file line number Diff line number Diff line change @@ -12,21 +12,31 @@ public MyGamesView()
12
12
InitializeComponent ( ) ;
13
13
14
14
this . WhenActivated ( d =>
15
- {
16
- this . WhenAnyValue ( view => view . ViewModel ! . InstalledGames )
17
- . BindToView ( this , view => view . DetectedGamesItemsControl . ItemsSource )
18
- . DisposeWith ( d ) ;
19
-
20
- this . WhenAnyValue ( view => view . ViewModel ! . SupportedGames )
21
- . BindToView ( this , view => view . SupportedGamesItemsControl . ItemsSource )
22
- . DisposeWith ( d ) ;
23
-
24
- this . BindCommand ( ViewModel , vm => vm . GiveFeedbackCommand , view => view . GiveFeedbackButton )
25
- . DisposeWith ( d ) ;
26
-
27
- this . BindCommand ( ViewModel , vm => vm . OpenRoadmapCommand , view => view . OpenRoadmapButton )
28
- . DisposeWith ( d ) ;
29
- } ) ;
15
+ {
16
+ this . WhenAnyValue ( view => view . ViewModel ! . InstalledGames )
17
+ . BindToView ( this , view => view . DetectedGamesItemsControl . ItemsSource )
18
+ . DisposeWith ( d ) ;
19
+
20
+ this . WhenAnyValue ( view => view . ViewModel ! . SupportedGames )
21
+ . BindToView ( this , view => view . SupportedGamesItemsControl . ItemsSource )
22
+ . DisposeWith ( d ) ;
23
+
24
+ this . BindCommand ( ViewModel , vm => vm . GiveFeedbackCommand , view => view . GiveFeedbackButton )
25
+ . DisposeWith ( d ) ;
26
+
27
+ this . BindCommand ( ViewModel , vm => vm . OpenRoadmapCommand , view => view . OpenRoadmapButton )
28
+ . DisposeWith ( d ) ;
29
+
30
+ this . WhenAnyValue ( view => view . ViewModel ! . InstalledGames . Count )
31
+ . Select ( installedCount => installedCount == 0 )
32
+ . Subscribe ( isEmpty =>
33
+ {
34
+ NoGamesDetectedText . IsVisible = isEmpty ;
35
+ DetectedGamesItemsControl . IsVisible = ! isEmpty ;
36
+ }
37
+ )
38
+ . DisposeWith ( d ) ;
39
+ }
40
+ ) ;
30
41
}
31
42
}
32
-
You can’t perform that action at this time.
0 commit comments