Save list of compiled modlists, show them in CreateModListView

This commit is contained in:
trawzified 2024-04-28 22:21:22 +02:00
parent ee086596fc
commit e2106a0c14
21 changed files with 128 additions and 376 deletions

View File

@ -168,9 +168,8 @@ namespace Wabbajack
services.AddTransient<HomeVM>();
services.AddTransient<ModListGalleryVM>();
services.AddTransient<CreateModListVM>();
services.AddTransient<CompilerVM>();
services.AddTransient<InstallerVM>();
services.AddTransient<CreateModListVM>();
services.AddTransient<InstallerVM>();
services.AddTransient<SettingsVM>();
services.AddTransient<WebBrowserVM>();

View File

@ -23,4 +23,5 @@ public static class Consts
public static byte SettingsVersion = 0;
public static RelativePath NativeSettingsJson = "native_settings.json".ToRelativePath();
public const string AllSavedCompilerSettingsPaths = "all-compiler-settings-paths";
}

View File

@ -8,7 +8,8 @@ public enum ScreenType
ModListGallery,
Installer,
Settings,
CreateAList,
Compiler,
CreateModList,
ModListContents,
WebBrowser
}

View File

@ -1,4 +1,6 @@
using Wabbajack.Downloaders;
using System.Collections.Generic;
using Wabbajack.Compiler;
using Wabbajack.Downloaders;
using Wabbajack.DTOs.JsonConverters;
using Wabbajack.Paths;
using Wabbajack.RateLimiter;
@ -51,4 +53,12 @@ namespace Wabbajack
MaximumMemoryPerDownloadThreadMb = _defaultMaximumMemoryPerDownloadThreadMb;
}
}
public class GalleryFilterSettings
{
public string GameType { get; set; }
public bool ShowNSFW { get; set; }
public bool ShowUnofficialLists { get; set; }
public bool OnlyInstalled { get; set; }
public string Search { get; set; }
}
}

View File

