diff --git a/Knossos.NET/Classes/Knossos.cs b/Knossos.NET/Classes/Knossos.cs
index 62aa3169..61498417 100644
--- a/Knossos.NET/Classes/Knossos.cs
+++ b/Knossos.NET/Classes/Knossos.cs
@@ -819,9 +819,12 @@ await Task.Run(async () => {
//generate mod tag buttons
Dispatcher.UIThread.Invoke(() =>
- {
+ {
NebulaModListView.Instance?.GenerateFilterButtons();
ModListView.Instance?.GenerateFilterButtons();
+ MainWindowViewModel.Instance?.NebulaModsView?.UpdateFS2InstallButton();
+ MainWindowViewModel.Instance?.InstalledModsView?.UpdateFS2InstallButton();
+
});
initIsComplete = true;
diff --git a/Knossos.NET/ViewModels/ModListViewModel.cs b/Knossos.NET/ViewModels/ModListViewModel.cs
index b07b3f61..93bfcaf2 100644
--- a/Knossos.NET/ViewModels/ModListViewModel.cs
+++ b/Knossos.NET/ViewModels/ModListViewModel.cs
@@ -5,6 +5,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Knossos.NET.Classes;
using Knossos.NET.Models;
+using Knossos.NET.Views;
using ObservableCollections;
namespace Knossos.NET.ViewModels
@@ -28,6 +29,9 @@ public partial class ModListViewModel : ViewModelBase
///
internal ModSortType localSort = ModSortType.name;
+ [ObservableProperty]
+ internal bool fs2Present = true;
+
internal string search = string.Empty;
internal string Search
{
@@ -146,7 +150,7 @@ private void BuildFilterString(){
TextInfo myTI = new CultureInfo("en-US", false).TextInfo;
foreach (var filter in MainWindowViewModel.Instance.tagFilter) {
- if (count > 3){
+ if (count > 2){
FilterString += " and ...";
break;
// easiest case, this handles a filter list of one and the start of all other cases
@@ -165,6 +169,14 @@ private void BuildFilterString(){
}
}
+ ///
+ /// Used to signal the mod list view to update its "have you installed FS2" button
+ ///
+ public void UpdateFS2InstallButton()
+ {
+ Fs2Present = Knossos.retailFs2RootFound;
+ }
+
///
///
///
@@ -182,7 +194,12 @@ public void OpenTab()
}
}
- SortString = "Sorted by " + Search;
+ if (Knossos.initIsComplete)
+ {
+ Fs2Present = Knossos.retailFs2RootFound;
+ }
+
+ SortString = "Sorted by " + localSort;
BuildFilterString();
}
@@ -318,5 +335,21 @@ public void RemoveModVersion(Mod mod)
}
}
}
+
+ ///
+ /// Open the retails FS2 installer window
+ ///
+ internal async void InstallFS2Command()
+ {
+ if (MainWindow.instance != null)
+ {
+ var dialog = new Fs2InstallerView();
+ dialog.DataContext = new Fs2InstallerViewModel();
+
+ await dialog.ShowDialog(MainWindow.instance);
+
+ Fs2Present = Knossos.retailFs2RootFound;
+ }
+ }
}
}
diff --git a/Knossos.NET/ViewModels/NebulaModListViewModel.cs b/Knossos.NET/ViewModels/NebulaModListViewModel.cs
index 74dd4f53..6274208a 100644
--- a/Knossos.NET/ViewModels/NebulaModListViewModel.cs
+++ b/Knossos.NET/ViewModels/NebulaModListViewModel.cs
@@ -7,6 +7,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Knossos.NET.Classes;
using Knossos.NET.Models;
+using Knossos.NET.Views;
using ObservableCollections;
namespace Knossos.NET.ViewModels
@@ -47,6 +48,9 @@ internal bool isLoading{
[ObservableProperty]
internal LoadingIconViewModel loadingAnimation = new LoadingIconViewModel();
+ [ObservableProperty]
+ internal bool fs2Present = true;
+
///
/// Search string
///
@@ -169,7 +173,7 @@ private void BuildFilterString(){
TextInfo myTI = new CultureInfo("en-US", false).TextInfo;
foreach (var filter in MainWindowViewModel.Instance.tagFilter) {
- if (count > 3){
+ if (count > 2){
FilterString += " and ...";
break;
// easiest case, this handles a filter list of one and the start of all other cases
@@ -188,12 +192,21 @@ private void BuildFilterString(){
}
}
+ ///
+ /// Used to signal the mod list view to update its "have you installed FS2" button
+ ///
+ public void UpdateFS2InstallButton()
+ {
+ Fs2Present = Knossos.retailFs2RootFound;
+ }
+
///
/// Open the tab code
///
public void OpenTab()
{
IsTabOpen = true;
+
if (!isLoading)
{
Task.Run(() =>
@@ -223,6 +236,11 @@ public void OpenTab()
ShowTiles = true;
});
}
+
+ if (Knossos.initIsComplete)
+ {
+ Fs2Present = Knossos.retailFs2RootFound;
+ }
}
///
@@ -371,5 +389,20 @@ public void CancelModInstall(string id)
modCard.CancelInstall();
}
}
+
+ ///
+ /// Open the retails FS2 installer window
+ ///
+ internal async void InstallFS2Command()
+ {
+ if (MainWindow.instance != null)
+ {
+ var dialog = new Fs2InstallerView();
+ dialog.DataContext = new Fs2InstallerViewModel();
+
+ await dialog.ShowDialog(MainWindow.instance);
+ Fs2Present = Knossos.retailFs2RootFound;
+ }
+ }
}
}
diff --git a/Knossos.NET/Views/ModListView.axaml b/Knossos.NET/Views/ModListView.axaml
index 6ffae928..971fa3cd 100644
--- a/Knossos.NET/Views/ModListView.axaml
+++ b/Knossos.NET/Views/ModListView.axaml
@@ -55,6 +55,11 @@
+
+
diff --git a/Knossos.NET/Views/Windows/Fs2InstallerView.axaml b/Knossos.NET/Views/Windows/Fs2InstallerView.axaml
index f6547165..36ef25fc 100644
--- a/Knossos.NET/Views/Windows/Fs2InstallerView.axaml
+++ b/Knossos.NET/Views/Windows/Fs2InstallerView.axaml
@@ -26,7 +26,7 @@
-
+