初始化 GraphicsSettingsPage

This commit is contained in:
Hakoyu 2023-12-23 22:44:10 +08:00
parent 662ab89e10
commit 248fc14df1
11 changed files with 908 additions and 446 deletions

View File

@ -133,4 +133,49 @@
<Setter Property="pu:MenuItemHelper.ClickBackground" Value="{DynamicResource ClickColor}" /> <Setter Property="pu:MenuItemHelper.ClickBackground" Value="{DynamicResource ClickColor}" />
<Setter Property="pu:MenuItemHelper.CheckedBackground" Value="{DynamicResource CheckedColor}" />--> <Setter Property="pu:MenuItemHelper.CheckedBackground" Value="{DynamicResource CheckedColor}" />-->
</Style> </Style>
<Style x:Key="Switch_BaseStyle" TargetType="pu:Switch">
<Setter Property="Margin" Value="10,5,10,5" />
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryDark}" />
<Setter Property="BoxHeight" Value="20" />
<Setter Property="CheckedBackground" Value="{DynamicResource Primary}" />
<Setter Property="CheckedBorderBrush" Value="{DynamicResource Primary}" />
<Setter Property="CheckedToggleBrush" Value="{DynamicResource DARKPrimaryText}" />
<Setter Property="ToggleBrush" Value="{DynamicResource PrimaryDark}" />
<Setter Property="ToggleShadowColor" Value="{x:Null}" />
<Setter Property="ToggleSize" Value="14" />
</Style>
<Style x:Key="Label_BaseStyle" TargetType="Label">
<Setter Property="FontSize" Value="14" />
<Setter Property="Margin" Value="10,0,10,0" />
<Setter Property="Height" Value="30" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Background" Value="{x:Null}" />
</Style>
<Style x:Key="NumberInput_BaseStyle" TargetType="pu:NumberInput">
<Setter Property="Height" Value="30" />
<Setter Property="Margin" Value="10,0,10,0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="{DynamicResource DARKPrimaryDarker}" />
</Style>
<Style x:Key="Button_BaseStyle" TargetType="Button">
<Setter Property="Margin" Value="10,5,10,5" />
<Setter Property="Padding" Value="10,5,10,5" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="pu:ButtonHelper.CornerRadius" Value="4" />
<Setter Property="Background" Value="{DynamicResource SecondaryLight}" />
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryDark}" />
<Setter Property="BorderThickness" Value="2" />
</Style>
<Style
x:Key="ComboBox_BaseStyle"
BasedOn="{StaticResource StandardComboBoxStyle}"
TargetType="ComboBox">
<Setter Property="Margin" Value="10,5,10,5" />
</Style>
</ResourceDictionary> </ResourceDictionary>

View File

@ -1,3 +1,4 @@
global using global::HKW.HKWUtils;
global using global::HKW.HKWUtils.Observable; global using global::HKW.HKWUtils.Observable;
global using global::System; global using global::System;
global using global::System.Collections.Generic; global using global::System.Collections.Generic;

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace HKW.WPF.Extensions;
public static partial class WPFExtensions
{
/// <summary>
/// 清除元素焦点
/// </summary>
/// <param name="obj">元素</param>
public static void ClearFocus(this DependencyObject obj)
{
FocusManager.SetFocusedElement(FocusManager.GetFocusScope(obj), null);
}
}

View File