@ -42,8 +42,9 @@ namespace Wabbajack
return img;
}
public static BitmapImage BitmapImageFromWebp(byte[] bytes, bool getThumbnail = false)
public static BitmapImage BitmapImageFromWebp(MemoryStream stream, bool getThumbnail = false)
{
byte[] bytes = stream.ToArray();
using(WebP webp = new())
{
Bitmap bitmap;
@ -163,7 +164,7 @@ namespace Wabbajack
catch(NotSupportedException)
{
if (isWebp)
return BitmapImageFromWebp(memStream.ToArray());
return BitmapImageFromWebp(memStream);
throw;
}
}

View File

@ -31,8 +31,6 @@ using Wabbajack.Services.OSIntegrated;
namespace Wabbajack
{
public enum CompilerState
{
Configuration,
@ -42,7 +40,6 @@ namespace Wabbajack
}
public class CompilerVM : BackNavigatingVM, ICpuStatusVM
{
private const string LastSavedCompilerSettings = "last-saved-compiler-settings";
private readonly DTOSerializer _dtos;
private readonly SettingsManager _settingsManager;
private readonly IServiceProvider _serviceProvider;
@ -268,7 +265,6 @@ namespace Wabbajack
Ignore = settings.Ignore;
if (path.FileName == "modlist.txt".ToRelativePath())
{
await SaveSettingsFile();
await LoadLastSavedSettings();
}
}
@ -379,15 +375,26 @@ namespace Wabbajack
private async Task SaveSettingsFile()
{
if (Source == default) return;
await using var st = SettingsOutputLocation.Open(FileMode.Create, FileAccess.Write, FileShare.None);
await JsonSerializer.SerializeAsync(st, GetSettings(), _dtos.Options);
await _settingsManager.Save(LastSavedCompilerSettings, SettingsOutputLocation);
var settings = GetSettings();
await using var st = SettingsOutputLocation.Open(FileMode.Create, FileAccess.Write, FileShare.None);
await JsonSerializer.SerializeAsync(st, settings, _dtos.Options);
var allSavedCompilerSettings = await _settingsManager.Load<List<AbsolutePath>>(Consts.AllSavedCompilerSettingsPaths);
allSavedCompilerSettings.Remove(SettingsOutputLocation);
allSavedCompilerSettings.Insert(0, SettingsOutputLocation);
await _settingsManager.Save(Consts.AllSavedCompilerSettingsPaths, allSavedCompilerSettings);
}
private async Task LoadLastSavedSettings()
{
var lastPath = await _settingsManager.Load<AbsolutePath>(LastSavedCompilerSettings);
AbsolutePath lastPath = default;
var allSavedCompilerSettings = await _settingsManager.Load<List<AbsolutePath>>(Consts.AllSavedCompilerSettingsPaths);
if (allSavedCompilerSettings.Any())
lastPath = allSavedCompilerSettings[0];
if (lastPath == default || !lastPath.FileExists() || lastPath.FileName.Extension != Ext.CompilerSettings) return;
ModlistLocation.TargetPath = lastPath;
}

View File

@ -0,0 +1,24 @@
using System.Linq;
using System.Threading;
using Microsoft.Extensions.Logging;
using ReactiveUI.Fody.Helpers;
using Wabbajack.Compiler;
using Wabbajack.DTOs;
using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Services.OSIntegrated.Services;
namespace Wabbajack
{
public class CreatedModlistVM
{
private ILogger _logger;
[Reactive]
public CompilerSettings CompilerSettings { get; set; }
public CreatedModlistVM(ILogger logger, CompilerSettings compilerSettings)
{
_logger = logger;
CompilerSettings = compilerSettings;
}
}
}

View File

@ -1,15 +1,28 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using DynamicData;
using DynamicData.Binding;
using Microsoft.Extensions.Logging;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using SteamKit2.GC.Dota.Internal;
using SteamKit2.Internal;
using Wabbajack.Common;
using Wabbajack.Compiler;
using Wabbajack.DTOs.JsonConverters;
using Wabbajack.Messages;
using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
using Wabbajack.Services.OSIntegrated;
using Wabbajack.Services.OSIntegrated.Services;
@ -20,55 +33,35 @@ namespace Wabbajack
private readonly SettingsManager _settingsManager;
private readonly IServiceProvider _serviceProvider;
private readonly ILogger<CreateModListVM> _logger;
private readonly Client _wjClient;
private readonly ModListDownloadMaintainer _maintainer;
private readonly CancellationToken _cancellationToken;
private readonly DTOSerializer _dtos;
private readonly SourceCache<CreateModListMetadataVM, string> _modLists = new(x => x.Metadata.NamespacedName);
public ReadOnlyObservableCollection<CreateModListMetadataVM> _filteredModLists;
public ICommand CompileModListCommand { get; set; }
[Reactive]
public ObservableCollection<CreatedModlistVM> CreatedModlists { get; set; }
public ReadOnlyObservableCollection<CreateModListMetadataVM> ModLists => _filteredModLists;
public CreateModListVM(ILogger<CreateModListVM> logger, SettingsManager settingsManager,
IServiceProvider serviceProvider, Client wjClient, ModListDownloadMaintainer maintainer)
IServiceProvider serviceProvider, DTOSerializer dtos)
{
_logger = logger;
_settingsManager = settingsManager;
_serviceProvider = serviceProvider;
_wjClient = wjClient;
_maintainer = maintainer;
LoadModLists().FireAndForget();
this.WhenActivated(disposables =>
{
_modLists.Connect()
.ObserveOn(RxApp.MainThreadScheduler)
.Bind(out _filteredModLists)
.Subscribe((_) => { })
.DisposeWith(disposables);
});
_dtos = dtos;
CompileModListCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(ScreenType.Compiler));
LoadAllCompilerSettings().FireAndForget();
}
private async Task LoadModLists()
private async Task LoadAllCompilerSettings()
{
using var ll = LoadingLock.WithLoading();
try
CreatedModlists = new();
var savedCompilerSettingsPaths = await _settingsManager.Load<List<AbsolutePath>>(Consts.AllSavedCompilerSettingsPaths);
foreach(var settingsPath in savedCompilerSettingsPaths)
{
var modLists = await _wjClient.LoadLists();
_modLists.Edit(e =>
{
e.Clear();
e.AddOrUpdate(modLists.Select(m =>
new CreateModListMetadataVM(_logger, this, m, _maintainer, _wjClient, _cancellationToken)));
});
await using var fs = settingsPath.Open(FileMode.Open, FileAccess.Read, FileShare.Read);
var settings = (await _dtos.DeserializeAsync<CompilerSettings>(fs))!;
CreatedModlists.Add(new CreatedModlistVM(_logger, settings));
}
catch (Exception ex)
{
_logger.LogError(ex, "While loading lists");
ll.Fail();
}
ll.Succeed();
}
}
}

