Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Knossos.NET/Classes/Knossos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
37 changes: 35 additions & 2 deletions Knossos.NET/ViewModels/ModListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,6 +29,9 @@ public partial class ModListViewModel : ViewModelBase
/// </summary>
internal ModSortType localSort = ModSortType.name;

[ObservableProperty]
internal bool fs2Present = true;

internal string search = string.Empty;
internal string Search
{
Expand Down Expand Up @@ -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
Expand All @@ -165,6 +169,14 @@ private void BuildFilterString(){
}
}

/// <summary>
/// Used to signal the mod list view to update its "have you installed FS2" button
/// </summary>
public void UpdateFS2InstallButton()
{
Fs2Present = Knossos.retailFs2RootFound;
}

/// <summary>
///
/// </summary>
Expand All @@ -182,7 +194,12 @@ public void OpenTab()
}
}

SortString = "Sorted by " + Search;
if (Knossos.initIsComplete)
{
Fs2Present = Knossos.retailFs2RootFound;
}

SortString = "Sorted by " + localSort;
BuildFilterString();
}

Expand Down Expand Up @@ -318,5 +335,21 @@ public void RemoveModVersion(Mod mod)
}
}
}

/// <summary>
/// Open the retails FS2 installer window
/// </summary>
internal async void InstallFS2Command()
{
if (MainWindow.instance != null)
{
var dialog = new Fs2InstallerView();
dialog.DataContext = new Fs2InstallerViewModel();

await dialog.ShowDialog<Fs2InstallerView?>(MainWindow.instance);

Fs2Present = Knossos.retailFs2RootFound;
}
}
}
}
35 changes: 34 additions & 1 deletion Knossos.NET/ViewModels/NebulaModListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -47,6 +48,9 @@ internal bool isLoading{
[ObservableProperty]
internal LoadingIconViewModel loadingAnimation = new LoadingIconViewModel();

[ObservableProperty]
internal bool fs2Present = true;

/// <summary>
/// Search string
/// </summary>
Expand Down Expand Up @@ -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
Expand All @@ -188,12 +192,21 @@ private void BuildFilterString(){
}
}

/// <summary>
/// Used to signal the mod list view to update its "have you installed FS2" button
/// </summary>
public void UpdateFS2InstallButton()
{
Fs2Present = Knossos.retailFs2RootFound;
}

/// <summary>
/// Open the tab code
/// </summary>
public void OpenTab()
{
IsTabOpen = true;

if (!isLoading)
{
Task.Run(() =>
Expand Down Expand Up @@ -223,6 +236,11 @@ public void OpenTab()
ShowTiles = true;
});
}

if (Knossos.initIsComplete)
{
Fs2Present = Knossos.retailFs2RootFound;
}
}

/// <summary>
Expand Down Expand Up @@ -371,5 +389,20 @@ public void CancelModInstall(string id)
modCard.CancelInstall();
}
}

/// <summary>
/// Open the retails FS2 installer window
/// </summary>
internal async void InstallFS2Command()
{
if (MainWindow.instance != null)
{
var dialog = new Fs2InstallerView();
dialog.DataContext = new Fs2InstallerViewModel();

await dialog.ShowDialog<Fs2InstallerView?>(MainWindow.instance);
Fs2Present = Knossos.retailFs2RootFound;
}
}
}
}
5 changes: 5 additions & 0 deletions Knossos.NET/Views/ModListView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
</StackPanel>
</WrapPanel>
<WrapPanel Margin="10" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right">
<Button Margin="0,0,5,0" Height="42" Width="100" HorizontalAlignment="Right" Classes="Primary" IsVisible="{Binding !Fs2Present}" Command="{Binding InstallFS2Command}" FontSize="12" ToolTip.Tip="Add Freespace 2 to your knossos.NET library by pointing at a current installation or by using the GOG.com installer. Mods with a Freespace dependency will not appear without this in your library.">
<TextBlock HorizontalAlignment="Center" TextAlignment="Center" MaxWidth="100" TextWrapping="Wrap">
Find/Install Freespace 2
</TextBlock>
</Button>
<Button ToolTip.Tip="View Color Codes" HorizontalAlignment="Right">
<Image Height="30" Width="30" Source="/Assets/general/questionmark.png"></Image>
<Button.Flyout>
Expand Down
5 changes: 5 additions & 0 deletions Knossos.NET/Views/NebulaModListView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
</StackPanel>
</WrapPanel>
<WrapPanel Margin="10" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right">
<Button Margin="0,0,5,0" Height="42" Width="100" HorizontalAlignment="Right" Classes="Primary" IsVisible="{Binding !Fs2Present}" Command="{Binding InstallFS2Command}" FontSize="11" ToolTip.Tip="Add Freespace 2 to your knossos.NET library by pointing at a current installation or by using the GOG.com installer. Mods with a Freespace dependency will not appear without this in your library.">
<TextBlock HorizontalAlignment="Center" TextAlignment="Center" MaxWidth="100" TextWrapping="Wrap">
Find/Install Freespace 2
</TextBlock>
</Button>
<Button Command="{Binding ReloadRepoCommand}" ToolTip.Tip="Refresh">
<Image Height="30" Width="30" Source="/Assets/general/refresh.png"></Image>
</Button>
Expand Down
2 changes: 1 addition & 1 deletion Knossos.NET/Views/Windows/Fs2InstallerView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Button Classes="Quaternary" IsEnabled="{Binding !IsInstalling}" Margin="10" Command="{Binding LoadFolderCommand}">Browse Folder</Button>
<Label Margin="5" FontWeight="Bold">Required File List:</Label>
<TextBlock Margin="10,0,0,0" Text="root_fs2.vp, smarty_fs2.vp, sparky_fs2.vp, sparky_hi_fs2.vp, stu_fs2.vp, tango1_fs2.vp, tango2_fs2.vp, tango3_fs2.vp, warble_fs2.vp" TextWrapping="Wrap"></TextBlock>
<Label Margin="5" FontWeight="Bold">After copying the files to the KnossosNET library, the original install is not longer needed.</Label>
<Label Margin="5" FontWeight="Bold">After copying the files to the KnossosNET library, the original installation is not longer needed.</Label>
</StackPanel>
</Border>

Expand Down