@ -0,0 +1,273 @@
using HKW.WPF.Extensions;
using System.Windows;
using System.Windows.Data;
using System.Windows.Input;
namespace HKW.WPF.Helpers;
/// <summary>
///
/// </summary>
public static class ElementHelper
{
#region IsEnabled
/// <summary>
///
/// </summary>
/// <param name="element"></param>
/// <returns></returns>
public static bool GetIsEnabled(FrameworkElement element)
{
return (bool)element.GetValue(IsEnabledProperty);
}
/// <summary>
///
/// </summary>
public static void SetIsEnabled(FrameworkElement element, bool value)
{
element.SetValue(IsEnabledProperty, value);
}
/// <summary>
/// 在按下指定按键时清除选中状态
/// </summary>
public static readonly DependencyProperty IsEnabledProperty =
DependencyProperty.RegisterAttached(
"IsEnabled",
typeof(bool),
typeof(ElementHelper),
new FrameworkPropertyMetadata(default(bool), IsEnabledPropertyChangedCallback)
);
private static void IsEnabledPropertyChangedCallback(
DependencyObject obj,
DependencyPropertyChangedEventArgs e
)
{
if (obj is not FrameworkElement element)
return;
element.IsEnabled = GetIsEnabled(element);
}
#endregion
#region ClearFocusOnKeyDown
/// <summary>
///
/// </summary>
/// <param name="element"></param>
/// <returns></returns>
public static string GetClearFocusOnKeyDown(FrameworkElement element)
{
return (string)element.GetValue(ClearFocusOnKeyDownProperty);
}
/// <summary>
///
/// </summary>
/// <exception cref="Exception">禁止使用此方法</exception>
public static void SetClearFocusOnKeyDown(FrameworkElement element, string value)
{
element.SetValue(ClearFocusOnKeyDownProperty, value);
}
/// <summary>
/// 在按下指定按键时清除选中状态
/// </summary>
public static readonly DependencyProperty ClearFocusOnKeyDownProperty =
DependencyProperty.RegisterAttached(
"ClearFocusOnKeyDown",
typeof(string),
typeof(ElementHelper),
new FrameworkPropertyMetadata(default(string), ClearFocusOnKeyDownPropertyChanged)
);
private static void ClearFocusOnKeyDownPropertyChanged(
DependencyObject obj,
DependencyPropertyChangedEventArgs e
)
{
if (obj is not FrameworkElement element)
return;
var keyName = GetClearFocusOnKeyDown(element);
if (Enum.TryParse<Key>(keyName, false, out _) is false)
throw new Exception($"Unknown key {keyName}");
element.KeyDown -= Element_KeyDown;
element.KeyDown += Element_KeyDown;
static void Element_KeyDown(object sender, KeyEventArgs e)
{
if (sender is not FrameworkElement element)
return;
var key = (Key)Enum.Parse(typeof(Key), GetClearFocusOnKeyDown(element));
if (e.Key == key)
{
// 清除控件焦点
element.ClearFocus();
// 清除键盘焦点
Keyboard.ClearFocus();
}
}
}
#endregion
#region UniformMinWidthGroup
/// <summary>
///
/// </summary>
/// <param name="element"></param>
/// <returns></returns>
public static string GetUniformMinWidthGroup(FrameworkElement element)
{
return (string)element.GetValue(UniformWidthGroupProperty);
}
/// <summary>
///
/// </summary>
public static void SetUniformMinWidthGroup(FrameworkElement element, string value)
{
element.SetValue(UniformWidthGroupProperty, value);
}
/// <summary>
///
/// </summary>
public static readonly DependencyProperty UniformWidthGroupProperty =
DependencyProperty.RegisterAttached(
"UniformMinWidthGroup",
typeof(string),
typeof(ElementHelper),
new FrameworkPropertyMetadata(null, UniformMinWidthGroupPropertyChanged)
);
/// <summary>
/// (TopParent ,(GroupName, UniformMinWidthGroupInfo))
/// </summary>
private readonly static Dictionary<
FrameworkElement,
Dictionary<string, UniformMinWidthGroupInfo>
> _uniformMinWidthGroups = new();
private static void UniformMinWidthGroupPropertyChanged(
DependencyObject obj,
DependencyPropertyChangedEventArgs e
)
{
if (obj is not FrameworkElement element)
return;
var groupName = GetUniformMinWidthGroup(element);
var topParent = element.FindTopParentOnVisualTree();
// 在设计器中会无法获取顶级元素, 会提示错误, 忽略即可
if (topParent is null)
return;
if (_uniformMinWidthGroups.TryGetValue(topParent, out var groups) is false)
{
topParent.Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
groups = _uniformMinWidthGroups[topParent] = new();
}
if (groups.TryGetValue(groupName, out var group) is false)
group = groups[groupName] = new();
group.Elements.Add(element);
element.SizeChanged -= Element_SizeChanged;
element.SizeChanged += Element_SizeChanged;
#region TopParent
static void Dispatcher_ShutdownStarted(object? sender, EventArgs e)
{
if (sender is not FrameworkElement element)
return;
_uniformMinWidthGroups.Remove(element);
}
#endregion
#region Element
static void Element_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (sender is not FrameworkElement element)
return;
var groupName = GetUniformMinWidthGroup(element);
var topParent = element.FindTopParentOnVisualTree();
var groups = _uniformMinWidthGroups[topParent];
var group = groups[groupName];
var maxWidthElement = group.Elements.First(
i => i.ActualWidth == group.Elements.Max(e => e.ActualWidth)
);
if (maxWidthElement is null)
return;
if (maxWidthElement.ActualWidth == element.ActualWidth)
maxWidthElement = element;
if (maxWidthElement.ActualWidth > group.MaxWidth)
{
// 如果当前控件最大宽度的超过历史最大宽度, 表明非最大宽度列表中的控件超过了历史最大宽度
foreach (var item in group.Elements)
item.MinWidth = maxWidthElement.ActualWidth;
// 将当前控件最小宽度设为0
maxWidthElement.MinWidth = 0;
group.MaxWidthElements.Clear();
// 设为最大宽度的唯一控件
group.MaxWidthElements.Add(maxWidthElement);
group.MaxWidth = maxWidthElement.ActualWidth;
}
else if (group.MaxWidthElements.Count == 1)
{
maxWidthElement = group.MaxWidthElements.First();
// 当最大宽度控件只有一个时, 并且当前控件宽度小于历史最大宽度时, 表明需要降低全体宽度
if (group.MaxWidth > maxWidthElement.ActualWidth)
{
// 最小宽度设为0以自适应宽度
foreach (var item in group.Elements)
item.MinWidth = 0;
// 清空最大宽度列表, 让其刷新
group.MaxWidthElements.Clear();
}
}
else
{
// 将 MaxWidth 设置为 double.MaxValue 时, 可以让首次加载时进入此处
foreach (var item in group.Elements)
{
// 当控件最小宽度为0(表示其为主导宽度的控件), 并且其宽度等于最大宽度, 加入最大宽度列表
if (item.MinWidth == 0 && item.ActualWidth == maxWidthElement.ActualWidth)
{
group.MaxWidthElements.Add(item);
}
else
{
// 如果不是, 则从最大宽度列表删除, 并设置最小宽度为当前最大宽度
group.MaxWidthElements.Remove(item);
item.MinWidth = maxWidthElement.ActualWidth;
}
}
group.MaxWidth = maxWidthElement.ActualWidth;
}
}
#endregion
}
#endregion
}
/// <summary>
/// 统一最小宽度分组信息
/// </summary>
public class UniformMinWidthGroupInfo
{
/// <summary>
/// 最后一个最大宽度
/// </summary>
public double MaxWidth { get; set; } = double.MaxValue;
/// <summary>
/// 所有控件
/// </summary>
public HashSet<FrameworkElement> Elements { get; } = new();
/// <summary>
/// 最大宽度的控件
/// </summary>
public HashSet<FrameworkElement> MaxWidthElements { get; } = new();
}

View File

@ -4,6 +4,7 @@ using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Globalization; using System.Globalization;
using System.Windows; using System.Windows;
using System.Windows.Controls;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
@ -263,8 +264,15 @@ public static class Extensions
yield return new(index++, item); yield return new(index++, item);
} }
public static void SetDataContext<T>(this Window window) /// <summary>
/// 设置视图模型
/// </summary>
/// <typeparam name="T">视图模型类型</typeparam>
/// <param name="window">窗口</param>
public static Lazy<T> SetViewModel<T>(this Window window, EventHandler? closedEvent = null)
where T : new() where T : new()
{
if (window.DataContext is null)
{ {
window.DataContext = new T(); window.DataContext = new T();
window.Closed += (s, e) => window.Closed += (s, e) =>
@ -275,6 +283,20 @@ public static class Extensions
} }
catch { } catch { }
}; };
window.Closed += closedEvent;
}
return new(() => (T)window.DataContext);
}
/// <summary>
/// 设置视图模型
/// </summary>
/// <typeparam name="T">视图模型类型</typeparam>
/// <param name="page">页面</param>
public static Lazy<T> SetViewModel<T>(this Page page)
where T : new()
{
return new(() => (T)(page.DataContext ??= new T()));
} }
} }

