初始化 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.CheckedBackground" Value="{DynamicResource CheckedColor}" />-->
</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>

View File

@ -1,3 +1,4 @@
global using global::HKW.HKWUtils;
global using global::HKW.HKWUtils.Observable;
global using global::System;
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.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
@ -263,18 +264,39 @@ public static class Extensions
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()
{
window.DataContext = new T();
window.Closed += (s, e) =>
if (window.DataContext is null)
{
try
window.DataContext = new T();
window.Closed += (s, e) =>
{
window.DataContext = null;
}
catch { }
};
try
{
window.DataContext = null;
}
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>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Utils\ClearFocus.cs" />
<Compile Include="Utils\ElementHelper.cs" />
<Compile Include="Utils\FindTopParent.cs" />
<Compile Include="ViewModels\CustomizedSettingsPageVM.cs" />
<Compile Include="ViewModels\DiagnosticSettingsPageVM.cs" />
<Compile Include="ViewModels\ModSettingsPageVM.cs" />
@ -87,6 +90,18 @@
<Compile Include="Views\SystemSettingsPage.xaml.cs">
<DependentUpon>SystemSettingsPage.xaml</DependentUpon>
</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">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

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

View File

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

View File

@ -1,5 +1,5 @@
<pu:WindowX
x:Class="VPet.Solution.MainWindow"
x:Class="VPet.Solution.Views.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"
@ -23,34 +23,30 @@
<ListBox x:Name="ListBox_Saves" />
</Grid>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="200" />
<ColumnDefinition MinWidth="100" />
</Grid.ColumnDefinitions>
<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>
<GridSplitter Width="3" Background="{DynamicResource PrimaryDarker}" />
<Grid>
<TabControl
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<ListBox x:Name="ListBox_Main" Style="{DynamicResource SideMenuListBoxStyle}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBoxItem x:Name="ListBoxItem_GraphicsSettings" Content="{ll:Str 图形}" />
<ListBoxItem x:Name="ListBoxItem_SystemSettings" Content="{ll:Str 系统}" />
<ListBoxItem x:Name="ListBoxItem_InteractiveSettings" Content="{ll:Str 互动}" />
<ListBoxItem x:Name="ListBoxItem_CustomizedSettings" Content="{ll:Str 自定}" />
<ListBoxItem x:Name="ListBoxItem_DiagnosticSettings" Content="{ll:Str 诊断}" />
<ListBoxItem x:Name="ListBoxItem_ModSettings" Content="{ll:Str Mod管理}" />
</ListBox>
<Frame
x:Name="Frame_Main"
Grid.Row="1"
Content="{Binding SelectedItem.Tag, ElementName=ListBox_Main}"
ContentRendered="Frame_Main_ContentRendered"
NavigationUIVisibility="Hidden" />
<!--<TabControl
x:Name="MainTab"
Grid.Column="1"
Margin="5"
@ -78,7 +74,7 @@
<TabItem
BorderBrush="{DynamicResource PrimaryDarker}"
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 自定}" />
@ -93,8 +89,28 @@
Background="{x:Null}"
Content="版本v1.0 (655366666)"
FontSize="10"
Foreground="Green" />
</Grid>
Foreground="Green" />-->
</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>
</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>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : WindowX
{
public MainWindowVM ViewModel => this.SetViewModel<MainWindowVM>().Value;
public MainWindow()
{
if (App.IsDone)
@ -15,5 +20,21 @@ public partial class MainWindow : WindowX
return;
}
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();
}
}