E586 Merge pull request #2366 from Nexus-Mods/fix/mygames-empty-nogames · FOSS-Archives/NexusMods.App@aee540d · GitHub
[go: up one dir, main page]

Skip to content

Commit aee540d

Browse files
authored
Merge pull request Nexus-Mods#2366 from Nexus-Mods/fix/mygames-empty-nogames
Added empty text when no game installs found
2 parents fcc46e3 + 46df0d1 commit aee540d

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

src/NexusMods.App.UI/Controls/MiniGameWidget/MiniGameWidget.axaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ public MiniGameWidget()
4141
this.WhenAnyValue(view => view.ViewModel!.GameInstallations)
4242
.Subscribe(installations =>
4343
{
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()));
4548
ToolTip.SetTip(IsFoundTextBlock, tooltip);
4649
}
4750
)

src/NexusMods.App.UI/Pages/MyGames/MyGamesView.axaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
<TextBlock Text="Add games to get started"
3535
Theme="{StaticResource HeadingXSSemiTheme}"
3636
Foreground="{StaticResource NeutralStrongBrush}" />
37+
<TextBlock x:Name="NoGamesDetectedText"
38+
Text="No games detected"
39+
Theme="{StaticResource BodyMDNormalTheme}"
40+
Foreground="{StaticResource NeutralSubduedBrush}" />
3741
<ItemsControl
3842
x:Name="DetectedGamesItemsControl">
3943
<ItemsControl.ItemsPanel>

src/NexusMods.App.UI/Pages/MyGames/MyGamesView.axaml.cs

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,31 @@ public MyGamesView()
1212
InitializeComponent();
1313

1414
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+
);
3041
}
3142
}
32-

0 commit comments

Comments
 (0)
0