View File

@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace HKW.WPF.Extensions;
public static partial class WPFExtensions
{
/// <summary>
/// 判断是否是顶级元素, 它必须是 <see cref="Window"/>, <see cref="Page"/>, <see cref="UserControl"/> 中的一个
/// </summary>
/// <param name="element">元素</param>
public static bool IsTopParent(this FrameworkElement element)
{
if (element is Window || element is Page || element is UserControl)
return true;
return false;
}
/// <summary>
/// 寻找它的顶级元素, 它肯定是 <see cref="Window"/>, <see cref="Page"/>, <see cref="UserControl"/> 中的一个
/// </summary>
/// <param name="element">元素</param>
public static FrameworkElement FindTopParent(this FrameworkElement element)
{
if (element.IsTopParent())
return element;
var parent = element.Parent as FrameworkElement;
while (parent is not null)
{
if (parent.IsTopParent())
return parent;
parent = parent.Parent as FrameworkElement;
}
return null!;
}
/// <summary>
/// 尝试寻找它的顶级元素, 它肯定是 <see cref="Window"/>, <see cref="Page"/>, <see cref="UserControl"/> 中的一个
/// </summary>
/// <param name="element">元素</param>
/// <param name="topParent">顶级元素</param>
/// <returns>成功为 <see langword="true"/> 失败为 <see langword="false"/></returns>
public static bool TryFindTopParent(
this FrameworkElement element,
out FrameworkElement topParent
)
{
var result = element.FindTopParent();
if (result is null)
{
topParent = null;
return false;
}
topParent = result;
return true;
}
/// <summary>
/// 在视觉树上寻找它的顶级元素, 它肯定是 <see cref="Window"/>, <see cref="Page"/>, <see cref="UserControl"/> 中的一个
/// <para>
/// 用于 <see cref="FindTopParent"/> 无法获取到顶级元素的情况下使用, 此元素通常位于 <see cref="DataTemplate"/> 中
/// </para>
/// </summary>
/// <param name="element">元素</param>
public static FrameworkElement FindTopParentOnVisualTree(this FrameworkElement element)
{
if (element.TryFindTopParent(out var top))
return top;
var temp = (DependencyObject)element;
while ((temp = VisualTreeHelper.GetParent(temp)) is not null)
{
if (temp is FrameworkElement fe && fe.TryFindTopParent(out var topParent))
return topParent;
}
return null!;
}
/// <summary>
/// 尝试在视觉树上寻找它的顶级元素, 它肯定是 <see cref="Window"/>, <see cref="Page"/>, <see cref="UserControl"/> 中的一个
/// </summary>
/// <param name="element">元素</param>
/// <param name="topParent">顶级元素</param>
/// <returns>成功为 <see langword="true"/> 失败为 <see langword="false"/></returns>
public static bool FindTopParentOnVisualTree(
this FrameworkElement element,
out FrameworkElement topParent
)
{
var result = element.FindTopParentOnVisualTree();
if (result is null)
{
topParent = null;
return false;
}
topParent = result;
return true;
}
/// <summary>
/// 寻找它的顶级元素, 它肯定是 <see cref="Window"/>, <see cref="Page"/>, <see cref="UserControl"/> 中的一个
/// </summary>
/// <param name="element">元素</param>
public static TParent FindTopParent<TParent>(this FrameworkElement element)
where TParent : FrameworkElement
{
var type = typeof(TParent);
if (type != typeof(Window) && type != typeof(Page) && type != typeof(UserControl))
throw new Exception("TParent type must be Window, Page or UserControl");
return (TParent)FindTopParent(element);
}
}

View File

@ -71,6 +71,9 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="Utils\ClearFocus.cs" />
<Compile Include="Utils\ElementHelper.cs" />
<Compile Include="Utils\FindTopParent.cs" />
<Compile Include="ViewModels\CustomizedSettingsPageVM.cs" /> <Compile Include="ViewModels\CustomizedSettingsPageVM.cs" />
<Compile Include="ViewModels\DiagnosticSettingsPageVM.cs" /> <Compile Include="ViewModels\DiagnosticSettingsPageVM.cs" />
<Compile Include="ViewModels\ModSettingsPageVM.cs" /> <Compile Include="ViewModels\ModSettingsPageVM.cs" />
@ -87,6 +90,18 @@
<Compile Include="Views\SystemSettingsPage.xaml.cs"> <Compile Include="Views\SystemSettingsPage.xaml.cs">
<DependentUpon>SystemSettingsPage.xaml</DependentUpon> <DependentUpon>SystemSettingsPage.xaml</DependentUpon>
</Compile> </Compile>
<Page Include="Converters.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Styles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Templates.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\CustomizedSettingsPage.xaml"> <Page Include="Views\CustomizedSettingsPage.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>

View File

