mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
更新 VPet.Solution
This commit is contained in:
parent
9d43fdb6c9
commit
6aac99b85f
@ -3,7 +3,7 @@ using System.Windows;
|
||||
|
||||
namespace VPet.Solution.Models;
|
||||
|
||||
public class GraphicsSettingsModel : ObservableClass<SettingsModel>
|
||||
public class GraphicsSettingModel : ObservableClass<SettingModel>
|
||||
{
|
||||
private double _zoomLevel = 1;
|
||||
|
||||
@ -138,12 +138,12 @@ public class GraphicsSettingsModel : ObservableClass<SettingsModel>
|
||||
// set => SetProperty(ref _startRecordLastPoint, value);
|
||||
//}
|
||||
|
||||
private ObservablePoint<double> _startRecordPoint;
|
||||
private ObservablePoint _startRecordPoint;
|
||||
|
||||
/// <summary>
|
||||
/// 设置中桌宠启动的位置
|
||||
/// </summary>
|
||||
public ObservablePoint<double> StartRecordPoint
|
||||
public ObservablePoint StartRecordPoint
|
||||
{
|
||||
get => _startRecordPoint;
|
||||
set => SetProperty(ref _startRecordPoint, value);
|
@ -1,35 +1,19 @@
|
||||
using FastMember;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using VPet.Solution.Properties;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using VPet_Simulator.Core;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
|
||||
namespace VPet.Solution.Models;
|
||||
|
||||
public class SettingsModel : ObservableClass<SettingsModel>
|
||||
public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
|
||||
{
|
||||
private GraphicsSettingsModel _graphicsSettings;
|
||||
public GraphicsSettingsModel GraphicsSettings
|
||||
{
|
||||
get => _graphicsSettings;
|
||||
set => SetProperty(ref _graphicsSettings, value);
|
||||
}
|
||||
private string _petName;
|
||||
|
||||
public SettingsModel(Setting setting)
|
||||
/// <summary>
|
||||
/// 宠物名称
|
||||
/// </summary>
|
||||
public string PetName
|
||||
{
|
||||
GraphicsSettings = LoadGraphicsSettings(setting);
|
||||
}
|
||||
|
||||
private GraphicsSettingsModel LoadGraphicsSettings(Setting setting)
|
||||
{
|
||||
var graphicsSettings = new GraphicsSettingsModel();
|
||||
var sourceAccessor = ObjectAccessor.Create(setting);
|
||||
var targetAccessor = ObjectAccessor.Create(graphicsSettings);
|
||||
foreach (var property in typeof(GraphicsSettingsModel).GetProperties())
|
||||
targetAccessor[property.Name] = sourceAccessor[property.Name];
|
||||
return graphicsSettings;
|
||||
get => _petName;
|
||||
set => SetProperty(ref _petName, value);
|
||||
}
|
||||
|
||||
private double _voiceVolume;
|
||||
@ -43,22 +27,6 @@ public class SettingsModel : ObservableClass<SettingsModel>
|
||||
set => SetProperty(ref _voiceVolume, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据收集是否被禁止(当日)
|
||||
/// </summary>
|
||||
public bool DiagnosisDayEnable { get; } = true;
|
||||
|
||||
private bool _diagnosis;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用数据收集
|
||||
/// </summary>
|
||||
public bool Diagnosis
|
||||
{
|
||||
get => _diagnosis;
|
||||
set => SetProperty(ref _diagnosis, value);
|
||||
}
|
||||
|
||||
private GameSave.ModeType _calFunState;
|
||||
|
||||
/// <summary>
|
||||
@ -70,39 +38,6 @@ public class SettingsModel : ObservableClass<SettingsModel>
|
||||
set => SetProperty(ref _calFunState, value);
|
||||
}
|
||||
|
||||
private int _diagnosisInterval;
|
||||
|
||||
/// <summary>
|
||||
/// 数据收集频率
|
||||
/// </summary>
|
||||
public int DiagnosisInterval
|
||||
{
|
||||
get => _diagnosisInterval;
|
||||
set => SetProperty(ref _diagnosisInterval, value);
|
||||
}
|
||||
|
||||
private int _autoSaveInterval;
|
||||
|
||||
/// <summary>
|
||||
/// 自动保存频率 (min)
|
||||
/// </summary>
|
||||
public int AutoSaveInterval
|
||||
{
|
||||
get => _autoSaveInterval;
|
||||
set => SetProperty(ref _autoSaveInterval, value);
|
||||
}
|
||||
|
||||
private int _backupSaveMaxNum;
|
||||
|
||||
/// <summary>
|
||||
/// 备份保存最大数量
|
||||
/// </summary>
|
||||
public int BackupSaveMaxNum
|
||||
{
|
||||
get => _backupSaveMaxNum;
|
||||
set => SetProperty(ref _backupSaveMaxNum, value);
|
||||
}
|
||||
|
||||
private bool _petHelper;
|
||||
|
||||
/// <summary>
|
80
VPet.Solution/Models/SettingModel.cs
Normal file
80
VPet.Solution/Models/SettingModel.cs
Normal file
@ -0,0 +1,80 @@
|
||||
using FastMember;
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using VPet.Solution.Properties;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
|
||||
namespace VPet.Solution.Models;
|
||||
|
||||
public class SettingModel : ObservableClass<SettingModel>
|
||||
{
|
||||
private string _name;
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
set => SetProperty(ref _name, value);
|
||||
}
|
||||
|
||||
private string _filePath;
|
||||
|
||||
/// <summary>
|
||||
/// 路径
|
||||
/// </summary>
|
||||
public string FilePath
|
||||
{
|
||||
get => _filePath;
|
||||
set => SetProperty(ref _filePath, value);
|
||||
}
|
||||
|
||||
private GraphicsSettingModel _graphicsSetting;
|
||||
public GraphicsSettingModel GraphicsSetting
|
||||
{
|
||||
get => _graphicsSetting;
|
||||
set => SetProperty(ref _graphicsSetting, value);
|
||||
}
|
||||
|
||||
private SystemSettingModel _systemSetting;
|
||||
|
||||
public SystemSettingModel SystemSetting
|
||||
{
|
||||
get => _systemSetting;
|
||||
set => SetProperty(ref _systemSetting, value);
|
||||
}
|
||||
|
||||
private InteractiveSettingModel _interactiveSetting;
|
||||
public InteractiveSettingModel InteractiveSetting
|
||||
{
|
||||
get => _interactiveSetting;
|
||||
set => SetProperty(ref _interactiveSetting, value);
|
||||
}
|
||||
|
||||
public SettingModel(Setting setting)
|
||||
{
|
||||
GraphicsSetting = LoadGraphicsSettings(setting);
|
||||
}
|
||||
|
||||
private GraphicsSettingModel LoadGraphicsSettings(Setting setting)
|
||||
{
|
||||
var graphicsSettings = new GraphicsSettingModel();
|
||||
var sourceAccessor = ObjectAccessor.Create(setting);
|
||||
var targetAccessor = ObjectAccessor.Create(graphicsSettings);
|
||||
foreach (var property in typeof(GraphicsSettingModel).GetProperties())
|
||||
{
|
||||
if (sourceAccessor[property.Name] is Point point)
|
||||
{
|
||||
targetAccessor[property.Name] = new ObservablePoint(point);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetAccessor[property.Name] = sourceAccessor[property.Name];
|
||||
}
|
||||
}
|
||||
return graphicsSettings;
|
||||
}
|
||||
}
|
53
VPet.Solution/Models/SystemSettingModel.cs
Normal file
53
VPet.Solution/Models/SystemSettingModel.cs
Normal file
@ -0,0 +1,53 @@
|
||||
namespace VPet.Solution.Models;
|
||||
|
||||
public class SystemSettingModel : ObservableClass<SettingModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据收集是否被禁止(当日)
|
||||
/// </summary>
|
||||
public bool DiagnosisDayEnable { get; } = true;
|
||||
|
||||
private bool _diagnosis;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用数据收集
|
||||
/// </summary>
|
||||
public bool Diagnosis
|
||||
{
|
||||
get => _diagnosis;
|
||||
set => SetProperty(ref _diagnosis, value);
|
||||
}
|
||||
|
||||
private int _diagnosisInterval;
|
||||
|
||||
/// <summary>
|
||||
/// 数据收集频率
|
||||
/// </summary>
|
||||
public int DiagnosisInterval
|
||||
{
|
||||
get => _diagnosisInterval;
|
||||
set => SetProperty(ref _diagnosisInterval, value);
|
||||
}
|
||||
|
||||
private int _autoSaveInterval;
|
||||
|
||||
/// <summary>
|
||||
/// 自动保存频率 (min)
|
||||
/// </summary>
|
||||
public int AutoSaveInterval
|
||||
{
|
||||
get => _autoSaveInterval;
|
||||
set => SetProperty(ref _autoSaveInterval, value);
|
||||
}
|
||||
|
||||
private int _backupSaveMaxNum;
|
||||
|
||||
/// <summary>
|
||||
/// 备份保存最大数量
|
||||
/// </summary>
|
||||
public int BackupSaveMaxNum
|
||||
{
|
||||
get => _backupSaveMaxNum;
|
||||
set => SetProperty(ref _backupSaveMaxNum, value);
|
||||
}
|
||||
}
|
@ -292,7 +292,7 @@ public static class Extensions
|
||||
/// </summary>
|
||||
/// <typeparam name="T">视图模型类型</typeparam>
|
||||
/// <param name="window">窗口</param>
|
||||
public static Lazy<T> SetViewModel<T>(this Window window, EventHandler? closedEvent = null)
|
||||
public static T SetViewModel<T>(this Window window, EventHandler? closedEvent = null)
|
||||
where T : new()
|
||||
{
|
||||
if (window.DataContext is null)
|
||||
@ -308,7 +308,7 @@ public static class Extensions
|
||||
};
|
||||
window.Closed += closedEvent;
|
||||
}
|
||||
return new(() => (T)window.DataContext);
|
||||
return (T)window.DataContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -316,10 +316,10 @@ public static class Extensions
|
||||
/// </summary>
|
||||
/// <typeparam name="T">视图模型类型</typeparam>
|
||||
/// <param name="page">页面</param>
|
||||
public static Lazy<T> SetViewModel<T>(this Page page)
|
||||
public static T SetViewModel<T>(this Page page)
|
||||
where T : new()
|
||||
{
|
||||
return new(() => (T)(page.DataContext ??= new T()));
|
||||
return (T)(page.DataContext ??= new T());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,23 @@
|
||||
namespace HKW.HKWUtils;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
|
||||
namespace HKW.HKWUtils;
|
||||
|
||||
/// <summary>
|
||||
/// 可观察地点
|
||||
/// </summary>
|
||||
/// <typeparam name="T">类型</typeparam>
|
||||
public class ObservablePoint<T>
|
||||
: ObservableClass<ObservablePoint<T>>,
|
||||
IEquatable<ObservablePoint<T>>
|
||||
[DebuggerDisplay("X = {X}, Y = {Y}")]
|
||||
public class ObservablePoint : ObservableClass<ObservablePoint>, IEquatable<ObservablePoint>
|
||||
{
|
||||
private T _x;
|
||||
public T X
|
||||
private double _x;
|
||||
public double X
|
||||
{
|
||||
get => _x;
|
||||
set => SetProperty(ref _x, value);
|
||||
}
|
||||
|
||||
private T _y;
|
||||
public T Y
|
||||
private double _y;
|
||||
public double Y
|
||||
{
|
||||
get => _y;
|
||||
set => SetProperty(ref _y, value);
|
||||
@ -24,17 +25,23 @@ public class ObservablePoint<T>
|
||||
|
||||
public ObservablePoint() { }
|
||||
|
||||
public ObservablePoint(T x, T y)
|
||||
public ObservablePoint(double x, double y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
public ObservablePoint(Point point)
|
||||
{
|
||||
X = point.X;
|
||||
Y = point.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 复制一个新的对象
|
||||
/// </summary>
|
||||
/// <returns>新对象</returns>
|
||||
public ObservablePoint<T> Copy()
|
||||
public ObservablePoint Copy()
|
||||
{
|
||||
return new(X, Y);
|
||||
}
|
||||
@ -50,28 +57,113 @@ public class ObservablePoint<T>
|
||||
/// <inheritdoc/>
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is ObservablePoint<T> temp
|
||||
&& EqualityComparer<T>.Default.Equals(X, temp.X)
|
||||
&& EqualityComparer<T>.Default.Equals(Y, temp.Y);
|
||||
return obj is ObservablePoint temp
|
||||
&& EqualityComparer<double>.Default.Equals(X, temp.X)
|
||||
&& EqualityComparer<double>.Default.Equals(Y, temp.Y);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(ObservablePoint<T>? other)
|
||||
public bool Equals(ObservablePoint? other)
|
||||
{
|
||||
return Equals(obj: other);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public static bool operator ==(ObservablePoint<T> a, ObservablePoint<T> b)
|
||||
public static bool operator ==(ObservablePoint a, ObservablePoint b)
|
||||
{
|
||||
return Equals(a, b);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public static bool operator !=(ObservablePoint<T> a, ObservablePoint<T> b)
|
||||
public static bool operator !=(ObservablePoint a, ObservablePoint b)
|
||||
{
|
||||
return Equals(a, b) is not true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 可观察地点
|
||||
///// </summary>
|
||||
///// <typeparam name="T">类型</typeparam>
|
||||
//public class ObservablePoint<T>
|
||||
// : ObservableClass<ObservablePoint<T>>,
|
||||
// IEquatable<ObservablePoint<T>>
|
||||
//{
|
||||
// private T _x;
|
||||
// public T X
|
||||
// {
|
||||
// get => _x;
|
||||
// set => SetProperty(ref _x, value);
|
||||
// }
|
||||
|
||||
// private T _y;
|
||||
// public T Y
|
||||
// {
|
||||
// get => _y;
|
||||
// set => SetProperty(ref _y, value);
|
||||
// }
|
||||
|
||||
// public ObservablePoint() { }
|
||||
|
||||
// public ObservablePoint(T x, T y)
|
||||
// {
|
||||
// X = x;
|
||||
// Y = y;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// 复制一个新的对象
|
||||
// /// </summary>
|
||||
// /// <returns>新对象</returns>
|
||||
// public ObservablePoint<T> Copy()
|
||||
// {
|
||||
// return new(X, Y);
|
||||
// }
|
||||
|
||||
// #region Create
|
||||
|
||||
// public static ObservablePoint<double> Create(Point point)
|
||||
// {
|
||||
// return new(point.X, point.Y);
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Other
|
||||
|
||||
// /// <inheritdoc/>
|
||||
// public override int GetHashCode()
|
||||
// {
|
||||
// return HashCode.Combine(X, Y);
|
||||
// }
|
||||
|
||||
// /// <inheritdoc/>
|
||||
// public override bool Equals(object? obj)
|
||||
// {
|
||||
// return obj is ObservablePoint<T> temp
|
||||
// && EqualityComparer<T>.Default.Equals(X, temp.X)
|
||||
// && EqualityComparer<T>.Default.Equals(Y, temp.Y);
|
||||
// }
|
||||
|
||||
// /// <inheritdoc/>
|
||||
// public bool Equals(ObservablePoint<T>? other)
|
||||
// {
|
||||
// return Equals(obj: other);
|
||||
// }
|
||||
|
||||
// /// <inheritdoc/>
|
||||
// public static bool operator ==(ObservablePoint<T> a, ObservablePoint<T> b)
|
||||
// {
|
||||
// return Equals(a, b);
|
||||
// }
|
||||
|
||||
// /// <inheritdoc/>
|
||||
// public static bool operator !=(ObservablePoint<T> a, ObservablePoint<T> b)
|
||||
// {
|
||||
// return Equals(a, b) is not true;
|
||||
// }
|
||||
|
||||
// #endregion
|
||||
//}
|
||||
|
@ -1,30 +1,30 @@
|
||||
namespace HKW.HKWUtils;
|
||||
|
||||
public class ObservableRect<T> : ObservableClass<ObservableRect<T>>, IEquatable<ObservableRect<T>>
|
||||
public class ObservableRect : ObservableClass<ObservableRect>, IEquatable<ObservableRect>
|
||||
{
|
||||
private T _x;
|
||||
public T X
|
||||
private double _x;
|
||||
public double X
|
||||
{
|
||||
get => _x;
|
||||
set => SetProperty(ref _x, value);
|
||||
}
|
||||
|
||||
private T _y;
|
||||
public T Y
|
||||
private double _y;
|
||||
public double Y
|
||||
{
|
||||
get => _y;
|
||||
set => SetProperty(ref _y, value);
|
||||
}
|
||||
|
||||
private T _width;
|
||||
public T Width
|
||||
private double _width;
|
||||
public double Width
|
||||
{
|
||||
get => _width;
|
||||
set => SetProperty(ref _width, value);
|
||||
}
|
||||
|
||||
private T _heigth;
|
||||
public T Height
|
||||
private double _heigth;
|
||||
public double Height
|
||||
{
|
||||
get => _heigth;
|
||||
set => SetProperty(ref _heigth, value);
|
||||
@ -32,7 +32,7 @@ public class ObservableRect<T> : ObservableClass<ObservableRect<T>>, IEquatable<
|
||||
|
||||
public ObservableRect() { }
|
||||
|
||||
public ObservableRect(T x, T y, T width, T hetght)
|
||||
public ObservableRect(double x, double y, double width, double hetght)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
@ -44,7 +44,7 @@ public class ObservableRect<T> : ObservableClass<ObservableRect<T>>, IEquatable<
|
||||
/// 复制一个新的对象
|
||||
/// </summary>
|
||||
/// <returns>新对象</returns>
|
||||
public ObservableRect<T> Copy()
|
||||
public ObservableRect Copy()
|
||||
{
|
||||
return new(X, Y, Width, Height);
|
||||
}
|
||||
@ -60,27 +60,27 @@ public class ObservableRect<T> : ObservableClass<ObservableRect<T>>, IEquatable<
|
||||
/// <inheritdoc/>
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is ObservableRect<T> temp
|
||||
&& EqualityComparer<T>.Default.Equals(X, temp.X)
|
||||
&& EqualityComparer<T>.Default.Equals(Y, temp.Y)
|
||||
&& EqualityComparer<T>.Default.Equals(Width, temp.Width)
|
||||
&& EqualityComparer<T>.Default.Equals(Height, temp.Height);
|
||||
return obj is ObservableRect temp
|
||||
&& EqualityComparer<double>.Default.Equals(X, temp.X)
|
||||
&& EqualityComparer<double>.Default.Equals(Y, temp.Y)
|
||||
&& EqualityComparer<double>.Default.Equals(Width, temp.Width)
|
||||
&& EqualityComparer<double>.Default.Equals(Height, temp.Height);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(ObservableRect<T>? other)
|
||||
public bool Equals(ObservableRect? other)
|
||||
{
|
||||
return Equals(obj: other);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public static bool operator ==(ObservableRect<T> a, ObservableRect<T> b)
|
||||
public static bool operator ==(ObservableRect a, ObservableRect b)
|
||||
{
|
||||
return Equals(a, b);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public static bool operator !=(ObservableRect<T> a, ObservableRect<T> b)
|
||||
public static bool operator !=(ObservableRect a, ObservableRect b)
|
||||
{
|
||||
return Equals(a, b) is not true;
|
||||
}
|
||||
|
@ -75,26 +75,28 @@
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Converters\BoolInverter.cs" />
|
||||
<Compile Include="Models\GraphicsSettingsModel.cs" />
|
||||
<Compile Include="Models\GraphicsSettingModel.cs" />
|
||||
<Compile Include="Models\InteractiveSettingModel.cs" />
|
||||
<Compile Include="Models\SystemSettingModel.cs" />
|
||||
<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" />
|
||||
<Compile Include="Models\SettingsModel.cs" />
|
||||
<Compile Include="ViewModels\SystemSettingsPageVM.cs" />
|
||||
<Compile Include="Views\CustomizedSettingsPage.xaml.cs">
|
||||
<DependentUpon>CustomizedSettingsPage.xaml</DependentUpon>
|
||||
<Compile Include="ViewModels\CustomizedSettingPageVM.cs" />
|
||||
<Compile Include="ViewModels\DiagnosticSettingPageVM.cs" />
|
||||
<Compile Include="ViewModels\ModSettingPageVM.cs" />
|
||||
<Compile Include="Models\SettingModel.cs" />
|
||||
<Compile Include="ViewModels\SystemSettingPageVM.cs" />
|
||||
<Compile Include="Views\CustomizedSettingPage.xaml.cs">
|
||||
<DependentUpon>CustomizedSettingPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\DiagnosticSettingsPage.xaml.cs">
|
||||
<DependentUpon>DiagnosticSettingsPage.xaml</DependentUpon>
|
||||
<Compile Include="Views\DiagnosticSettingPage.xaml.cs">
|
||||
<DependentUpon>DiagnosticSettingPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ModSettingsPage.xaml.cs">
|
||||
<DependentUpon>ModSettingsPage.xaml</DependentUpon>
|
||||
<Compile Include="Views\ModSettingPage.xaml.cs">
|
||||
<DependentUpon>ModSettingPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\SystemSettingsPage.xaml.cs">
|
||||
<DependentUpon>SystemSettingsPage.xaml</DependentUpon>
|
||||
<Compile Include="Views\SystemSettingPage.xaml.cs">
|
||||
<DependentUpon>SystemSettingPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="Converters.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -108,19 +110,19 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\CustomizedSettingsPage.xaml">
|
||||
<Page Include="Views\CustomizedSettingPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\DiagnosticSettingsPage.xaml">
|
||||
<Page Include="Views\DiagnosticSettingPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\GraphicsSettingsPage.xaml">
|
||||
<Page Include="Views\GraphicsSettingPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\InteractiveSettingsPage.xaml">
|
||||
<Page Include="Views\InteractiveSettingPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
@ -132,14 +134,14 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\GraphicsSettingsPageVM.cs" />
|
||||
<Compile Include="ViewModels\InteractiveSettingsPageVM.cs" />
|
||||
<Compile Include="ViewModels\GraphicsSettingPageVM.cs" />
|
||||
<Compile Include="ViewModels\InteractiveSettingPageVM.cs" />
|
||||
<Compile Include="ViewModels\MainWindowVM.cs" />
|
||||
<Compile Include="Views\GraphicsSettingsPage.xaml.cs">
|
||||
<DependentUpon>GraphicsSettingsPage.xaml</DependentUpon>
|
||||
<Compile Include="Views\GraphicsSettingPage.xaml.cs">
|
||||
<DependentUpon>GraphicsSettingPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\InteractiveSettingsPage.xaml.cs">
|
||||
<DependentUpon>InteractiveSettingsPage.xaml</DependentUpon>
|
||||
<Compile Include="Views\InteractiveSettingPage.xaml.cs">
|
||||
<DependentUpon>InteractiveSettingPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
@ -185,11 +187,11 @@
|
||||
<Compile Include="NativeStyles.xaml.cs">
|
||||
<DependentUpon>NativeStyles.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="Views\ModSettingsPage.xaml">
|
||||
<Page Include="Views\ModSettingPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\SystemSettingsPage.xaml">
|
||||
<Page Include="Views\SystemSettingPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
|
@ -6,4 +6,4 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class SystemSettingsPageVM { }
|
||||
public class CustomizedSettingPageVM { }
|
@ -6,4 +6,4 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class CustomizedSettingsPageVM { }
|
||||
public class DiagnosticSettingPageVM { }
|
@ -1,9 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class DiagnosticSettingsPageVM { }
|
32
VPet.Solution/ViewModels/GraphicsSettingPageVM.cs
Normal file
32
VPet.Solution/ViewModels/GraphicsSettingPageVM.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VPet.Solution.Models;
|
||||
|
||||
namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class GraphicsSettingPageVM : ObservableClass<GraphicsSettingPageVM>
|
||||
{
|
||||
private GraphicsSettingModel _graphicsSetting;
|
||||
public GraphicsSettingModel GraphicsSetting
|
||||
{
|
||||
get => _graphicsSetting;
|
||||
set => SetProperty(ref _graphicsSetting, value);
|
||||
}
|
||||
|
||||
public GraphicsSettingPageVM()
|
||||
{
|
||||
MainWindowVM.Current.PropertyChangedX += Current_PropertyChangedX;
|
||||
}
|
||||
|
||||
private void Current_PropertyChangedX(MainWindowVM sender, PropertyChangedXEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(MainWindowVM.CurrentSetting))
|
||||
{
|
||||
GraphicsSetting = sender.CurrentSetting.GraphicsSetting;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VPet.Solution.Models;
|
||||
|
||||
namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class GraphicsSettingsPageVM : ObservableClass<GraphicsSettingsPageVM>
|
||||
{
|
||||
private GraphicsSettingsModel _graphicsSettings;
|
||||
public GraphicsSettingsModel GraphicsSettings
|
||||
{
|
||||
get => _graphicsSettings;
|
||||
set => SetProperty(ref _graphicsSettings, value);
|
||||
}
|
||||
}
|
31
VPet.Solution/ViewModels/InteractiveSettingPageVM.cs
Normal file
31
VPet.Solution/ViewModels/InteractiveSettingPageVM.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VPet.Solution.Models;
|
||||
|
||||
namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class InteractiveSettingPageVM : ObservableClass<InteractiveSettingPageVM>
|
||||
{
|
||||
private InteractiveSettingModel _systemSetting;
|
||||
public InteractiveSettingModel InteractiveSetting
|
||||
{
|
||||
get => _systemSetting;
|
||||
set => SetProperty(ref _systemSetting, value);
|
||||
}
|
||||
|
||||
public InteractiveSettingPageVM()
|
||||
{
|
||||
MainWindowVM.Current.PropertyChangedX += Current_PropertyChangedX;
|
||||
}
|
||||
|
||||
private void Current_PropertyChangedX(MainWindowVM sender, PropertyChangedXEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(MainWindowVM.CurrentSetting))
|
||||
{
|
||||
InteractiveSetting = sender.CurrentSetting.InteractiveSetting;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class InteractiveSettingsPageVM { }
|
@ -1,22 +1,89 @@
|
||||
using HKW.HKWUtils.Observable;
|
||||
using LinePutScript;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VPet.Solution.Models;
|
||||
using VPet_Simulator.Windows.Interface;
|
||||
|
||||
namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class MainWindowVM : ObservableClass<MainWindowVM>
|
||||
{
|
||||
public MainWindowVM() { }
|
||||
public static MainWindowVM Current { get; private set; }
|
||||
|
||||
public static void LoadSettings(string path)
|
||||
private SettingModel _currentSettings;
|
||||
public SettingModel CurrentSetting
|
||||
{
|
||||
foreach (var file in Directory.EnumerateFiles(path))
|
||||
get => _currentSettings;
|
||||
set => SetProperty(ref _currentSettings, value);
|
||||
}
|
||||
|
||||
private readonly ObservableCollection<SettingModel> _settings = new();
|
||||
|
||||
private IEnumerable<SettingModel> _showSettings;
|
||||
public IEnumerable<SettingModel> ShowSettings
|
||||
{
|
||||
get => _showSettings;
|
||||
set => SetProperty(ref _showSettings, value);
|
||||
}
|
||||
|
||||
private string _searchSetting;
|
||||
public string SearchSetting
|
||||
{
|
||||
get => _searchSetting;
|
||||
set => SetProperty(ref _searchSetting, value);
|
||||
}
|
||||
|
||||
public MainWindowVM()
|
||||
{
|
||||
Current = this;
|
||||
ShowSettings = _settings;
|
||||
|
||||
foreach (var s in LoadSettings())
|
||||
_settings.Add(s);
|
||||
|
||||
PropertyChanged += MainWindowVM_PropertyChanged;
|
||||
}
|
||||
|
||||
private void MainWindowVM_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(SearchSetting))
|
||||
{
|
||||
var setting = new Setting(path);
|
||||
if (string.IsNullOrWhiteSpace(SearchSetting))
|
||||
ShowSettings = _settings;
|
||||
else
|
||||
ShowSettings = _settings.Where(
|
||||
s => s.Name.Contains(SearchSetting, StringComparison.OrdinalIgnoreCase)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<SettingModel> LoadSettings()
|
||||
{
|
||||
foreach (
|
||||
var file in Directory
|
||||
.EnumerateFiles(Environment.CurrentDirectory)
|
||||
.Where(
|
||||
(s) =>
|
||||
{
|
||||
if (s.EndsWith(".lps") is false)
|
||||
return false;
|
||||
return Path.GetFileName(s).StartsWith("Setting");
|
||||
}
|
||||
)
|
||||
)
|
||||
{
|
||||
var setting = new Setting(File.ReadAllText(file));
|
||||
yield return new SettingModel(setting)
|
||||
{
|
||||
Name = Path.GetFileNameWithoutExtension(file),
|
||||
FilePath = file
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,4 +6,4 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class ModSettingsPageVM { }
|
||||
public class ModSettingPageVM { }
|
32
VPet.Solution/ViewModels/SystemSettingPageVM.cs
Normal file
32
VPet.Solution/ViewModels/SystemSettingPageVM.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using HKW.HKWUtils.Observable;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VPet.Solution.Models;
|
||||
|
||||
namespace VPet.Solution.ViewModels;
|
||||
|
||||
public class SystemSettingPageVM : ObservableClass<SystemSettingPageVM>
|
||||
{
|
||||
private SystemSettingModel _systemSetting;
|
||||
public SystemSettingModel SystemSetting
|
||||
{
|
||||
get => _systemSetting;
|
||||
set => SetProperty(ref _systemSetting, value);
|
||||
}
|
||||
|
||||
public SystemSettingPageVM()
|
||||
{
|
||||
MainWindowVM.Current.PropertyChangedX += Current_PropertyChangedX;
|
||||
}
|
||||
|
||||
private void Current_PropertyChangedX(MainWindowVM sender, PropertyChangedXEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(MainWindowVM.CurrentSetting))
|
||||
{
|
||||
SystemSetting = sender.CurrentSetting.SystemSetting;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<Page
|
||||
x:Class="VPet.Solution.Views.CustomizedSettingsPage"
|
||||
x:Class="VPet.Solution.Views.CustomizedSettingPage"
|
||||
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"
|
||||
@ -9,7 +9,7 @@
|
||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
||||
Title="CustomizedSettingsPage"
|
||||
d:DataContext="{d:DesignInstance Type=vm:CustomizedSettingsPageVM}"
|
||||
d:DataContext="{d:DesignInstance Type=vm:CustomizedSettingPageVM}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
@ -14,12 +14,13 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VPet.Solution.Views;
|
||||
|
||||
/// <summary>
|
||||
/// CustomizedSettingsPage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CustomizedSettingsPage : Page
|
||||
public partial class CustomizedSettingPage : Page
|
||||
{
|
||||
public CustomizedSettingsPage()
|
||||
public CustomizedSettingPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<Page
|
||||
x:Class="VPet.Solution.Views.DiagnosticSettingsPage"
|
||||
x:Class="VPet.Solution.Views.DiagnosticSettingPage"
|
||||
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"
|
||||
@ -9,7 +9,7 @@
|
||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
||||
Title="DiagnosticSettingsPage"
|
||||
d:DataContext="{d:DesignInstance Type=vm:DiagnosticSettingsPageVM}"
|
||||
d:DataContext="{d:DesignInstance Type=vm:DiagnosticSettingPageVM}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
@ -14,12 +14,13 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VPet.Solution.Views;
|
||||
|
||||
/// <summary>
|
||||
/// DiagnosticSettingsPage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DiagnosticSettingsPage : Page
|
||||
public partial class DiagnosticSettingPage : Page
|
||||
{
|
||||
public DiagnosticSettingsPage()
|
||||
public DiagnosticSettingPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<Page
|
||||
x:Class="VPet.Solution.Views.GraphicsSettingsPage"
|
||||
x:Class="VPet.Solution.Views.GraphicsSettingPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
@ -10,7 +10,7 @@
|
||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
||||
Title="GraphicsSettingsPage"
|
||||
d:DataContext="{d:DesignInstance Type=vm:GraphicsSettingsPageVM}"
|
||||
d:DataContext="{d:DesignInstance Type=vm:GraphicsSettingPageVM}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
@ -39,14 +39,14 @@
|
||||
x:Name="TopMostBox"
|
||||
Grid.Column="1"
|
||||
Content="{ll:Str '将桌宠置于顶层'}"
|
||||
IsChecked="{Binding GraphicsSettings.TopMost}"
|
||||
IsChecked="{Binding GraphicsSetting.TopMost}"
|
||||
Style="{DynamicResource Switch_BaseStyle}"
|
||||
ToolTip="{ll:Str '将桌宠置于顶层'}" />
|
||||
<pu:Switch
|
||||
x:Name="HitThroughBox"
|
||||
Grid.Column="2"
|
||||
Content="{ll:Str '鼠标穿透'}"
|
||||
IsChecked="{Binding GraphicsSettings.HitThrough}"
|
||||
IsChecked="{Binding GraphicsSetting.HitThrough}"
|
||||
Style="{DynamicResource Switch_BaseStyle}"
|
||||
ToolTip="{ll:Str '鼠标将会穿过桌宠到下方内容,不打扰操作\ 该选项'}" />
|
||||
<pu:Switch
|
||||
@ -71,7 +71,7 @@
|
||||
<ComboBox
|
||||
x:Name="LanguageBox"
|
||||
Grid.Column="1"
|
||||
SelectedItem="{Binding GraphicsSettings.Language}"
|
||||
SelectedItem="{Binding GraphicsSetting.Language}"
|
||||
Style="{DynamicResource ComboBox_BaseStyle}" />
|
||||
</Grid>
|
||||
<Grid MinHeight="40">
|
||||
@ -88,7 +88,7 @@
|
||||
x:Name="FullScreenBox"
|
||||
Grid.Column="1"
|
||||
Content="{ll:Str 支持更大缩放倍率}"
|
||||
IsChecked="{Binding GraphicsSettings.IsBiggerScreen}"
|
||||
IsChecked="{Binding GraphicsSetting.IsBiggerScreen}"
|
||||
Style="{DynamicResource Switch_BaseStyle}"
|
||||
ToolTip="{ll:Str 解锁缩放限制}" />
|
||||
</Grid>
|
||||
@ -112,7 +112,7 @@
|
||||
SmallChange="0.05"
|
||||
Style="{DynamicResource Slider_BaseStyle}"
|
||||
TickFrequency="0.05"
|
||||
Value="{Binding GraphicsSettings.ZoomLevel}" />
|
||||
Value="{Binding GraphicsSetting.ZoomLevel}" />
|
||||
<pu:NumberInput
|
||||
Grid.Column="2"
|
||||
Foreground="{DynamicResource DARKPrimaryDarker}"
|
||||
@ -143,7 +143,7 @@
|
||||
Style="{DynamicResource Slider_BaseStyle}"
|
||||
TickFrequency="10"
|
||||
ToolTip="{ll:Str '桌宠图形渲染的分辨率,越高图形越清晰\ 但是高分辨率会占用更多内存\ 重启后生效'}"
|
||||
Value="{Binding GraphicsSettings.Resolution}" />
|
||||
Value="{Binding GraphicsSetting.Resolution}" />
|
||||
<pu:NumberInput
|
||||
Grid.Column="2"
|
||||
Interval="10"
|
||||
@ -167,7 +167,7 @@
|
||||
x:Name="ThemeBox"
|
||||
Grid.Column="1"
|
||||
IsEnabled="False"
|
||||
SelectedItem="{Binding GraphicsSettings.Theme}"
|
||||
SelectedItem="{Binding GraphicsSetting.Theme}"
|
||||
Style="{DynamicResource ComboBox_BaseStyle}" />
|
||||
</Grid>
|
||||
<Grid MinHeight="40">
|
||||
@ -184,7 +184,7 @@
|
||||
x:Name="FontBox"
|
||||
Grid.Column="1"
|
||||
IsEnabled="False"
|
||||
SelectedItem="{Binding GraphicsSettings.Font}"
|
||||
SelectedItem="{Binding GraphicsSetting.Font}"
|
||||
Style="{DynamicResource ComboBox_BaseStyle}" />
|
||||
</Grid>
|
||||
<Grid MinHeight="40">
|
||||
@ -205,7 +205,7 @@
|
||||
x:Name="StartPlace"
|
||||
Grid.Column="1"
|
||||
Content="{ll:Str 保存为退出位置}"
|
||||
IsChecked="{Binding GraphicsSettings.StartRecordLast}"
|
||||
IsChecked="{Binding GraphicsSetting.StartRecordLast}"
|
||||
Style="{DynamicResource Switch_BaseStyle}"
|
||||
ToolTip="{ll:Str 游戏退出位置为下次桌宠启动出现的位置}" />
|
||||
<DockPanel Grid.Column="2">
|
||||
@ -213,14 +213,14 @@
|
||||
<pu:NumberInput
|
||||
x:Name="TextBoxStartUpX"
|
||||
Style="{DynamicResource NumberInput_BaseStyle}"
|
||||
Value="{Binding GraphicsSettings.StartRecordPoint.X}" />
|
||||
Value="{Binding GraphicsSetting.StartRecordPoint.X}" />
|
||||
</DockPanel>
|
||||
<DockPanel Grid.Column="3">
|
||||
<Label Content="{ll:Str Y轴}" Style="{DynamicResource Label_BaseStyle}" />
|
||||
<pu:NumberInput
|
||||
x:Name="TextBoxStartUpY"
|
||||
Style="{DynamicResource NumberInput_BaseStyle}"
|
||||
Value="{Binding GraphicsSettings.StartRecordPoint.Y}" />
|
||||
Value="{Binding GraphicsSetting.StartRecordPoint.Y}" />
|
||||
</DockPanel>
|
||||
<Button
|
||||
x:Name="BtnStartUpGet"
|
||||
@ -263,14 +263,14 @@
|
||||
x:Name="StartUpBox"
|
||||
Grid.Column="1"
|
||||
Content="{ll:Str 开机启动}"
|
||||
IsChecked="{Binding GraphicsSettings.StartUPBoot}"
|
||||
IsChecked="{Binding GraphicsSetting.StartUPBoot}"
|
||||
Style="{DynamicResource Switch_BaseStyle}"
|
||||
ToolTip="{ll:Str '该游戏随着开机启动该程序\ 如需卸载游戏\ 请关闭该选项'}" />
|
||||
<pu:Switch
|
||||
x:Name="StartUpSteamBox"
|
||||
Grid.Column="2"
|
||||
Content="{ll:Str 从Steam启动}"
|
||||
IsChecked="{Binding GraphicsSettings.StartUPBootSteam}"
|
||||
IsChecked="{Binding GraphicsSetting.StartUPBootSteam}"
|
||||
Style="{DynamicResource Switch_BaseStyle}"
|
||||
ToolTip="{ll:Str '从Steam启动该游戏, 统计时长不能停'}" />
|
||||
</Grid>
|
||||
@ -317,7 +317,7 @@
|
||||
x:Name="SwitchHideFromTaskControl"
|
||||
Grid.Column="1"
|
||||
Content="{ll:Str '在任务切换器中隐藏窗口'}"
|
||||
IsChecked="{Binding GraphicsSettings.HideFromTaskControl}"
|
||||
IsChecked="{Binding GraphicsSetting.HideFromTaskControl}"
|
||||
Style="{DynamicResource Switch_BaseStyle}"
|
||||
ToolTip="{ll:Str '在Alt+Tab中隐藏'}" />
|
||||
</Grid>
|
@ -20,12 +20,13 @@ namespace VPet.Solution.Views;
|
||||
/// <summary>
|
||||
/// GraphicsSettingsPage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class GraphicsSettingsPage : Page
|
||||
public partial class GraphicsSettingPage : Page
|
||||
{
|
||||
public GraphicsSettingsPageVM ViewModel => this.SetViewModel<GraphicsSettingsPageVM>().Value;
|
||||
public GraphicsSettingPageVM ViewModel => (GraphicsSettingPageVM)DataContext;
|
||||
|
||||
public GraphicsSettingsPage()
|
||||
public GraphicsSettingPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.SetViewModel<GraphicsSettingPageVM>();
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<Page
|
||||
x:Class="VPet.Solution.Views.InteractiveSettingsPage"
|
||||
x:Class="VPet.Solution.Views.InteractiveSettingPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
@ -10,7 +10,7 @@
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
||||
Title="InteractiveSettingsPage"
|
||||
d:DataContext="{d:DesignInstance Type=vm:InteractiveSettingsPageVM}"
|
||||
d:DataContext="{d:DesignInstance Type=vm:InteractiveSettingPageVM}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
@ -33,8 +33,8 @@
|
||||
<TextBox
|
||||
x:Name="TextBoxPetName"
|
||||
Grid.Column="1"
|
||||
d:TextChanged="TextBoxPetName_TextChanged"
|
||||
Style="{DynamicResource StandardTextBoxStyle}" />
|
||||
Style="{DynamicResource StandardTextBoxStyle}"
|
||||
Text="{Binding InteractiveSetting.PetName}" />
|
||||
</Grid>
|
||||
<Grid MinHeight="40">
|
||||
<Grid.ColumnDefinitions>
|
||||
@ -46,18 +46,17 @@
|
||||
<pu:Switch
|
||||
x:Name="Switch_EnablePetState"
|
||||
Grid.Column="1"
|
||||
d:Checked="CalFunctionBox_Checked"
|
||||
d:Unchecked="CalFunctionBox_Checked"
|
||||
Content="{ll:Str '启用桌宠状态'}"
|
||||
IsChecked="{Binding InteractiveSetting.CalFunState}"
|
||||
Style="{DynamicResource Switch_BaseStyle}"
|
||||
ToolTip="{ll:Str '启用数据计算,桌宠会有状态变化,需要按时投喂等.\ 如果嫌麻烦可以关掉'}" />
|
||||
<!-- TODO: ComboBox使用内部数据 -->
|
||||
<ComboBox
|
||||
Grid.Column="2"
|
||||
d:SelectionChanged="combCalFunState_SelectionChanged"
|
||||
pu:ComboBoxHelper.Watermark="{ll:Str '当关闭数据计算时\ 桌宠显示的状态'}"
|
||||
IsEnabled="{Binding IsChecked, ElementName=Switch_EnablePetState, Converter={StaticResource BoolInverter}}"
|
||||
SelectedIndex="0"
|
||||
SelectedItem="{Binding InteractiveSetting.CalFunState}"
|
||||
Style="{DynamicResource ComboBox_BaseStyle}"
|
||||
ToolTip="{ll:Str '当关闭数据计算时\ 桌宠显示的状态'}">
|
||||
<ComboBoxItem Content="Happy" />
|
@ -14,12 +14,13 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VPet.Solution.Views;
|
||||
|
||||
/// <summary>
|
||||
/// InteractiveSettingsPage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class InteractiveSettingsPage : Page
|
||||
public partial class InteractiveSettingPage : Page
|
||||
{
|
||||
public InteractiveSettingsPage()
|
||||
public InteractiveSettingPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
@ -18,11 +18,29 @@
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" MinWidth="100" />
|
||||
<ColumnDefinition MinWidth="300" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<ListBox x:Name="ListBox_Saves" />
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox Style="{DynamicResource StandardTextBoxStyle}" Text="{Binding SearchSetting, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<ListBox
|
||||
x:Name="ListBox_Saves"
|
||||
Grid.Row="1"
|
||||
d:ItemsSource="{d:SampleData ItemCount=5}"
|
||||
ItemsSource="{Binding ShowSettings}"
|
||||
SelectedItem="{Binding CurrentSetting}"
|
||||
Style="{DynamicResource SideMenuListBoxStyle}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource {x:Type ListBoxItem}}" TargetType="ListBoxItem">
|
||||
<Setter Property="Content" Value="{Binding Name}" />
|
||||
<Setter Property="ToolTip" Value="{Binding Path}" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
|
@ -1,5 +1,7 @@
|
||||
using HKW.HKWUtils;
|
||||
using Panuon.WPF.UI;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using VPet.Solution.ViewModels;
|
||||
|
||||
@ -10,7 +12,7 @@ namespace VPet.Solution.Views;
|
||||
/// </summary>
|
||||
public partial class MainWindow : WindowX
|
||||
{
|
||||
public MainWindowVM ViewModel => this.SetViewModel<MainWindowVM>().Value;
|
||||
public MainWindowVM ViewModel => (MainWindowVM)DataContext;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
@ -20,12 +22,14 @@ 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();
|
||||
this.SetViewModel<MainWindowVM>();
|
||||
|
||||
ListBoxItem_GraphicsSettings.Tag = new GraphicsSettingPage();
|
||||
ListBoxItem_SystemSettings.Tag = new SystemSettingPage();
|
||||
ListBoxItem_InteractiveSettings.Tag = new InteractiveSettingPage();
|
||||
ListBoxItem_CustomizedSettings.Tag = new CustomizedSettingPage();
|
||||
ListBoxItem_DiagnosticSettings.Tag = new DiagnosticSettingPage();
|
||||
ListBoxItem_ModSettings.Tag = new ModSettingPage();
|
||||
}
|
||||
|
||||
private void Frame_Main_ContentRendered(object sender, EventArgs e)
|
||||
|
@ -1,5 +1,5 @@
|
||||
<Page
|
||||
x:Class="VPet.Solution.Views.ModSettingsPage"
|
||||
x:Class="VPet.Solution.Views.ModSettingPage"
|
||||
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"
|
||||
@ -9,7 +9,7 @@
|
||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
||||
Title="ModSettingsPage"
|
||||
d:DataContext="{d:DesignInstance Type=vm:GraphicsSettingsPageVM}"
|
||||
d:DataContext="{d:DesignInstance Type=vm:GraphicsSettingPageVM}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
@ -14,12 +14,13 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VPet.Solution.Views;
|
||||
|
||||
/// <summary>
|
||||
/// ModSettingsPage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ModSettingsPage : Page
|
||||
public partial class ModSettingPage : Page
|
||||
{
|
||||
public ModSettingsPage()
|
||||
public ModSettingPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<Page
|
||||
x:Class="VPet.Solution.Views.SystemSettingsPage"
|
||||
x:Class="VPet.Solution.Views.SystemSettingPage"
|
||||
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"
|
||||
@ -11,7 +11,7 @@
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
||||
Title="SystemSettingsPage"
|
||||
d:DataContext="{d:DesignInstance Type=vm:SystemSettingsPageVM}"
|
||||
d:DataContext="{d:DesignInstance Type=vm:SystemSettingPageVM}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
@ -100,10 +100,9 @@
|
||||
<pu:NumberInput
|
||||
x:Name="numBackupSaveMaxNum"
|
||||
Grid.Column="2"
|
||||
d:ValueChanged="numBackupSaveMaxNum_ValueChanged"
|
||||
Minimum="1"
|
||||
Style="{DynamicResource NumberInput_BaseStyle}"
|
||||
Value="20" />
|
||||
Value="{Binding SystemSetting.BackupSaveMaxNum}" />
|
||||
</Grid>
|
||||
<!--<Grid Margin="0,5,0,0">
|
||||
<Grid.RowDefinitions>
|
@ -14,12 +14,13 @@ using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace VPet.Solution.Views;
|
||||
|
||||
/// <summary>
|
||||
/// SystemSettingsPage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SystemSettingsPage : Page
|
||||
public partial class SystemSettingPage : Page
|
||||
{
|
||||
public SystemSettingsPage()
|
||||
public SystemSettingPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
Loading…
Reference in New Issue
Block a user