View File

@ -1,25 +0,0 @@
using System.Linq;
using System.Threading;
using Microsoft.Extensions.Logging;
using ReactiveUI.Fody.Helpers;
using Wabbajack.Compiler;
using Wabbajack.DTOs;
using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Services.OSIntegrated.Services;
namespace Wabbajack
{
public class CreateModListMetadataVM : BaseModListMetadataVM
{
private CreateModListVM _parent;
[Reactive]
public CompilerSettings CompilerSettings { get; set; }
public CreateModListMetadataVM(ILogger logger, CreateModListVM parent, ModlistMetadata metadata,
ModListDownloadMaintainer maintainer, Client wjClient, CancellationToken cancellationToken) : base(logger, metadata, maintainer, wjClient, cancellationToken)
{
_parent = parent;
CompilerSettings = _parent.ModLists.FirstOrDefault(ml => ml.Metadata.Links.MachineURL == wjClient.GetMyModlists());
}
}
}

View File

@ -225,15 +225,6 @@ namespace Wabbajack
});
}
private class FilterSettings
{
public string GameType { get; set; }
public bool ShowNSFW { get; set; }
public bool ShowUnofficialLists { get; set; }
public bool OnlyInstalled { get; set; }
public string Search { get; set; }
}
public override void Unload()
{
Error = null;
@ -241,7 +232,7 @@ namespace Wabbajack
private async Task SaveSettings()
{
await _settingsManager.Save("modlist_gallery", new FilterSettings
await _settingsManager.Save("modlist_gallery", new GalleryFilterSettings
{
GameType = GameType,
ShowNSFW = ShowNSFW,
@ -254,7 +245,7 @@ namespace Wabbajack
private async Task LoadSettings()
{
using var ll = LoadingLock.WithLoading();
RxApp.MainThreadScheduler.Schedule(await _settingsManager.Load<FilterSettings>("modlist_gallery"),
RxApp.MainThreadScheduler.Schedule(await _settingsManager.Load<GalleryFilterSettings>("modlist_gallery"),
(_, s) =>
{
SelectedGameTypeEntry = GameTypeEntries?.FirstOrDefault(gte => gte.GameIdentifier.Equals(s.GameType));

View File

@ -44,7 +44,8 @@ namespace Wabbajack
public ObservableCollectionExtended<IStatusMessage> Log { get; } = new ObservableCollectionExtended<IStatusMessage>();
public readonly CreateModListVM CreateAListVM;
public readonly CompilerVM CompilerVM;
public readonly CreateModListVM CreateModListVM;
public readonly InstallerVM InstallerVM;
public readonly SettingsVM SettingsPaneVM;
public readonly ModListGalleryVM GalleryVM;
@ -78,15 +79,16 @@ namespace Wabbajack
public MainWindowVM(ILogger<MainWindowVM> logger, Client wjClient,
IServiceProvider serviceProvider, HomeVM homeVM, ModListGalleryVM modListGalleryVM, ResourceMonitor resourceMonitor,
InstallerVM installer, CreateModListVM createAListVM, SettingsVM settingsVM, WebBrowserVM webBrowserVM, NavigationVM navigationVM)
InstallerVM installerVM, CompilerVM compilerVM, CreateModListVM createModListVM, SettingsVM settingsVM, WebBrowserVM webBrowserVM, NavigationVM navigationVM)
{
_logger = logger;
_wjClient = wjClient;
_resourceMonitor = resourceMonitor;
_serviceProvider = serviceProvider;
ConverterRegistration.Register();
InstallerVM = installer;
CreateAListVM = createAListVM;
InstallerVM = installerVM;
CompilerVM = compilerVM;
CreateModListVM = createModListVM;
SettingsPaneVM = settingsVM;
GalleryVM = modListGalleryVM;
HomeVM = homeVM;
@ -233,7 +235,8 @@ namespace Wabbajack
ScreenType.Home => HomeVM,
ScreenType.ModListGallery => GalleryVM,
ScreenType.Installer => InstallerVM,
ScreenType.CreateAList => CreateAListVM,
ScreenType.Compiler => CompilerVM,
ScreenType.CreateModList => CreateModListVM,
ScreenType.Settings => SettingsPaneVM,
_ => ActivePane
};

View File

@ -37,7 +37,7 @@ namespace Wabbajack
LoadLastLoadedModlist.Send();
NavigateToGlobal.Send(ScreenType.Installer);
});
CreateAListCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(ScreenType.CreateAList));
CreateModListCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(ScreenType.CreateModList));
SettingsCommand = ReactiveCommand.Create(
/*
canExecute: this.WhenAny(x => x.ActivePane)
@ -58,7 +58,7 @@ namespace Wabbajack
public ICommand HomeCommand { get; }
public ICommand BrowseCommand { get; }
public ICommand InstallCommand { get; }
public ICommand CreateAListCommand { get; }
public ICommand CreateModListCommand { get; }
public ICommand SettingsCommand { get; }
public string Version { get; }
}

View File

@ -14,6 +14,7 @@ using Wabbajack.Common;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
using Wabbajack.ViewModels.Controls;
using Wabbajack.Services.OSIntegrated;
namespace Wabbajack
{

View File

@ -29,7 +29,7 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderBrush="{StaticResource PrimaryVariantBrush}" CornerRadius="8" BorderThickness="19" Margin="0, 0, 20, 20">
<Border Grid.Column="0" BorderBrush="{StaticResource PrimaryVariantBrush}" CornerRadius="8" BorderThickness="19" Margin="0, 0, 20, 20" x:Name="CompileNewModListBorder">
<Grid Background="{StaticResource PrimaryVariantBrush}" Margin="-1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
@ -109,7 +109,7 @@
Recently Compiled Modlists
</TextBlock>
<ScrollViewer Grid.Row="1" Background="Green" VerticalScrollBarVisibility="Auto">
<ScrollViewer Grid.Row="1" Background="Transparent" VerticalScrollBarVisibility="Auto">
<ItemsControl
x:Name="CreatedModListsControl"
HorizontalAlignment="Center"
@ -121,7 +121,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:CreateModListTileView ViewModel="{Binding}" />
<local:CreatedModListTileView ViewModel="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

View File

@ -14,11 +14,13 @@ using Wabbajack.Common;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
using Wabbajack.ViewModels.Controls;
using ReactiveMarbles.ObservableEvents;
using System.Reactive;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for CreateAListView.xaml
/// Interaction logic for CreateModList.xaml
/// </summary>
public partial class CreateModListView : ReactiveUserControl<CreateModListVM>
{
@ -28,11 +30,16 @@ namespace Wabbajack
this.WhenActivated(dispose =>
{
this.WhenAny(x => x.ViewModel.ModLists)
this.WhenAny(x => x.ViewModel.CreatedModlists)
.BindToStrict(this, x => x.CreatedModListsControl.ItemsSource)
.DisposeWith(dispose);
});
CompileNewModListBorder
.Events().MouseDown
.Select(args => Unit.Default)
.InvokeCommand(this, x => x.ViewModel.CompileModListCommand)
.DisposeWith(dispose);
});
}
}
}

View File

@ -1,5 +1,5 @@
<rxui:ReactiveUserControl
x:Class="Wabbajack.CreateModListTileView"
x:Class="Wabbajack.CreatedModListTileView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -10,7 +10,7 @@
xmlns:rxui="http://reactiveui.net"
d:DesignHeight="450"
d:DesignWidth="800"
x:TypeArguments="local:CreateModListMetadataVM"
x:TypeArguments="local:CreatedModlistVM"
mc:Ignorable="d">
<UserControl.Resources>
<Color x:Key="TextBackgroundFill">#92000000</Color>
@ -85,24 +85,6 @@
</Grid.OpacityMask>
<Grid ClipToBounds="True">
<mahapps:ProgressRing x:Name="LoadingProgress" />
<StackPanel Orientation="Horizontal" Margin="5, 5, 0, 0" VerticalAlignment="Top" HorizontalAlignment="Left" Panel.ZIndex="1">
<Border x:Name="GameIcon" Width="24" Height="24" CornerRadius="6">
<Border.Background>
<ImageBrush Stretch="Fill" ImageSource="{Binding GameMetaData.IconSource}"/>
</Border.Background>
</Border>
<Grid Margin="5, 0, 0, 0"
Visibility="{Binding ElementName=CompiledModListTile, Path=IsMouseOver, Converter={StaticResource bool2VisibilityConverter}}">
<TextBlock x:Name="GameName"
Text="{Binding GameMetaData.HumanFriendlyGameName}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Opacity="0.85"
Panel.ZIndex="2"/>
<Border Background="{StaticResource WindowBackgroundBrush}" Opacity="0.4" Width="{Binding ElementName=GameName, Path=ActualWidth,Converter={StaticResource MathConverter}, ConverterParameter=x+10}" Height="{Binding ElementName=GameIcon, Path=ActualHeight}" CornerRadius="6">
</Border>
</Grid>
</StackPanel>
<Border
BorderThickness="0"
HorizontalAlignment="Stretch"
@ -110,19 +92,6 @@
<Border.Background>
<ImageBrush x:Name="ModlistImage" Stretch="UniformToFill"/>
</Border.Background>
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding IsBroken}" Value="True">
<Setter Property="Effect">
<Setter.Value>
<BlurEffect Radius="35" />
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
<Rectangle
Height="120"
@ -204,112 +173,7 @@
Margin="10,242,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="{Binding VersionText}"
Opacity="0">
<Label.Style>
<Style TargetType="Label">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=CompiledModListTile}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0:0:0.08" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0:0:0.08" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
<Label
Margin="10,257,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="{Binding DownloadSizeText}"
Opacity="0">
<Label.Style>
<Style TargetType="Label">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=CompiledModListTile}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0:0:0.08" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0:0:0.08" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
<Label
Margin="10,272,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="{Binding InstallSizeText}"
Opacity="0">
<Label.Style>
<Style TargetType="Label">
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, ElementName=CompiledModListTile}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0:0:0.08" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0:0:0.08" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
<Label
Margin="10,287,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="{Binding TotalSizeRequirementText}"
Content="{Binding CompilerSettings.Version}"
Opacity="0">
<Label.Style>
<Style TargetType="Label">
@ -341,131 +205,11 @@
</Label.Style>
</Label>
</Grid>
<local:UnderMaintenanceOverlay Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
x:Name="Overlay"
Visibility="Collapsed"
ClipToBounds="True" />
<!--
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
x:Name="ModListTitleShadow"
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
FontFamily="{StaticResource PrimaryFont}"
FontSize="30"
FontWeight="Bold"
Style="{StaticResource BackgroundBlurStyle}"
TextWrapping="Wrap">
<TextBlock.Effect>
<BlurEffect Radius="25" />
</TextBlock.Effect>
</TextBlock>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
x:Name="ModListTitle"
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
FontFamily="{StaticResource PrimaryFont}"
FontSize="30"
FontWeight="Bold"
TextWrapping="Wrap">
<TextBlock.Effect>
<DropShadowEffect />
</TextBlock.Effect>
</TextBlock>
<mahapps:MetroProgressBar Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
x:Name="DownloadProgressBar"
Height="3"
VerticalAlignment="Bottom"
Background="{StaticResource BackgroundBrush}"
Foreground="{StaticResource SecondaryBrush}"
Maximum="1"
Visibility="{Binding IsEnabled, ElementName=ExecuteButton, Converter={StaticResource bool2VisibilityHiddenConverter}, ConverterParameter=False}" />
<ScrollViewer Grid.Row="1" Grid.Column="0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<TextBlock
x:Name="MetadataDescription"
Margin="8,5"
VerticalAlignment="Center"
FontSize="14"
TextWrapping="Wrap" />
</ScrollViewer>
<ItemsControl Grid.Row="2" Name="TagsList">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Grid.Row="0" Grid.ColumnSpan="2"
Margin="5,5,0,5"
Background="{StaticResource Analogous1Brush}"
BorderThickness="1"
CornerRadius="7,7,7,7"
VerticalAlignment="Center"
Opacity="0.90">
<TextBlock
Margin="5,5,5,5"
FontSize="15"
Text="{Binding Name}" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Grid Grid.Row="1" Grid.Column="1" Grid.RowSpan="2">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Grid.Row="0"
x:Name="OpenWebsiteButton"
Width="40"
Height="40"
Margin="5,0"
VerticalAlignment="Center"
Style="{StaticResource IconBareButtonStyle}"
ToolTip="View modlist website in browser">
<iconPacks:Material
Width="20"
Height="20"
Kind="Web" />
</Button>
<Button Grid.Row="1"
x:Name="ModListContentsButton"
Width="40"
Height="40"
Margin="5,0"
VerticalAlignment="Center"
Style="{StaticResource IconBareButtonStyle}"
ToolTip="View modlist archives in browser">
<iconPacks:Material
Width="20"
Height="20"
Kind="TableSearch" />
</Button>
<Button Grid.Row="2"
x:Name="ExecuteButton"
Width="40"
Height="40"
Margin="5,0"
VerticalAlignment="Center"
ToolTip="Download modlist">
<StackPanel x:Name="IconContainer">
<iconPacks:Material
x:Name="ErrorIcon"
Width="20"
Height="20"
Kind="Exclamation" />
</StackPanel>
</Button>
</Grid>
-->
</Grid>
</Grid>
</Border>
<TextBlock
Text="{Binding Metadata.Title}"
Text="{Binding CompilerSettings.ModListName}"
FontSize="16"
VerticalAlignment="Bottom"
Margin="10, 0, 0, 10"

View File

@ -8,27 +8,25 @@ namespace Wabbajack
/// <summary>
/// Interaction logic for CreateModListTileView.xaml
/// </summary>
public partial class CreateModListTileView : ReactiveUserControl<CreateModListMetadataVM>
public partial class CreatedModListTileView : ReactiveUserControl<CreatedModlistVM>
{
public CreateModListTileView()
public CreatedModListTileView()
{
InitializeComponent();
this.WhenActivated(disposables =>
{
ViewModel.WhenAnyValue(vm => vm.Image)
ViewModel.WhenAnyValue(vm => vm.CompilerSettings.ModListImage)
.Select(imagePath => { UIUtils.TryGetBitmapImageFromFile(imagePath, out var bitmapImage); return bitmapImage; })
.BindToStrict(this, v => v.ModlistImage.ImageSource)
.DisposeWith(disposables);
var textXformed = ViewModel.WhenAnyValue(vm => vm.Metadata.Title)
.CombineLatest(ViewModel.WhenAnyValue(vm => vm.Metadata.ImageContainsTitle),
ViewModel.WhenAnyValue(vm => vm.IsBroken))
.Select(x => x.Second && !x.Third ? "" : x.First);
/*
ViewModel.WhenAnyValue(x => x.LoadingImageLock.IsLoading)
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
.BindToStrict(this, x => x.LoadingProgress.Visibility)
.DisposeWith(disposables);
*/
});
}
}

View File

@ -67,11 +67,9 @@
<Border Grid.Column="1" Margin="0" Background="{StaticResource ComplementaryBackgroundBrush}" x:Name="MainContent" Padding="18" CornerRadius="8">
<ContentPresenter Content="{Binding ActivePane}" VerticalAlignment="Stretch">
<ContentPresenter.Resources>
<!--
<DataTemplate DataType="{x:Type local:CompilerVM}">
<local:CompilerView ViewModel="{Binding}" />
</DataTemplate>
-->
<DataTemplate DataType="{x:Type local:CreateModListVM}">
<local:CreateModListView ViewModel="{Binding}" />
</DataTemplate>

View File

@ -31,7 +31,6 @@ namespace Wabbajack
.BindToStrict(this, x => x.SizeSliderFilter.Maximum)
.DisposeWith(dispose);
this.WhenAny(x => x.ViewModel.LoadingLock.IsLoading)
.Select(x => x ? Visibility.Visible : Visibility.Collapsed)
.StartWith(Visibility.Collapsed)
@ -53,7 +52,6 @@ namespace Wabbajack
.BindToStrict(this, x => x.NoneFound.Visibility)
.DisposeWith(dispose);
this.BindStrict(ViewModel, vm => vm.Search, x => x.SearchBox.Text)
.DisposeWith(dispose);
this.BindStrict(ViewModel, vm => vm.OnlyInstalled, x => x.OnlyInstalledCheckbox.IsChecked)

View File

@ -23,7 +23,7 @@ namespace Wabbajack
ScreenButtonDictionary = new() {
{ ScreenType.Home, HomeButton },
{ ScreenType.ModListGallery, BrowseButton },
{ ScreenType.CreateAList, CompileButton },
{ ScreenType.CreateModList, CompileButton },
{ ScreenType.Settings, SettingsButton },
};
this.WhenActivated(dispose =>
@ -32,7 +32,7 @@ namespace Wabbajack
.DisposeWith(dispose);
this.BindCommand(ViewModel, vm => vm.HomeCommand, v => v.HomeButton)
.DisposeWith(dispose);
this.BindCommand(ViewModel, vm => vm.CreateAListCommand, v => v.CompileButton)
this.BindCommand(ViewModel, vm => vm.CreateModListCommand, v => v.CompileButton)
.DisposeWith(dispose);
this.BindCommand(ViewModel, vm => vm.SettingsCommand, v => v.SettingsButton)
.DisposeWith(dispose);
@ -44,7 +44,7 @@ namespace Wabbajack
this.WhenAny(x => x.ViewModel.ActiveScreen)
.Subscribe(x => SetActiveScreen(x))
.Subscribe(x => SetButtonActive(x))
.DisposeWith(dispose);
/*
@ -58,7 +58,7 @@ namespace Wabbajack
});
}
private void SetActiveScreen(ScreenType activeScreen)
private void SetButtonActive(ScreenType activeScreen)
{
var activeButtonStyle = (Style)Application.Current.Resources["ActiveNavButtonStyle"];
var mainButtonStyle = (Style)Application.Current.Resources["MainNavButtonStyle"];

View File

@ -111,6 +111,7 @@
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.5" />
<PackageReference Include="Orc.FileAssociation" Version="5.0.0-alpha0061" />
<PackageReference Include="PInvoke.User32" Version="0.7.124" />
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" />
<PackageReference Include="ReactiveUI" Version="19.5.1" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.1" />
<PackageReference Include="ReactiveUI.WPF" Version="19.5.1" />