@ -3,6 +3,7 @@
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"
xmlns:h="clr-namespace:HKW.WPF.Helpers"
xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF" xmlns:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
xmlns:local="clr-namespace:VPet.Solution.Views" xmlns:local="clr-namespace:VPet.Solution.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@ -14,148 +15,102 @@
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid Margin="0,0,-5,0"> <Grid>
<ScrollViewer>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="300" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="15" /> <ColumnDefinition Width="Auto" MinWidth="100" />
</Grid.ColumnDefinitions>
<ScrollViewer>
<StackPanel>
<Grid MinHeight="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Label
<RowDefinition Height="35" /> h:ElementHelper.UniformMinWidthGroup="A"
<RowDefinition Height="35" /> Content="{ll:Str '置于顶层'}"
<RowDefinition Height="35" /> Style="{DynamicResource Label_BaseStyle}" />
<RowDefinition Height="35" />
<RowDefinition Height="35" />
<RowDefinition Height="35" />
<RowDefinition Height="35" />
<RowDefinition Height="35" />
<RowDefinition Height="35" />
<RowDefinition Height="35" />
<RowDefinition Height="35" />
<RowDefinition Height="35" />
<RowDefinition Height="35" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="1"
VerticalAlignment="Center"
Text="{ll:Str 快速切换}" />
<TextBlock VerticalAlignment="Center" Text="{ll:Str 置于顶层}" />
<Grid Grid.Row="0" Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<pu:Switch <pu:Switch
x:Name="TopMostBox" x:Name="TopMostBox"
Grid.Column="0" Grid.Column="1"
d:Checked="TopMostBox_Checked" d:Checked="TopMostBox_Checked"
d:Unchecked="TopMostBox_Unchecked" d:Unchecked="TopMostBox_Unchecked"
Background="Transparent" Content="{ll:Str '将桌宠置于顶层'}"
BorderBrush="{DynamicResource PrimaryDark}" Style="{DynamicResource Switch_BaseStyle}"
BoxHeight="18" ToolTip="{ll:Str '将桌宠置于顶层'}" />
BoxWidth="35"
CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str 将桌宠置于顶层}"
ToggleBrush="{DynamicResource PrimaryDark}"
ToggleShadowColor="{x:Null}"
ToggleSize="14"
ToolTip="{ll:Str 将桌宠置于顶层}" />
<pu:Switch <pu:Switch
x:Name="HitThroughBox" x:Name="HitThroughBox"
Grid.Column="1" Grid.Column="2"
d:Checked="HitThroughBox_Checked" d:Checked="HitThroughBox_Checked"
d:Unchecked="HitThroughBox_Checked" d:Unchecked="HitThroughBox_Checked"
Background="Transparent"
BorderBrush="{DynamicResource PrimaryDark}"
BoxHeight="18"
BoxWidth="35"
CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str '鼠标穿透'}" Content="{ll:Str '鼠标穿透'}"
ToggleBrush="{DynamicResource PrimaryDark}" Style="{DynamicResource Switch_BaseStyle}"
ToggleShadowColor="{x:Null}"
ToggleSize="14"
ToolTip="{ll:Str '鼠标将会穿过桌宠到下方内容,不打扰操作\&#13;该选项'}" /> ToolTip="{ll:Str '鼠标将会穿过桌宠到下方内容,不打扰操作\&#13;该选项'}" />
</Grid>
<TextBlock
Grid.Row="2"
Grid.ColumnSpan="2"
VerticalAlignment="Center"
Text="Language" />
<ComboBox
x:Name="LanguageBox"
Grid.Row="2"
Grid.Column="2"
Margin="0,3,0,2"
d:SelectionChanged="LanguageBox_SelectionChanged"
FontSize="16"
Style="{DynamicResource StandardComboBoxStyle}" />
<pu:Switch <pu:Switch
x:Name="PetHelperBox" x:Name="PetHelperBox"
Grid.Row="1" Grid.Column="3"
Grid.Column="2"
d:Checked="PetHelperBox_Checked" d:Checked="PetHelperBox_Checked"
d:Unchecked="PetHelperBox_Checked" d:Unchecked="PetHelperBox_Checked"
Background="Transparent" Content="{ll:Str '快速切换'}"
BorderBrush="{DynamicResource PrimaryDark}" Style="{DynamicResource Switch_BaseStyle}"
BoxHeight="18"
BoxWidth="35"
CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str '添加小标,快速切换顶层或穿透'}"
ToggleBrush="{DynamicResource PrimaryDark}"
ToggleShadowColor="{x:Null}"
ToggleSize="14"
ToolTip="{ll:Str '添加快速切换小标,切换顶层或穿透'}" /> ToolTip="{ll:Str '添加快速切换小标,切换顶层或穿透'}" />
<TextBlock </Grid>
Grid.Row="3" <Grid MinHeight="40">
VerticalAlignment="Center" <Grid.ColumnDefinitions>
Text="{ll:Str 更高缩放}" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
h:ElementHelper.UniformMinWidthGroup="A"
Content="Language"
Style="{DynamicResource Label_BaseStyle}" />
<ComboBox
x:Name="LanguageBox"
Grid.Column="1"
d:SelectionChanged="LanguageBox_SelectionChanged"
Style="{DynamicResource ComboBox_BaseStyle}" />
</Grid>
<Grid MinHeight="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Left"
h:ElementHelper.UniformMinWidthGroup="A"
Content="{ll:Str 更高缩放}"
Style="{DynamicResource Label_BaseStyle}" />
<pu:Switch <pu:Switch
x:Name="FullScreenBox" x:Name="FullScreenBox"
Grid.Row="3" Grid.Column="1"
Grid.Column="2"
d:Checked="FullScreenBox_Check" d:Checked="FullScreenBox_Check"
d:Unchecked="FullScreenBox_Check" d:Unchecked="FullScreenBox_Check"
Background="Transparent"
BorderBrush="{DynamicResource PrimaryDark}"
BoxHeight="18"
BoxWidth="35"
CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str 支持更大缩放倍率}" Content="{ll:Str 支持更大缩放倍率}"
ToggleBrush="{DynamicResource PrimaryDark}" Style="{DynamicResource Switch_BaseStyle}"
ToggleShadowColor="{x:Null}"
ToggleSize="14"
ToolTip="{ll:Str 解锁缩放限制}" /> ToolTip="{ll:Str 解锁缩放限制}" />
<TextBlock </Grid>
Grid.Row="4" <Grid MinHeight="40">
VerticalAlignment="Center"
Text="{ll:Str 缩放等级}" />
<Grid
Grid.Row="4"
Grid.RowSpan="2"
Grid.Column="2">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" MinWidth="100" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Label
<RowDefinition /> HorizontalContentAlignment="Left"
<RowDefinition /> h:ElementHelper.UniformMinWidthGroup="A"
</Grid.RowDefinitions> Content="{ll:Str 缩放等级}"
Style="{DynamicResource Label_BaseStyle}" />
<Slider <Slider
x:Name="ZoomSlider" x:Name="Slider_Zoom"
Grid.Column="1"
Margin="10,0,10,0"
VerticalAlignment="Center" VerticalAlignment="Center"
d:PreviewMouseUp="ZoomSlider_MouseUp" d:PreviewMouseUp="Slider_Zoom_MouseUp"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
LargeChange=".1" LargeChange=".1"
Maximum="3" Maximum="3"
@ -164,20 +119,29 @@
Style="{DynamicResource StandardSliderStyle}" Style="{DynamicResource StandardSliderStyle}"
TickFrequency="0.05" TickFrequency="0.05"
Value="1" /> Value="1" />
<TextBlock <pu:NumberInput
Grid.Column="1" Grid.Column="2"
Margin="15,0,0,0"
VerticalAlignment="Center"
Background="{x:Null}"
FontSize="18"
FontWeight="Bold"
Foreground="{DynamicResource DARKPrimaryDarker}" Foreground="{DynamicResource DARKPrimaryDarker}"
Text="{Binding ElementName=ZoomSlider, Path=Value, StringFormat=f2}" /> Style="{DynamicResource NumberInput_BaseStyle}"
Value="{Binding Value, ElementName=Slider_Zoom}" />
</Grid>
<Grid MinHeight="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" MinWidth="100" />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Left"
h:ElementHelper.UniformMinWidthGroup="A"
Content="{ll:Str 渲染分辨率}"
Style="{DynamicResource Label_BaseStyle}" />
<Slider <Slider
x:Name="SliderResolution" x:Name="Slider_Resolution"
Grid.Row="1" Grid.Column="1"
Margin="10,0,10,0"
VerticalAlignment="Center" VerticalAlignment="Center"
d:PreviewMouseUp="SliderResolution_MouseUp" d:PreviewMouseUp="Slider_Resolution_MouseUp"
IsSnapToTickEnabled="True" IsSnapToTickEnabled="True"
LargeChange="50" LargeChange="50"
Maximum="1920" Maximum="1920"
@ -187,94 +151,83 @@
TickFrequency="10" TickFrequency="10"
ToolTip="{ll:Str '桌宠图形渲染的分辨率,越高图形越清晰\&#13;但是高分辨率会占用更多内存\&#13;重启后生效'}" ToolTip="{ll:Str '桌宠图形渲染的分辨率,越高图形越清晰\&#13;但是高分辨率会占用更多内存\&#13;重启后生效'}"
Value="1000" /> Value="1000" />
<TextBlock <pu:NumberInput
Grid.Row="1" Grid.Column="2"
Grid.Column="1" Style="{DynamicResource NumberInput_BaseStyle}"
Margin="15,0,0,0" ToolTip="{ll:Str '桌宠图形渲染的分辨率,越高图形越清晰\&#13;但是高分辨率会占用更多内存\&#13;重启后生效'}"
VerticalAlignment="Center" Value="{Binding Value, ElementName=Slider_Resolution}" />
Background="{x:Null}"
FontSize="18"
FontWeight="Bold"
Foreground="{DynamicResource DARKPrimaryDarker}"
Text="{Binding ElementName=SliderResolution, Path=Value, StringFormat=f0}"
ToolTip="{ll:Str '桌宠图形渲染的分辨率,越高图形越清晰\&#13;但是高分辨率会占用更多内存\&#13;重启后生效'}" />
</Grid> </Grid>
<TextBlock <Grid MinHeight="40">
Grid.Row="5" <Grid.ColumnDefinitions>
Grid.ColumnSpan="2" <ColumnDefinition Width="Auto" />
VerticalAlignment="Center" <ColumnDefinition />
Text="{ll:Str 渲染分辨率}" /> </Grid.ColumnDefinitions>
<TextBlock <Label
Grid.Row="6" HorizontalContentAlignment="Left"
VerticalAlignment="Center" h:ElementHelper.UniformMinWidthGroup="A"
Text="{ll:Str 主题}" /> Content="{ll:Str 主题}"
Style="{DynamicResource Label_BaseStyle}" />
<ComboBox <ComboBox
x:Name="ThemeBox" x:Name="ThemeBox"
Grid.Row="6" Grid.Column="1"
Grid.Column="2"
Margin="0,3,0,2"
d:SelectionChanged="ThemeBox_SelectionChanged" d:SelectionChanged="ThemeBox_SelectionChanged"
FontSize="16"
IsEnabled="False" IsEnabled="False"
Style="{DynamicResource StandardComboBoxStyle}" /> Style="{DynamicResource ComboBox_BaseStyle}" />
</Grid>
<TextBlock <Grid MinHeight="40">
Grid.Row="7" <Grid.ColumnDefinitions>
VerticalAlignment="Center" <ColumnDefinition Width="Auto" />
Text="{ll:Str 字体}" /> <ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Left"
h:ElementHelper.UniformMinWidthGroup="A"
Content="{ll:Str 字体}"
Style="{DynamicResource Label_BaseStyle}" />
<ComboBox <ComboBox
x:Name="FontBox" x:Name="FontBox"
Grid.Row="7" Grid.Column="1"
Grid.Column="2"
Margin="0,2,0,3"
d:SelectionChanged="FontBox_SelectionChanged" d:SelectionChanged="FontBox_SelectionChanged"
FontSize="16"
IsEnabled="False" IsEnabled="False"
Style="{DynamicResource StandardComboBoxStyle}" /> Style="{DynamicResource ComboBox_BaseStyle}" />
<TextBlock </Grid>
Grid.Row="8" <Grid MinHeight="40">
VerticalAlignment="Center"
Text="{ll:Str 启动位置}" />
<Grid Grid.Row="8" Grid.Column="2">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1.5*" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="1*" /> <ColumnDefinition />
<ColumnDefinition Width="1*" /> <ColumnDefinition />
<ColumnDefinition Width="1*" /> <ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label
Grid.Row="8"
HorizontalContentAlignment="Left"
h:ElementHelper.UniformMinWidthGroup="A"
Content="{ll:Str 启动位置}"
Style="{DynamicResource Label_BaseStyle}" />
<pu:Switch <pu:Switch
x:Name="StartPlace" x:Name="StartPlace"
VerticalAlignment="Center" Grid.Column="1"
d:Checked="StartPlace_Checked" d:Checked="StartPlace_Checked"
d:Unchecked="StartPlace_Checked" d:Unchecked="StartPlace_Checked"
Background="Transparent"
BorderBrush="{DynamicResource PrimaryDark}"
BoxHeight="18"
BoxWidth="35"
CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str 退出位置}" Content="{ll:Str 退出位置}"
IsChecked="True" IsChecked="True"
ToggleBrush="{DynamicResource PrimaryDark}" Style="{DynamicResource Switch_BaseStyle}"
ToggleShadowColor="{x:Null}"
ToggleSize="14"
ToolTip="{ll:Str 游戏退出位置为下次桌宠启动出现的位置}" /> ToolTip="{ll:Str 游戏退出位置为下次桌宠启动出现的位置}" />
<TextBox <TextBox
x:Name="TextBoxStartUpX" x:Name="TextBoxStartUpX"
Grid.Column="1" Grid.Column="2"
Margin="0,0,5,0" Margin="0,0,5,0"
d:TextChanged="TextBoxStartUp_TextChanged" d:TextChanged="TextBoxStartUp_TextChanged"
pu:IconHelper.Margin="5,0,0,0" pu:IconHelper.Margin="5,0,0,0"
pu:TextBoxHelper.Icon="X" pu:TextBoxHelper.Icon="X"
pu:TextBoxHelper.InputLimit="Digit" pu:TextBoxHelper.InputLimit="Digit"
pu:TextBoxHelper.Watermark="{ll:Str X轴}" pu:TextBoxHelper.Watermark="{ll:Str X轴}"
FontSize="16"
Style="{DynamicResource StandardTextBoxStyle}" Style="{DynamicResource StandardTextBoxStyle}"
ToolTip="{ll:Str X轴}" /> ToolTip="{ll:Str X轴}" />
<TextBox <TextBox
x:Name="TextBoxStartUpY" x:Name="TextBoxStartUpY"
Grid.Column="2" Grid.Column="3"
Margin="0,0,5,0" Margin="0,0,5,0"
d:TextChanged="TextBoxStartUp_TextChanged" d:TextChanged="TextBoxStartUp_TextChanged"
pu:IconHelper.Margin="5,0,0,0" pu:IconHelper.Margin="5,0,0,0"
@ -286,136 +239,108 @@
ToolTip="{ll:Str Y轴}" /> ToolTip="{ll:Str Y轴}" />
<Button <Button
x:Name="BtnStartUpGet" x:Name="BtnStartUpGet"
Grid.Column="3" Grid.Column="4"
Height="30"
HorizontalAlignment="Center"
VerticalAlignment="Center"
d:Click="BtnStartUpGet_Click" d:Click="BtnStartUpGet_Click"
pu:ButtonHelper.CornerRadius="4" Content="{ll:Str 设为当前位置}"
Background="{DynamicResource SecondaryLight}" Style="{DynamicResource Button_BaseStyle}" />
BorderBrush="{DynamicResource SecondaryDark}"
BorderThickness="2"
Content="{ll:Str 当前位置}" />
</Grid> </Grid>
<TextBlock <Grid MinHeight="40">
Grid.Row="9" <Grid.ColumnDefinitions>
VerticalAlignment="Center" <ColumnDefinition Width="Auto" />
Text="{ll:Str 消息框}" /> <ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Left"
h:ElementHelper.UniformMinWidthGroup="A"
Content="{ll:Str 消息框}"
Style="{DynamicResource Label_BaseStyle}" />
<pu:Switch <pu:Switch
x:Name="SwitchMsgOut" x:Name="SwitchMsgOut"
Grid.Row="9" Grid.Column="1"
Grid.Column="2"
d:Checked="SwitchMsgOut_Checked" d:Checked="SwitchMsgOut_Checked"
d:Unchecked="SwitchMsgOut_Checked" d:Unchecked="SwitchMsgOut_Checked"
Background="Transparent"
BorderBrush="{DynamicResource PrimaryDark}"
BoxHeight="18"
BoxWidth="35"
CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str 将消息框置于外部}" Content="{ll:Str 将消息框置于外部}"
ToggleBrush="{DynamicResource PrimaryDark}" Style="{DynamicResource Switch_BaseStyle}"
ToggleShadowColor="{x:Null}"
ToggleSize="14"
ToolTip="{ll:Str 将消息框置于外部}" /> ToolTip="{ll:Str 将消息框置于外部}" />
<TextBlock </Grid>
Grid.Row="10" <Grid MinHeight="40">
VerticalAlignment="Center"
Text="{ll:Str 开机启动}" />
<Grid Grid.Row="10" Grid.Column="2">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" /> <ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Left"
h:ElementHelper.UniformMinWidthGroup="A"
Content="{ll:Str 开机启动}"
Style="{DynamicResource Label_BaseStyle}" />
<pu:Switch <pu:Switch
x:Name="StartUpBox" x:Name="StartUpBox"
Grid.Column="1"
d:Checked="StartUpBox_Checked" d:Checked="StartUpBox_Checked"
d:Unchecked="StartUpBox_Checked" d:Unchecked="StartUpBox_Checked"
Background="Transparent"
BorderBrush="{DynamicResource PrimaryDark}"
BoxHeight="18"
BoxWidth="35"
CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str 开机启动}" Content="{ll:Str 开机启动}"
ToggleBrush="{DynamicResource PrimaryDark}" Style="{DynamicResource Switch_BaseStyle}"
ToggleShadowColor="{x:Null}"
ToggleSize="14"
ToolTip="{ll:Str '该游戏随着开机启动该程序\&#13;如需卸载游戏\&#13;请关闭该选项'}" /> ToolTip="{ll:Str '该游戏随着开机启动该程序\&#13;如需卸载游戏\&#13;请关闭该选项'}" />
<pu:Switch <pu:Switch
x:Name="StartUpSteamBox" x:Name="StartUpSteamBox"
Grid.Column="1" Grid.Column="2"
d:Checked="StartUpSteamBox_Checked" d:Checked="StartUpSteamBox_Checked"
d:Unchecked="StartUpSteamBox_Checked" d:Unchecked="StartUpSteamBox_Checked"
Background="Transparent"
BorderBrush="{DynamicResource PrimaryDark}"
BoxHeight="18"
BoxWidth="35"
CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str 从Steam启动}" Content="{ll:Str 从Steam启动}"
IsEnabled="{Binding ElementName=StartUpBox, Path=IsChecked}" Style="{DynamicResource Switch_BaseStyle}"
ToggleBrush="{DynamicResource PrimaryDark}"
ToggleShadowColor="{x:Null}"
ToggleSize="14"
ToolTip="{ll:Str '从Steam启动该游戏, 统计时长不能停'}" /> ToolTip="{ll:Str '从Steam启动该游戏, 统计时长不能停'}" />
</Grid> </Grid>
<TextBlock <Grid MinHeight="40">
Grid.Row="11" <Grid.ColumnDefinitions>
VerticalAlignment="Center" <ColumnDefinition Width="Auto" />
Text="{ll:Str 宠物动画}" /> <ColumnDefinition />
<TextBlock </Grid.ColumnDefinitions>
x:Name="PetIntor" <Label
Grid.Row="12" HorizontalContentAlignment="Left"
Grid.Column="2" h:ElementHelper.UniformMinWidthGroup="A"
VerticalAlignment="Center" Content="{ll:Str 宠物动画}"
FontSize="14" Style="{DynamicResource Label_BaseStyle}" />
Text="{ll:Str 动画描述动画描述动画描述动画描述动画描述}" <Grid Grid.Column="1">
TextWrapping="WrapWithOverflow" /> <Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" MinHeight="30" />
</Grid.RowDefinitions>
<ComboBox <ComboBox
x:Name="PetBox" x:Name="PetBox"
Grid.Row="11"
Grid.Column="2"
Margin="0,3,0,2"
d:SelectionChanged="PetBox_SelectionChanged" d:SelectionChanged="PetBox_SelectionChanged"
FontSize="16" Style="{DynamicResource ComboBox_BaseStyle}"
Style="{DynamicResource StandardComboBoxStyle}"
ToolTip="{ll:Str '加载的宠物动画,重启后生效'}" /> ToolTip="{ll:Str '加载的宠物动画,重启后生效'}" />
<TextBlock <TextBlock
Grid.Row="13" x:Name="PetIntor"
Grid.Row="1"
Margin="10,5,10,5"
VerticalAlignment="Center" VerticalAlignment="Center"
Text="{ll:Str 隐藏窗口}" /> Text="{ll:Str '动画描述...'}"
TextWrapping="WrapWithOverflow" />
</Grid>
</Grid>
<Grid MinHeight="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label
HorizontalContentAlignment="Left"
h:ElementHelper.UniformMinWidthGroup="A"
Content="{ll:Str 隐藏窗口}"
Style="{DynamicResource Label_BaseStyle}" />
<pu:Switch <pu:Switch
x:Name="SwitchHideFromTaskControl" x:Name="SwitchHideFromTaskControl"
Grid.Row="13" Grid.Column="1"
Grid.Column="2"
d:Checked="SwitchHideFromTaskControl_OnChecked" d:Checked="SwitchHideFromTaskControl_OnChecked"
d:Unchecked="SwitchHideFromTaskControl_OnChecked" d:Unchecked="SwitchHideFromTaskControl_OnChecked"
Background="Transparent"
BorderBrush="{DynamicResource PrimaryDark}"
BoxHeight="18"
BoxWidth="35"
CheckedBackground="{DynamicResource Primary}"
CheckedBorderBrush="{DynamicResource Primary}"
CheckedToggleBrush="{DynamicResource DARKPrimaryText}"
Content="{ll:Str '在任务切换器中隐藏窗口'}" Content="{ll:Str '在任务切换器中隐藏窗口'}"
ToggleBrush="{DynamicResource PrimaryDark}" Style="{DynamicResource Switch_BaseStyle}"
ToggleShadowColor="{x:Null}"
ToggleSize="14"
ToolTip="{ll:Str '在Alt+Tab中隐藏'}" /> ToolTip="{ll:Str '在Alt+Tab中隐藏'}" />
</Grid> </Grid>
</StackPanel>
</ScrollViewer> </ScrollViewer>
<Button </Grid>
x:Name="ButtonRestartGraph"
VerticalAlignment="Bottom"
d:Click="ButtonRestart_Click"
Background="{DynamicResource DARKPrimary}"
Content="{ll:Str 重启软件以应用更改}"
Foreground="{DynamicResource DARKPrimaryText}"
Visibility="Collapsed" />
</Grid> </Grid>
</Page> </Page>

