mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
Show mod details in apply dialog
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
xmlns:ocWC="clr-namespace:OwlCore.Wpf.Converters;assembly=OwlCore.Wpf"
|
xmlns:ocWC="clr-namespace:OwlCore.Wpf.Converters;assembly=OwlCore.Wpf"
|
||||||
xmlns:ocWCBV="clr-namespace:OwlCore.Wpf.Converters.Bools.Visible;assembly=OwlCore.Wpf"
|
xmlns:ocWCBV="clr-namespace:OwlCore.Wpf.Converters.Bools.Visible;assembly=OwlCore.Wpf"
|
||||||
|
xmlns:controls="clr-namespace:ZuneModdingHelper.Controls"
|
||||||
StartupUri="AppWindow.xaml">
|
StartupUri="AppWindow.xaml">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
@@ -27,6 +28,8 @@
|
|||||||
|
|
||||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||||
<ocWCBV:NotNullToVisibilityConverter x:Key="NotNullToVis" />
|
<ocWCBV:NotNullToVisibilityConverter x:Key="NotNullToVis" />
|
||||||
|
<controls:LowercaseConverter x:Key="ToLower" />
|
||||||
|
<controls:UppercaseConverter x:Key="ToUpper" />
|
||||||
|
|
||||||
<sys:Boolean x:Key="FalseValue">False</sys:Boolean>
|
<sys:Boolean x:Key="FalseValue">False</sys:Boolean>
|
||||||
<sys:Boolean x:Key="TrueValue">True</sys:Boolean>
|
<sys:Boolean x:Key="TrueValue">True</sys:Boolean>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace ZuneModdingHelper
|
|||||||
{
|
{
|
||||||
public const string Title = "Zune Modding Helper";
|
public const string Title = "Zune Modding Helper";
|
||||||
|
|
||||||
public static readonly ReleaseVersion Version = new(2025, 8, 20, 0, Phase.Alpha);
|
public static readonly ReleaseVersion Version = new(2025, 9, 2, 0, Phase.Alpha);
|
||||||
public static readonly string VersionStr = Version.ToString();
|
public static readonly string VersionStr = Version.ToString();
|
||||||
public static readonly Uri RepoUri = new($"https://github.com/ZuneDev/ZuneModdingHelper");
|
public static readonly Uri RepoUri = new($"https://github.com/ZuneDev/ZuneModdingHelper");
|
||||||
public static readonly Uri VersionUri = new($"{RepoUri}/releases/tag/{VersionStr}");
|
public static readonly Uri VersionUri = new($"{RepoUri}/releases/tag/{VersionStr}");
|
||||||
|
|||||||
+29
-6
@@ -1,4 +1,4 @@
|
|||||||
<Window x:Class="ZuneModdingHelper.AbstractUIGroupDialog"
|
<Window x:Class="ZuneModdingHelper.ApplyModDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
@@ -6,9 +6,13 @@
|
|||||||
xmlns:local="clr-namespace:ZuneModdingHelper"
|
xmlns:local="clr-namespace:ZuneModdingHelper"
|
||||||
xmlns:absui="clr-namespace:OwlCore.Wpf.AbstractUI.Controls;assembly=OwlCore.Wpf"
|
xmlns:absui="clr-namespace:OwlCore.Wpf.AbstractUI.Controls;assembly=OwlCore.Wpf"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Options" Height="400" Width="700"
|
Title="{x:Static local:App.Title}" Height="400" Width="700"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Foreground="White">
|
Foreground="White">
|
||||||
|
<d:Window.DataContext>
|
||||||
|
<local:ApplyModDialogViewModel/>
|
||||||
|
</d:Window.DataContext>
|
||||||
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
@@ -17,7 +21,7 @@
|
|||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
<Style x:Key="AbstractUICollectionTitleStyle" TargetType="TextBlock">
|
<Style x:Key="AbstractUICollectionTitleStyle" TargetType="TextBlock">
|
||||||
<Setter Property="FontSize" Value="24"/>
|
<Setter Property="FontSize" Value="20"/>
|
||||||
<Setter Property="FontWeight" Value="Light"/>
|
<Setter Property="FontWeight" Value="Light"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
@@ -41,11 +45,30 @@
|
|||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- Body -->
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||||
<absui:AbstractUIGroupPresenter x:Name="OptionsUIPresenter" ViewModel="{Binding}"
|
<StackPanel>
|
||||||
TemplateSelector="{StaticResource GroupTemplateSelector}"/>
|
<!-- Details -->
|
||||||
|
<TextBlock TextWrapping="Wrap">
|
||||||
|
<Run Text="{Binding Metadata.Title, Converter={StaticResource ToLower}}" FontSize="24" FontWeight="Light" />
|
||||||
|
<LineBreak/>
|
||||||
|
<Run Text="BY" Foreground="{StaticResource ZunePinkBrush}" FontWeight="SemiBold" />
|
||||||
|
<Run Text="{Binding Metadata.Author, Converter={StaticResource ToUpper}}"
|
||||||
|
Foreground="{StaticResource ZunePinkBrush}" FontWeight="SemiBold" />
|
||||||
|
<LineBreak/><LineBreak/>
|
||||||
|
<Run Text="{Binding FullDescription, Mode=OneTime}" />
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
|
<Separator Margin="0, 16, 0, 12" />
|
||||||
|
|
||||||
|
<!-- Options -->
|
||||||
|
<absui:AbstractUIGroupPresenter x:Name="OptionsUIPresenter"
|
||||||
|
DataContext="{Binding OptionsUI}" ViewModel="{Binding}"
|
||||||
|
TemplateSelector="{StaticResource GroupTemplateSelector}"/>
|
||||||
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
<Border Grid.Row="1" Margin="0,8,0,0">
|
<Border Grid.Row="1" Margin="0,8,0,0">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -64,7 +87,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Grid.Resources>
|
</Grid.Resources>
|
||||||
|
|
||||||
<Button x:Name="OptionsUINextButton" Content="NEXT" Click="OptionsUINextButton_Click"
|
<Button x:Name="OptionsUINextButton" Content="APPLY" Click="OptionsUINextButton_Click"
|
||||||
Grid.Column="1"/>
|
Grid.Column="1"/>
|
||||||
|
|
||||||
<Button x:Name="OptionsUICancelButton" Content="CANCEL" Click="OptionsUICancelButton_Click"
|
<Button x:Name="OptionsUICancelButton" Content="CANCEL" Click="OptionsUICancelButton_Click"
|
||||||
+24
-15
@@ -4,13 +4,14 @@ using System.Runtime.InteropServices;
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
using ZuneModCore;
|
||||||
|
|
||||||
namespace ZuneModdingHelper
|
namespace ZuneModdingHelper
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for AbstractUIGroupDialog.xaml
|
/// Interaction logic for ApplyModDialog.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class AbstractUIGroupDialog : Window
|
public partial class ApplyModDialog : Window
|
||||||
{
|
{
|
||||||
[LibraryImport("DwmApi")]
|
[LibraryImport("DwmApi")]
|
||||||
private static partial int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
|
private static partial int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
|
||||||
@@ -27,20 +28,14 @@ namespace ZuneModdingHelper
|
|||||||
|
|
||||||
if (DwmSetWindowAttribute(handle, 19, [1], 4) != 0)
|
if (DwmSetWindowAttribute(handle, 19, [1], 4) != 0)
|
||||||
_ = DwmSetWindowAttribute(handle, 20, [1], 4);
|
_ = DwmSetWindowAttribute(handle, 20, [1], 4);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractUIGroupDialog(AbstractUICollectionViewModel viewModel)
|
public ApplyModDialog(ApplyModDialogViewModel viewModel)
|
||||||
{
|
{
|
||||||
ViewModel = viewModel;
|
DataContext = viewModel;
|
||||||
DataContext = ViewModel;
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
public AbstractUIGroupDialog(AbstractUICollection group) : this(new AbstractUICollectionViewModel(group))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OptionsUINextButton_Click(object sender, RoutedEventArgs e) => Finish(true);
|
private void OptionsUINextButton_Click(object sender, RoutedEventArgs e) => Finish(true);
|
||||||
|
|
||||||
@@ -52,12 +47,26 @@ namespace ZuneModdingHelper
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractUICollectionViewModel ViewModel
|
public ApplyModDialogViewModel ViewModel => (ApplyModDialogViewModel)DataContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public record ApplyModDialogViewModel(AbstractUICollectionViewModel OptionsUI, ModMetadata Metadata)
|
||||||
|
{
|
||||||
|
public ApplyModDialogViewModel(Mod mod)
|
||||||
|
: this(new AbstractUICollectionViewModel(mod.OptionsUI), mod.Metadata)
|
||||||
{
|
{
|
||||||
get => (AbstractUICollectionViewModel)GetValue(ViewModelProperty);
|
|
||||||
set => SetValue(ViewModelProperty, value);
|
|
||||||
}
|
}
|
||||||
public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register(
|
|
||||||
nameof(ViewModel), typeof(AbstractUICollectionViewModel), typeof(AbstractUIGroupDialog));
|
public ApplyModDialogViewModel() : this(null, null) { }
|
||||||
|
|
||||||
|
public string FullDescription => GetFullDescription();
|
||||||
|
|
||||||
|
private string GetFullDescription()
|
||||||
|
{
|
||||||
|
if (Metadata.ExtendedDescription is null)
|
||||||
|
return Metadata.Description;
|
||||||
|
|
||||||
|
return Metadata.Description + "\r\n\r\n" + Metadata.ExtendedDescription;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace ZuneModdingHelper.Controls;
|
||||||
|
|
||||||
|
public abstract class TextTransformerConverter : DependencyObject, IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) => TransformText(value?.ToString());
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => value?.ToString();
|
||||||
|
|
||||||
|
public abstract string TransformText(string value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class LowercaseConverter : TextTransformerConverter
|
||||||
|
{
|
||||||
|
public override string TransformText(string value) => value.ToLower();
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed class UppercaseConverter : TextTransformerConverter
|
||||||
|
{
|
||||||
|
public override string TransformText(string value) => value.ToUpper();
|
||||||
|
}
|
||||||
@@ -58,7 +58,7 @@ namespace ZuneModdingHelper.Pages
|
|||||||
progDialog.Description = $"Awaiting options for '{modTitle}'...";
|
progDialog.Description = $"Awaiting options for '{modTitle}'...";
|
||||||
if (mod.OptionsUI != null)
|
if (mod.OptionsUI != null)
|
||||||
{
|
{
|
||||||
var optionsDialog = new AbstractUIGroupDialog(mod.OptionsUI);
|
var optionsDialog = new ApplyModDialog(new(mod));
|
||||||
optionsDialog.Title = optionsDialog.Title + " | " + modTitle;
|
optionsDialog.Title = optionsDialog.Title + " | " + modTitle;
|
||||||
bool? optionsResult = optionsDialog.ShowDialog();
|
bool? optionsResult = optionsDialog.ShowDialog();
|
||||||
if (!(optionsResult.HasValue && optionsResult.Value))
|
if (!(optionsResult.HasValue && optionsResult.Value))
|
||||||
@@ -66,7 +66,7 @@ namespace ZuneModdingHelper.Pages
|
|||||||
WeakReferenceMessenger.Default.Send<CloseDialogMessage>();
|
WeakReferenceMessenger.Default.Send<CloseDialogMessage>();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mod.OptionsUI = (AbstractUICollection)optionsDialog.ViewModel.Model;
|
mod.OptionsUI = (AbstractUICollection)optionsDialog.ViewModel.OptionsUI.Model;
|
||||||
}
|
}
|
||||||
++progDialog.Progress;
|
++progDialog.Progress;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user