mirror of
https://github.com/k1tbyte/Wand-Enhancer.git
synced 2026-08-30 22:01:23 +00:00
e04e313fa3
Introduce IShellView and IFileDialogs so MainWindowVm no longer holds the concrete window or reaches through MainWindow.Instance, and file pickers are injectable. Run Restore off the UI thread like Patch and gate both buttons on IsBusy. Gate the log commands on a non-empty log. Move runtime log messages into the locale dictionaries and add the 14 new keys to all 12 languages. Track the injected locale dictionary so switching language replaces it instead of appending a new one each time. Remove the unused InfoItem control, ToVisibilityInvertedConverter, mw_title and the popup placeholder title.
226 lines
12 KiB
XML
226 lines
12 KiB
XML
<Window x:Class="WandEnhancer.View.MainWindow.MainWindow"
|
|
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"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:local="clr-namespace:WandEnhancer.View.MainWindow"
|
|
xmlns:controls="clr-namespace:WandEnhancer.View.Controls"
|
|
mc:Ignorable="d"
|
|
d:DataContext="{d:DesignInstance local:MainWindowVm}"
|
|
Title="WandEnhancer"
|
|
Height="510" MaxHeight="510"
|
|
Width="780" MaxWidth="780"
|
|
Opacity="0.97"
|
|
Background="Transparent"
|
|
WindowStyle="None"
|
|
FontFamily="{StaticResource Inter}"
|
|
AllowsTransparency="True">
|
|
<Border CornerRadius="7" Background="{DynamicResource Background}"
|
|
BorderBrush="{DynamicResource Border}"
|
|
BorderThickness="1" Margin="10">
|
|
<Border.Effect>
|
|
<DropShadowEffect BlurRadius="15" Direction="-90"
|
|
RenderingBias="Quality" ShadowDepth="2"/>
|
|
</Border.Effect>
|
|
|
|
<Grid>
|
|
<Grid Background="Transparent" VerticalAlignment="Top"
|
|
MouseLeftButtonDown="OnDragMove" Height="55">
|
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="25 0 0 0">
|
|
<Viewbox VerticalAlignment="Center" Width="32" Height="32">
|
|
<Path
|
|
Fill="White" Data="{StaticResource Logo}"/>
|
|
</Viewbox>
|
|
<TextBlock Foreground="{DynamicResource Foreground}"
|
|
FontWeight="SemiBold" Opacity="0.9"
|
|
VerticalAlignment="Center"
|
|
FontSize="18" Margin="10 0 0 0">
|
|
<Bold>
|
|
WandEnhancer
|
|
</Bold>
|
|
</TextBlock>
|
|
<TextBlock x:Name="VersionLabel" VerticalAlignment="Bottom"
|
|
Opacity="0.7" FontSize="10" Margin="5 0 0 5"
|
|
Foreground="{DynamicResource Foreground}">
|
|
v 1.0.0
|
|
</TextBlock>
|
|
|
|
</StackPanel>
|
|
|
|
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
|
<Button
|
|
Margin="0 0 5 0"
|
|
Width="25" Height="25" Padding="5.5"
|
|
Style="{StaticResource IconButton}"
|
|
Tag="{StaticResource CogIcon}"
|
|
Command="{Binding OpenSettingsCommand}"
|
|
/>
|
|
<Button
|
|
Margin="9 0 15 0"
|
|
Tag="{StaticResource CloseIcon}"
|
|
Width="25" Height="25" Padding="6.5"
|
|
HorizontalAlignment="Right"
|
|
Click="OnClosing"
|
|
VerticalAlignment="Center">
|
|
<Button.Resources>
|
|
<CornerRadius x:Key="CornerRadius">5 5 5 5</CornerRadius>
|
|
</Button.Resources>
|
|
<Button.Style>
|
|
<Style BasedOn="{StaticResource IconButton}" TargetType="Button">
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="{DynamicResource Secondary}"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource Destructive}"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Button.Style>
|
|
</Button>
|
|
</StackPanel>
|
|
|
|
<Border Background="{DynamicResource Border}" Height="1" VerticalAlignment="Bottom"></Border>
|
|
|
|
</Grid>
|
|
<Grid Margin="0 55 0 0">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition/>
|
|
<RowDefinition Height="50"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<Grid Margin="10" Cursor="Hand" Background="Transparent">
|
|
<TextBox Style="{StaticResource TitledTextBox}"
|
|
IsReadOnly="True"
|
|
Text="{Binding WeModInfo.RootDirectory, Mode=OneWay}"
|
|
VerticalAlignment="Center">
|
|
</TextBox>
|
|
<Grid.InputBindings>
|
|
<MouseBinding Gesture="LeftClick" Command="{Binding SetFolderPathCommand}" />
|
|
</Grid.InputBindings>
|
|
</Grid>
|
|
|
|
|
|
<Border Grid.Row="1" BorderBrush="{DynamicResource Border}" BorderThickness="1"
|
|
Margin="10 0 10 10"
|
|
CornerRadius="5">
|
|
<Grid>
|
|
<ListBox ItemsSource="{Binding LogList}" SelectionMode="Single"
|
|
BorderBrush="Transparent" BorderThickness="0"
|
|
Background="Transparent"
|
|
x:Name="LogList"
|
|
Padding="6"
|
|
ScrollViewer.VerticalScrollBarVisibility="Hidden"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
ScrollViewer.CanContentScroll="False">
|
|
<ListBox.ItemContainerStyle>
|
|
<Style TargetType="ListBoxItem">
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
|
<Setter Property="Margin" Value="0 0 0 5"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="ListBoxItem">
|
|
<Border x:Name="Card" HorizontalAlignment="Left"
|
|
Background="#08fc81"
|
|
BorderBrush="{DynamicResource Border}"
|
|
Padding="5 3 5 3" CornerRadius="3">
|
|
<TextBox Text="{Binding Message}"
|
|
Cursor="IBeam" FontSize="13"
|
|
Background="Transparent" TextWrapping="Wrap"
|
|
BorderThickness="0"
|
|
IsReadOnly="True"/>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding LogType}" Value="Error">
|
|
<Setter TargetName="Card" Property="Background" Value="#f04343"></Setter>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding LogType}" Value="Info">
|
|
<Setter TargetName="Card" Property="Background" Value="#FFF"></Setter>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding LogType}" Value="Warn">
|
|
<Setter TargetName="Card" Property="Background" Value="#facc15"></Setter>
|
|
</DataTrigger>
|
|
</ControlTemplate.Triggers>
|
|
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</ListBox.ItemContainerStyle>
|
|
</ListBox>
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top"
|
|
Margin="0 4 4 0">
|
|
<Button Width="22" Height="22" Padding="4"
|
|
Style="{StaticResource IconButton}"
|
|
Tag="{StaticResource CopyIcon}"
|
|
ToolTip="{DynamicResource mw_copy_logs}"
|
|
Command="{Binding CopyLogsCommand}"/>
|
|
<Button Width="22" Height="22" Padding="4" Margin="4 0 0 0"
|
|
Style="{StaticResource IconButton}"
|
|
Tag="{StaticResource ExportIcon}"
|
|
ToolTip="{DynamicResource mw_export_logs}"
|
|
Command="{Binding ExportLogsCommand}"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
</Border>
|
|
|
|
|
|
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Row="2" Margin="10 0 10 10">
|
|
<Grid>
|
|
<Grid HorizontalAlignment="Right" >
|
|
<Grid.Style>
|
|
<Style TargetType="{x:Type Grid}">
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsPatchEnabled}" Value="False">
|
|
<Setter Property="Cursor" Value="No"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Grid.Style>
|
|
<Button Style="{StaticResource ColoredButton}"
|
|
IsEnabled="{Binding IsPatchEnabled}"
|
|
FontWeight="Bold" FontSize="16" Width="200"
|
|
Command="{Binding ApplyPatchCommand}"
|
|
Content="{DynamicResource mw_patch}"/>
|
|
</Grid>
|
|
<Button HorizontalAlignment="Right"
|
|
Command="{Binding RestoreBackupCommand}"
|
|
FontWeight="Bold" FontSize="16" Width="200"
|
|
Style="{StaticResource ColoredButton}"
|
|
IsEnabled="{Binding IsIdle}"
|
|
Visibility="{Binding AlreadyPatched, Converter={StaticResource ToVisibilityConverter}}"
|
|
Content="{DynamicResource mw_restore}"/>
|
|
</Grid>
|
|
</StackPanel>
|
|
|
|
|
|
|
|
<DockPanel Grid.Row="2" Margin="10 0 10 10">
|
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"
|
|
Cursor="Hand"
|
|
HorizontalAlignment="Left"
|
|
MouseDown="OpenSourceClicked"
|
|
Background="Transparent">
|
|
<Viewbox VerticalAlignment="Center" Width="32" Height="32">
|
|
<Path
|
|
Fill="White" Data="{StaticResource GitHub}"/>
|
|
</Viewbox>
|
|
<Grid>
|
|
<TextBlock Margin="8 0 0 0" FontSize="10" Foreground="{DynamicResource AccentForeground}">
|
|
<Hyperlink Foreground="{DynamicResource AccentForeground}"><Run Text="{DynamicResource mw_source_code}"/></Hyperlink>
|
|
<LineBreak/>
|
|
<Run Text="{DynamicResource mw_made_by}"/>
|
|
|
|
|
|
<LineBreak/>
|
|
<Run Foreground="{DynamicResource MutedForeground}" Text="{DynamicResource mw_star_hint}"/>
|
|
</TextBlock>
|
|
</Grid>
|
|
</StackPanel>
|
|
</DockPanel>
|
|
</Grid>
|
|
|
|
<controls:PopupHost x:Name="PopupHost"/>
|
|
</Grid>
|
|
</Border>
|
|
</Window>
|