View File

@ -1,4 +1,5 @@
using System; using HKW.HKWUtils;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -12,13 +13,17 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using VPet.Solution.ViewModels;
namespace VPet.Solution.Views; namespace VPet.Solution.Views;
/// <summary> /// <summary>
/// GraphicsSettingsPage.xaml 的交互逻辑 /// GraphicsSettingsPage.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class GraphicsSettingsPage : Page public partial class GraphicsSettingsPage : Page
{ {
public GraphicsSettingsPageVM ViewModel => this.SetViewModel<GraphicsSettingsPageVM>().Value;
public GraphicsSettingsPage() public GraphicsSettingsPage()
{ {
InitializeComponent(); InitializeComponent();

View File

@ -1,5 +1,5 @@
<pu:WindowX <pu:WindowX
x:Class="VPet.Solution.MainWindow" x:Class="VPet.Solution.Views.MainWindow"
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"
@ -23,34 +23,30 @@
<ListBox x:Name="ListBox_Saves" /> <ListBox x:Name="ListBox_Saves" />
</Grid> </Grid>
<Grid Grid.Column="1"> <Grid Grid.Column="1">
<Grid.ColumnDefinitions> <Grid.RowDefinitions>
<ColumnDefinition MinWidth="200" /> <RowDefinition Height="Auto" />
<ColumnDefinition MinWidth="100" /> <RowDefinition />
</Grid.ColumnDefinitions> </Grid.RowDefinitions>
<Grid Grid.Column="1"> <ListBox x:Name="ListBox_Main" Style="{DynamicResource SideMenuListBoxStyle}">
<TextBox <ListBox.ItemsPanel>
x:Name="tb_seach_menu" <ItemsPanelTemplate>
Margin="3,6,6,0" <StackPanel Orientation="Horizontal" />
VerticalAlignment="Top" </ItemsPanelTemplate>
d:TextChanged="tb_seach_menu_textchange" </ListBox.ItemsPanel>
pu:TextBoxHelper.Watermark="{ll:Str 搜索设置}" <ListBoxItem x:Name="ListBoxItem_GraphicsSettings" Content="{ll:Str 图形}" />
FontSize="16" <ListBoxItem x:Name="ListBoxItem_SystemSettings" Content="{ll:Str 系统}" />
Style="{DynamicResource StandardTextBoxStyle}" /> <ListBoxItem x:Name="ListBoxItem_InteractiveSettings" Content="{ll:Str 互动}" />
<ListBox <ListBoxItem x:Name="ListBoxItem_CustomizedSettings" Content="{ll:Str 自定}" />
x:Name="ListMenu" <ListBoxItem x:Name="ListBoxItem_DiagnosticSettings" Content="{ll:Str 诊断}" />
Margin="3,40,6,3" <ListBoxItem x:Name="ListBoxItem_ModSettings" Content="{ll:Str Mod管理}" />
pu:ListBoxHelper.CornerRadius="5" </ListBox>
pu:ListBoxHelper.ItemsHoverBackground="{DynamicResource Primary}" <Frame
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource SecondaryLight}" x:Name="Frame_Main"
Background="{DynamicResource SecondaryLighter}" Grid.Row="1"
BorderBrush="{DynamicResource Primary}" Content="{Binding SelectedItem.Tag, ElementName=ListBox_Main}"
BorderThickness="2" ContentRendered="Frame_Main_ContentRendered"
ScrollViewer.HorizontalScrollBarVisibility="Auto" NavigationUIVisibility="Hidden" />
ScrollViewer.VerticalScrollBarVisibility="Auto" /> <!--<TabControl
</Grid>
<GridSplitter Width="3" Background="{DynamicResource PrimaryDarker}" />
<Grid>
<TabControl
x:Name="MainTab" x:Name="MainTab"
Grid.Column="1" Grid.Column="1"
Margin="5" Margin="5"
@ -78,7 +74,7 @@
<TabItem <TabItem
BorderBrush="{DynamicResource PrimaryDarker}" BorderBrush="{DynamicResource PrimaryDarker}"
Foreground="{DynamicResource PrimaryText}" Foreground="{DynamicResource PrimaryText}"
Header="{ll:Str 图形}" /> Header="" />
<TabItem BorderBrush="{DynamicResource PrimaryDarker}" Header="{ll:Str 系统}" /> <TabItem BorderBrush="{DynamicResource PrimaryDarker}" Header="{ll:Str 系统}" />
<TabItem BorderBrush="{DynamicResource PrimaryDarker}" Header="{ll:Str 互动}" /> <TabItem BorderBrush="{DynamicResource PrimaryDarker}" Header="{ll:Str 互动}" />
<TabItem BorderBrush="{DynamicResource PrimaryDarker}" Header="{ll:Str 自定}" /> <TabItem BorderBrush="{DynamicResource PrimaryDarker}" Header="{ll:Str 自定}" />
@ -93,8 +89,28 @@
Background="{x:Null}" Background="{x:Null}"
Content="版本v1.0 (655366666)" Content="版本v1.0 (655366666)"
FontSize="10" FontSize="10"
Foreground="Green" /> Foreground="Green" />-->
</Grid>
</Grid> </Grid>
<!--<Grid Grid.Column="1">
<TextBox
x:Name="tb_seach_menu"
Margin="3,6,6,0"
VerticalAlignment="Top"
d:TextChanged="tb_seach_menu_textchange"
pu:TextBoxHelper.Watermark="{ll:Str 搜索设置}"
FontSize="16"
Style="{DynamicResource StandardTextBoxStyle}" />
<ListBox
x:Name="ListMenu"
Margin="3,40,6,3"
pu:ListBoxHelper.CornerRadius="5"
pu:ListBoxHelper.ItemsHoverBackground="{DynamicResource Primary}"
pu:ListBoxHelper.ItemsSelectedBackground="{DynamicResource SecondaryLight}"
Background="{DynamicResource SecondaryLighter}"
BorderBrush="{DynamicResource Primary}"
BorderThickness="2"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto" />
</Grid>-->
</Grid> </Grid>
</pu:WindowX> </pu:WindowX>

View File

@ -1,12 +1,17 @@
using Panuon.WPF.UI; using HKW.HKWUtils;
using Panuon.WPF.UI;
using System.Windows.Controls;
using VPet.Solution.ViewModels;
namespace VPet.Solution; namespace VPet.Solution.Views;
/// <summary> /// <summary>
/// MainWindow.xaml 的交互逻辑 /// MainWindow.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class MainWindow : WindowX public partial class MainWindow : WindowX
{ {
public MainWindowVM ViewModel => this.SetViewModel<MainWindowVM>().Value;
public MainWindow() public MainWindow()
{ {
if (App.IsDone) if (App.IsDone)
@ -15,5 +20,21 @@ public partial class MainWindow : WindowX
return; return;
} }
InitializeComponent(); InitializeComponent();
ListBoxItem_GraphicsSettings.Tag = new GraphicsSettingsPage();
ListBoxItem_SystemSettings.Tag = new SystemSettingsPage();
ListBoxItem_InteractiveSettings.Tag = new InteractiveSettingsPage();
ListBoxItem_CustomizedSettings.Tag = new CustomizedSettingsPage();
ListBoxItem_DiagnosticSettings.Tag = new DiagnosticSettingsPage();
ListBoxItem_ModSettings.Tag = new ModSettingsPage();
}
private void Frame_Main_ContentRendered(object sender, EventArgs e)
{
if (sender is not Frame frame)
return;
// 清理过时页面
while (frame.CanGoBack)
frame.RemoveBackEntry();
GC.Collect();
} }
} }