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
c85c381c07
commit
4d1cd4bc14
@ -1,9 +1,9 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace VPet.Solution.Models;
|
namespace VPet.Solution.Models.SettingEditor;
|
||||||
|
|
||||||
public class GraphicsSettingModel : ObservableClass<SettingModel>
|
public class GraphicsSettingModel : ObservableClass<GraphicsSettingModel>
|
||||||
{
|
{
|
||||||
private double _zoomLevel = 1;
|
private double _zoomLevel = 1;
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
using HKW.HKWUtils.Observable;
|
using HKW.HKWUtils.Observable;
|
||||||
using VPet_Simulator.Core;
|
using VPet_Simulator.Core;
|
||||||
|
|
||||||
namespace VPet.Solution.Models;
|
namespace VPet.Solution.Models.SettingEditor;
|
||||||
|
|
||||||
public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
|
public class InteractiveSettingModel : ObservableClass<InteractiveSettingModel>
|
||||||
{
|
{
|
@ -6,7 +6,7 @@ using System.Windows;
|
|||||||
using VPet.Solution.Properties;
|
using VPet.Solution.Properties;
|
||||||
using VPet_Simulator.Windows.Interface;
|
using VPet_Simulator.Windows.Interface;
|
||||||
|
|
||||||
namespace VPet.Solution.Models;
|
namespace VPet.Solution.Models.SettingEditor;
|
||||||
|
|
||||||
public class SettingModel : ObservableClass<SettingModel>
|
public class SettingModel : ObservableClass<SettingModel>
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
namespace VPet.Solution.Models;
|
namespace VPet.Solution.Models.SettingEditor;
|
||||||
|
|
||||||
public class SystemSettingModel : ObservableClass<SettingModel>
|
public class SystemSettingModel : ObservableClass<SystemSettingModel>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据收集是否被禁止(当日)
|
/// 数据收集是否被禁止(当日)
|
@ -23,6 +23,14 @@ public abstract class ObservableClass<TObject>
|
|||||||
INotifyPropertyChangedX<TObject>
|
INotifyPropertyChangedX<TObject>
|
||||||
where TObject : ObservableClass<TObject>
|
where TObject : ObservableClass<TObject>
|
||||||
{
|
{
|
||||||
|
public ObservableClass()
|
||||||
|
{
|
||||||
|
if (GetType() != typeof(TObject))
|
||||||
|
throw new InvalidCastException(
|
||||||
|
$"Inconsistency between target type [{GetType().FullName}] and generic type [{typeof(TObject).FullName}]"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#region OnPropertyChange
|
#region OnPropertyChange
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置属性值
|
/// 设置属性值
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
@ -321,6 +322,43 @@ public static class Extensions
|
|||||||
{
|
{
|
||||||
return (T)(page.DataContext ??= new T());
|
return (T)(page.DataContext ??= new T());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Dictionary<Window, WindowCloseState> _windowCloseStates = new();
|
||||||
|
|
||||||
|
public static void SetCloseState(this Window window, WindowCloseState state)
|
||||||
|
{
|
||||||
|
window.Closing -= WindowCloseState_Closing;
|
||||||
|
window.Closing += WindowCloseState_Closing;
|
||||||
|
_windowCloseStates[window] = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CloseX(this Window window)
|
||||||
|
{
|
||||||
|
_windowCloseStates.Remove(window);
|
||||||
|
window.Closing -= WindowCloseState_Closing;
|
||||||
|
window.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void WindowCloseState_Closing(object sender, CancelEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is not Window window)
|
||||||
|
return;
|
||||||
|
if (_windowCloseStates.TryGetValue(window, out var state) is false)
|
||||||
|
return;
|
||||||
|
if (state is WindowCloseState.Close)
|
||||||
|
return;
|
||||||
|
e.Cancel = true;
|
||||||
|
window.Visibility =
|
||||||
|
state is WindowCloseState.Hidden ? Visibility.Hidden : Visibility.Collapsed;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum WindowCloseState
|
||||||
|
{
|
||||||
|
Close,
|
||||||
|
Hidden,
|
||||||
|
Collapsed
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -95,27 +95,31 @@
|
|||||||
<Compile Include="Converters\MaxConverter.cs" />
|
<Compile Include="Converters\MaxConverter.cs" />
|
||||||
<Compile Include="Converters\ValueToBoolConverter.cs" />
|
<Compile Include="Converters\ValueToBoolConverter.cs" />
|
||||||
<Compile Include="Converters\BoolInverter.cs" />
|
<Compile Include="Converters\BoolInverter.cs" />
|
||||||
<Compile Include="Models\GraphicsSettingModel.cs" />
|
<Compile Include="Models\SettingEditor\GraphicsSettingModel.cs" />
|
||||||
<Compile Include="Models\InteractiveSettingModel.cs" />
|
<Compile Include="Models\SettingEditor\InteractiveSettingModel.cs" />
|
||||||
<Compile Include="Models\SystemSettingModel.cs" />
|
<Compile Include="Models\SettingEditor\SystemSettingModel.cs" />
|
||||||
<Compile Include="Utils\ClearFocus.cs" />
|
<Compile Include="Utils\ClearFocus.cs" />
|
||||||
<Compile Include="Utils\ElementHelper.cs" />
|
<Compile Include="Utils\ElementHelper.cs" />
|
||||||
<Compile Include="Utils\FindTopParent.cs" />
|
<Compile Include="Utils\FindTopParent.cs" />
|
||||||
<Compile Include="ViewModels\CustomizedSettingPageVM.cs" />
|
<Compile Include="ViewModels\MainWindowVM.cs" />
|
||||||
<Compile Include="ViewModels\DiagnosticSettingPageVM.cs" />
|
<Compile Include="ViewModels\SettingEditor\CustomizedSettingPageVM.cs" />
|
||||||
<Compile Include="ViewModels\ModSettingPageVM.cs" />
|
<Compile Include="ViewModels\SettingEditor\DiagnosticSettingPageVM.cs" />
|
||||||
<Compile Include="Models\SettingModel.cs" />
|
<Compile Include="ViewModels\SettingEditor\ModSettingPageVM.cs" />
|
||||||
<Compile Include="ViewModels\SystemSettingPageVM.cs" />
|
<Compile Include="Models\SettingEditor\SettingModel.cs" />
|
||||||
<Compile Include="Views\CustomizedSettingPage.xaml.cs">
|
<Compile Include="ViewModels\SettingEditor\SystemSettingPageVM.cs" />
|
||||||
|
<Compile Include="Views\SettingEditor\SettingWindow.xaml.cs">
|
||||||
|
<DependentUpon>SettingWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\SettingEditor\CustomizedSettingPage.xaml.cs">
|
||||||
<DependentUpon>CustomizedSettingPage.xaml</DependentUpon>
|
<DependentUpon>CustomizedSettingPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\DiagnosticSettingPage.xaml.cs">
|
<Compile Include="Views\SettingEditor\DiagnosticSettingPage.xaml.cs">
|
||||||
<DependentUpon>DiagnosticSettingPage.xaml</DependentUpon>
|
<DependentUpon>DiagnosticSettingPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\ModSettingPage.xaml.cs">
|
<Compile Include="Views\SettingEditor\ModSettingPage.xaml.cs">
|
||||||
<DependentUpon>ModSettingPage.xaml</DependentUpon>
|
<DependentUpon>ModSettingPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\SystemSettingPage.xaml.cs">
|
<Compile Include="Views\SettingEditor\SystemSettingPage.xaml.cs">
|
||||||
<DependentUpon>SystemSettingPage.xaml</DependentUpon>
|
<DependentUpon>SystemSettingPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Page Include="Converters.xaml">
|
<Page Include="Converters.xaml">
|
||||||
@ -130,19 +134,23 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\CustomizedSettingPage.xaml">
|
<Page Include="Views\SettingEditor\SettingWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\SettingEditor\CustomizedSettingPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\DiagnosticSettingPage.xaml">
|
<Page Include="Views\SettingEditor\DiagnosticSettingPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\GraphicsSettingPage.xaml">
|
<Page Include="Views\SettingEditor\GraphicsSettingPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\InteractiveSettingPage.xaml">
|
<Page Include="Views\SettingEditor\InteractiveSettingPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
@ -154,13 +162,13 @@
|
|||||||
<DependentUpon>App.xaml</DependentUpon>
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="ViewModels\GraphicsSettingPageVM.cs" />
|
<Compile Include="ViewModels\SettingEditor\GraphicsSettingPageVM.cs" />
|
||||||
<Compile Include="ViewModels\InteractiveSettingPageVM.cs" />
|
<Compile Include="ViewModels\SettingEditor\InteractiveSettingPageVM.cs" />
|
||||||
<Compile Include="ViewModels\MainWindowVM.cs" />
|
<Compile Include="ViewModels\SettingEditor\SettingWindowVM.cs" />
|
||||||
<Compile Include="Views\GraphicsSettingPage.xaml.cs">
|
<Compile Include="Views\SettingEditor\GraphicsSettingPage.xaml.cs">
|
||||||
<DependentUpon>GraphicsSettingPage.xaml</DependentUpon>
|
<DependentUpon>GraphicsSettingPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\InteractiveSettingPage.xaml.cs">
|
<Compile Include="Views\SettingEditor\InteractiveSettingPage.xaml.cs">
|
||||||
<DependentUpon>InteractiveSettingPage.xaml</DependentUpon>
|
<DependentUpon>InteractiveSettingPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\MainWindow.xaml.cs">
|
<Compile Include="Views\MainWindow.xaml.cs">
|
||||||
@ -195,11 +203,11 @@
|
|||||||
<Compile Include="NativeStyles.xaml.cs">
|
<Compile Include="NativeStyles.xaml.cs">
|
||||||
<DependentUpon>NativeStyles.xaml</DependentUpon>
|
<DependentUpon>NativeStyles.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Page Include="Views\ModSettingPage.xaml">
|
<Page Include="Views\SettingEditor\ModSettingPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Views\SystemSettingPage.xaml">
|
<Page Include="Views\SettingEditor\SystemSettingPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
@ -241,6 +249,10 @@
|
|||||||
<Name>VPet-Simulator.Windows.Interface</Name>
|
<Name>VPet-Simulator.Windows.Interface</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<Folder Include="Models\SaveEditor\" />
|
||||||
|
<Folder Include="ViewModels\SaveEditor\" />
|
||||||
|
<Folder Include="Views\SaveEditor\" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
@ -1,89 +1,9 @@
|
|||||||
using HKW.HKWUtils.Observable;
|
using System;
|
||||||
using LinePutScript;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using VPet.Solution.Models;
|
|
||||||
using VPet_Simulator.Windows.Interface;
|
|
||||||
|
|
||||||
namespace VPet.Solution.ViewModels;
|
namespace VPet.Solution.ViewModels;
|
||||||
|
|
||||||
public class MainWindowVM : ObservableClass<MainWindowVM>
|
public class MainWindowVM : ObservableClass<MainWindowVM> { }
|
||||||
{
|
|
||||||
public static MainWindowVM Current { get; private set; }
|
|
||||||
|
|
||||||
private SettingModel _currentSettings;
|
|
||||||
public SettingModel CurrentSetting
|
|
||||||
{
|
|
||||||
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))
|
|
||||||
{
|
|
||||||
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
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -4,6 +4,6 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace VPet.Solution.ViewModels;
|
namespace VPet.Solution.ViewModels.SettingEditor;
|
||||||
|
|
||||||
public class CustomizedSettingPageVM { }
|
public class CustomizedSettingPageVM { }
|
@ -4,6 +4,6 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace VPet.Solution.ViewModels;
|
namespace VPet.Solution.ViewModels.SettingEditor;
|
||||||
|
|
||||||
public class DiagnosticSettingPageVM { }
|
public class DiagnosticSettingPageVM { }
|
@ -5,8 +5,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using VPet.Solution.Models;
|
using VPet.Solution.Models;
|
||||||
|
using VPet.Solution.Models.SettingEditor;
|
||||||
|
|
||||||
namespace VPet.Solution.ViewModels;
|
namespace VPet.Solution.ViewModels.SettingEditor;
|
||||||
|
|
||||||
public class GraphicsSettingPageVM : ObservableClass<GraphicsSettingPageVM>
|
public class GraphicsSettingPageVM : ObservableClass<GraphicsSettingPageVM>
|
||||||
{
|
{
|
||||||
@ -19,12 +20,12 @@ public class GraphicsSettingPageVM : ObservableClass<GraphicsSettingPageVM>
|
|||||||
|
|
||||||
public GraphicsSettingPageVM()
|
public GraphicsSettingPageVM()
|
||||||
{
|
{
|
||||||
MainWindowVM.Current.PropertyChangedX += Current_PropertyChangedX;
|
SettingWindowVM.Current.PropertyChangedX += Current_PropertyChangedX;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Current_PropertyChangedX(MainWindowVM sender, PropertyChangedXEventArgs e)
|
private void Current_PropertyChangedX(SettingWindowVM sender, PropertyChangedXEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.PropertyName == nameof(MainWindowVM.CurrentSetting))
|
if (e.PropertyName == nameof(SettingWindowVM.CurrentSetting))
|
||||||
{
|
{
|
||||||
GraphicsSetting = sender.CurrentSetting.GraphicsSetting;
|
GraphicsSetting = sender.CurrentSetting.GraphicsSetting;
|
||||||
}
|
}
|
@ -4,8 +4,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using VPet.Solution.Models;
|
using VPet.Solution.Models;
|
||||||
|
using VPet.Solution.Models.SettingEditor;
|
||||||
|
|
||||||
namespace VPet.Solution.ViewModels;
|
namespace VPet.Solution.ViewModels.SettingEditor;
|
||||||
|
|
||||||
public class InteractiveSettingPageVM : ObservableClass<InteractiveSettingPageVM>
|
public class InteractiveSettingPageVM : ObservableClass<InteractiveSettingPageVM>
|
||||||
{
|
{
|
||||||
@ -18,12 +19,12 @@ public class InteractiveSettingPageVM : ObservableClass<InteractiveSettingPageVM
|
|||||||
|
|
||||||
public InteractiveSettingPageVM()
|
public InteractiveSettingPageVM()
|
||||||
{
|
{
|
||||||
MainWindowVM.Current.PropertyChangedX += Current_PropertyChangedX;
|
SettingWindowVM.Current.PropertyChangedX += Current_PropertyChangedX;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Current_PropertyChangedX(MainWindowVM sender, PropertyChangedXEventArgs e)
|
private void Current_PropertyChangedX(SettingWindowVM sender, PropertyChangedXEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.PropertyName == nameof(MainWindowVM.CurrentSetting))
|
if (e.PropertyName == nameof(SettingWindowVM.CurrentSetting))
|
||||||
{
|
{
|
||||||
InteractiveSetting = sender.CurrentSetting.InteractiveSetting;
|
InteractiveSetting = sender.CurrentSetting.InteractiveSetting;
|
||||||
}
|
}
|
@ -4,6 +4,6 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace VPet.Solution.ViewModels;
|
namespace VPet.Solution.ViewModels.SettingEditor;
|
||||||
|
|
||||||
public class ModSettingPageVM { }
|
public class ModSettingPageVM { }
|
90
VPet.Solution/ViewModels/SettingEditor/SettingWindowVM.cs
Normal file
90
VPet.Solution/ViewModels/SettingEditor/SettingWindowVM.cs
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
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.Solution.Models.SettingEditor;
|
||||||
|
using VPet_Simulator.Windows.Interface;
|
||||||
|
|
||||||
|
namespace VPet.Solution.ViewModels.SettingEditor;
|
||||||
|
|
||||||
|
public class SettingWindowVM : ObservableClass<SettingWindowVM>
|
||||||
|
{
|
||||||
|
public static SettingWindowVM Current { get; private set; }
|
||||||
|
|
||||||
|
private SettingModel _currentSettings;
|
||||||
|
public SettingModel CurrentSetting
|
||||||
|
{
|
||||||
|
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 SettingWindowVM()
|
||||||
|
{
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,8 +5,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using VPet.Solution.Models;
|
using VPet.Solution.Models;
|
||||||
|
using VPet.Solution.Models.SettingEditor;
|
||||||
|
|
||||||
namespace VPet.Solution.ViewModels;
|
namespace VPet.Solution.ViewModels.SettingEditor;
|
||||||
|
|
||||||
public class SystemSettingPageVM : ObservableClass<SystemSettingPageVM>
|
public class SystemSettingPageVM : ObservableClass<SystemSettingPageVM>
|
||||||
{
|
{
|
||||||
@ -19,12 +20,12 @@ public class SystemSettingPageVM : ObservableClass<SystemSettingPageVM>
|
|||||||
|
|
||||||
public SystemSettingPageVM()
|
public SystemSettingPageVM()
|
||||||
{
|
{
|
||||||
MainWindowVM.Current.PropertyChangedX += Current_PropertyChangedX;
|
SettingWindowVM.Current.PropertyChangedX += Current_PropertyChangedX;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Current_PropertyChangedX(MainWindowVM sender, PropertyChangedXEventArgs e)
|
private void Current_PropertyChangedX(SettingWindowVM sender, PropertyChangedXEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.PropertyName == nameof(MainWindowVM.CurrentSetting))
|
if (e.PropertyName == nameof(SettingWindowVM.CurrentSetting))
|
||||||
{
|
{
|
||||||
SystemSetting = sender.CurrentSetting.SystemSetting;
|
SystemSetting = sender.CurrentSetting.SystemSetting;
|
||||||
}
|
}
|
@ -15,122 +15,24 @@
|
|||||||
MinWidth="400"
|
MinWidth="400"
|
||||||
MinHeight="200"
|
MinHeight="200"
|
||||||
d:DataContext="{d:DesignInstance Type=vm:MainWindowVM}"
|
d:DataContext="{d:DesignInstance Type=vm:MainWindowVM}"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" MinWidth="100" />
|
<ColumnDefinition />
|
||||||
<ColumnDefinition MinWidth="300" />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid>
|
<Button
|
||||||
<Grid.RowDefinitions>
|
x:Name="Button_OpenSettingEditor"
|
||||||
<RowDefinition Height="Auto" />
|
Click="Button_OpenSettingEditor_Click"
|
||||||
<RowDefinition />
|
Content="{ll:Str 打开设置编辑器}"
|
||||||
</Grid.RowDefinitions>
|
FontSize="16"
|
||||||
<TextBox Style="{DynamicResource StandardTextBoxStyle}" Text="{Binding SearchSetting, UpdateSourceTrigger=PropertyChanged}" />
|
Style="{DynamicResource Button_BaseStyle}" />
|
||||||
<ListBox
|
<Button
|
||||||
x:Name="ListBox_Saves"
|
x:Name="Button_OpenSaveEditor"
|
||||||
Grid.Row="1"
|
Grid.Column="1"
|
||||||
d:ItemsSource="{d:SampleData ItemCount=5}"
|
Content="{ll:Str 打开存档编辑器}"
|
||||||
ItemsSource="{Binding ShowSettings}"
|
FontSize="16"
|
||||||
SelectedItem="{Binding CurrentSetting}"
|
Style="{DynamicResource Button_BaseStyle}" />
|
||||||
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>
|
|
||||||
<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"
|
|
||||||
d:SelectionChanged="MainTab_SelectionChanged"
|
|
||||||
pu:TabControlHelper.CanHeaderPanelScroll="True"
|
|
||||||
pu:TabControlHelper.ItemsCornerRadius="4"
|
|
||||||
pu:TabControlHelper.ItemsHeight="NaN"
|
|
||||||
pu:TabControlHelper.ItemsHoverBackground="{DynamicResource PrimaryLight}"
|
|
||||||
pu:TabControlHelper.ItemsPadding="10,7"
|
|
||||||
pu:TabControlHelper.ItemsSelectedBackground="{DynamicResource PrimaryDark}"
|
|
||||||
pu:TabControlHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderThickness="0"
|
|
||||||
Foreground="{DynamicResource PrimaryText}">
|
|
||||||
<TabControl.ContentTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Border
|
|
||||||
Margin="0,5,0,10"
|
|
||||||
Background="{DynamicResource DARKPrimaryText}"
|
|
||||||
CornerRadius="15">
|
|
||||||
<ContentControl Margin="10,5" Content="{Binding}" />
|
|
||||||
</Border>
|
|
||||||
</DataTemplate>
|
|
||||||
</TabControl.ContentTemplate>
|
|
||||||
<TabItem
|
|
||||||
BorderBrush="{DynamicResource PrimaryDarker}"
|
|
||||||
Foreground="{DynamicResource PrimaryText}"
|
|
||||||
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 MOD管理}" />
|
|
||||||
</TabControl>
|
|
||||||
<Label
|
|
||||||
x:Name="GameVerison"
|
|
||||||
Grid.ColumnSpan="2"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
Background="{x:Null}"
|
|
||||||
Content="版本v1.0 (655366666)"
|
|
||||||
FontSize="10"
|
|
||||||
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>
|
</Grid>
|
||||||
</pu:WindowX>
|
</pu:WindowX>
|
||||||
|
@ -4,6 +4,7 @@ using System.ComponentModel;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using VPet.Solution.ViewModels;
|
using VPet.Solution.ViewModels;
|
||||||
|
using VPet.Solution.Views.SettingEditor;
|
||||||
|
|
||||||
namespace VPet.Solution.Views;
|
namespace VPet.Solution.Views;
|
||||||
|
|
||||||
@ -14,6 +15,8 @@ public partial class MainWindow : WindowX
|
|||||||
{
|
{
|
||||||
public MainWindowVM ViewModel => (MainWindowVM)DataContext;
|
public MainWindowVM ViewModel => (MainWindowVM)DataContext;
|
||||||
|
|
||||||
|
public SettingWindow SettingWindow { get; set; } = new();
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
if (App.IsDone)
|
if (App.IsDone)
|
||||||
@ -24,21 +27,18 @@ public partial class MainWindow : WindowX
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.SetViewModel<MainWindowVM>();
|
this.SetViewModel<MainWindowVM>();
|
||||||
|
|
||||||
ListBoxItem_GraphicsSettings.Tag = new GraphicsSettingPage();
|
Closed += MainWindow_Closed;
|
||||||
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)
|
private void MainWindow_Closed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is not Frame frame)
|
SettingWindow.CloseX();
|
||||||
return;
|
}
|
||||||
// 清理过时页面
|
|
||||||
while (frame.CanGoBack)
|
private void Button_OpenSettingEditor_Click(object sender, RoutedEventArgs e)
|
||||||
frame.RemoveBackEntry();
|
{
|
||||||
GC.Collect();
|
if (SettingWindow.IsVisible is false)
|
||||||
|
SettingWindow.Show();
|
||||||
|
SettingWindow.Activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<Page
|
<Page
|
||||||
x:Class="VPet.Solution.Views.CustomizedSettingPage"
|
x:Class="VPet.Solution.Views.SettingEditor.CustomizedSettingPage"
|
||||||
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: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.SettingEditor"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
xmlns:vm="clr-namespace:VPet.Solution.ViewModels.SettingEditor"
|
||||||
Title="CustomizedSettingsPage"
|
Title="CustomizedSettingsPage"
|
||||||
d:DataContext="{d:DesignInstance Type=vm:CustomizedSettingPageVM}"
|
d:DataContext="{d:DesignInstance Type=vm:CustomizedSettingPageVM}"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace VPet.Solution.Views;
|
namespace VPet.Solution.Views.SettingEditor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CustomizedSettingsPage.xaml 的交互逻辑
|
/// CustomizedSettingsPage.xaml 的交互逻辑
|
@ -1,13 +1,13 @@
|
|||||||
<Page
|
<Page
|
||||||
x:Class="VPet.Solution.Views.DiagnosticSettingPage"
|
x:Class="VPet.Solution.Views.SettingEditor.DiagnosticSettingPage"
|
||||||
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: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.SettingEditor"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
xmlns:vm="clr-namespace:VPet.Solution.ViewModels.SettingEditor"
|
||||||
Title="DiagnosticSettingsPage"
|
Title="DiagnosticSettingsPage"
|
||||||
d:DataContext="{d:DesignInstance Type=vm:DiagnosticSettingPageVM}"
|
d:DataContext="{d:DesignInstance Type=vm:DiagnosticSettingPageVM}"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace VPet.Solution.Views;
|
namespace VPet.Solution.Views.SettingEditor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DiagnosticSettingsPage.xaml 的交互逻辑
|
/// DiagnosticSettingsPage.xaml 的交互逻辑
|
@ -1,14 +1,14 @@
|
|||||||
<Page
|
<Page
|
||||||
x:Class="VPet.Solution.Views.GraphicsSettingPage"
|
x:Class="VPet.Solution.Views.SettingEditor.GraphicsSettingPage"
|
||||||
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: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.SettingEditor"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
xmlns:vm="clr-namespace:VPet.Solution.ViewModels.SettingEditor"
|
||||||
Title="GraphicsSettingsPage"
|
Title="GraphicsSettingsPage"
|
||||||
d:DataContext="{d:DesignInstance Type=vm:GraphicsSettingPageVM}"
|
d:DataContext="{d:DesignInstance Type=vm:GraphicsSettingPageVM}"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
@ -13,9 +13,9 @@ 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;
|
using VPet.Solution.ViewModels.SettingEditor;
|
||||||
|
|
||||||
namespace VPet.Solution.Views;
|
namespace VPet.Solution.Views.SettingEditor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// GraphicsSettingsPage.xaml 的交互逻辑
|
/// GraphicsSettingsPage.xaml 的交互逻辑
|
@ -1,14 +1,14 @@
|
|||||||
<Page
|
<Page
|
||||||
x:Class="VPet.Solution.Views.InteractiveSettingPage"
|
x:Class="VPet.Solution.Views.SettingEditor.InteractiveSettingPage"
|
||||||
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: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.SettingEditor"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
xmlns:vm="clr-namespace:VPet.Solution.ViewModels.SettingEditor"
|
||||||
Title="InteractiveSettingsPage"
|
Title="InteractiveSettingsPage"
|
||||||
d:DataContext="{d:DesignInstance Type=vm:InteractiveSettingPageVM}"
|
d:DataContext="{d:DesignInstance Type=vm:InteractiveSettingPageVM}"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace VPet.Solution.Views;
|
namespace VPet.Solution.Views.SettingEditor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// InteractiveSettingsPage.xaml 的交互逻辑
|
/// InteractiveSettingsPage.xaml 的交互逻辑
|
@ -1,13 +1,13 @@
|
|||||||
<Page
|
<Page
|
||||||
x:Class="VPet.Solution.Views.ModSettingPage"
|
x:Class="VPet.Solution.Views.SettingEditor.ModSettingPage"
|
||||||
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: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.SettingEditor"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
xmlns:vm="clr-namespace:VPet.Solution.ViewModels.SettingEditor"
|
||||||
Title="ModSettingsPage"
|
Title="ModSettingsPage"
|
||||||
d:DataContext="{d:DesignInstance Type=vm:GraphicsSettingPageVM}"
|
d:DataContext="{d:DesignInstance Type=vm:GraphicsSettingPageVM}"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace VPet.Solution.Views;
|
namespace VPet.Solution.Views.SettingEditor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ModSettingsPage.xaml 的交互逻辑
|
/// ModSettingsPage.xaml 的交互逻辑
|
137
VPet.Solution/Views/SettingEditor/SettingWindow.xaml
Normal file
137
VPet.Solution/Views/SettingEditor/SettingWindow.xaml
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
<pu:WindowX
|
||||||
|
x:Class="VPet.Solution.Views.SettingEditor.SettingWindow"
|
||||||
|
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:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
|
||||||
|
xmlns:local="clr-namespace:VPet.Solution"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||||
|
xmlns:vm="clr-namespace:VPet.Solution.ViewModels.SettingEditor"
|
||||||
|
Title="{ll:Str 'VPET 问题解决工具'}"
|
||||||
|
Width="800"
|
||||||
|
Height="450"
|
||||||
|
MinWidth="400"
|
||||||
|
MinHeight="200"
|
||||||
|
d:DataContext="{d:DesignInstance Type=vm:SettingWindowVM}"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" MinWidth="100" />
|
||||||
|
<ColumnDefinition MinWidth="300" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid>
|
||||||
|
<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>
|
||||||
|
<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"
|
||||||
|
d:SelectionChanged="MainTab_SelectionChanged"
|
||||||
|
pu:TabControlHelper.CanHeaderPanelScroll="True"
|
||||||
|
pu:TabControlHelper.ItemsCornerRadius="4"
|
||||||
|
pu:TabControlHelper.ItemsHeight="NaN"
|
||||||
|
pu:TabControlHelper.ItemsHoverBackground="{DynamicResource PrimaryLight}"
|
||||||
|
pu:TabControlHelper.ItemsPadding="10,7"
|
||||||
|
pu:TabControlHelper.ItemsSelectedBackground="{DynamicResource PrimaryDark}"
|
||||||
|
pu:TabControlHelper.ItemsSelectedForeground="{DynamicResource DARKPrimaryText}"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderThickness="0"
|
||||||
|
Foreground="{DynamicResource PrimaryText}">
|
||||||
|
<TabControl.ContentTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border
|
||||||
|
Margin="0,5,0,10"
|
||||||
|
Background="{DynamicResource DARKPrimaryText}"
|
||||||
|
CornerRadius="15">
|
||||||
|
<ContentControl Margin="10,5" Content="{Binding}" />
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</TabControl.ContentTemplate>
|
||||||
|
<TabItem
|
||||||
|
BorderBrush="{DynamicResource PrimaryDarker}"
|
||||||
|
Foreground="{DynamicResource PrimaryText}"
|
||||||
|
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 MOD管理}" />
|
||||||
|
</TabControl>
|
||||||
|
<Label
|
||||||
|
x:Name="GameVerison"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Background="{x:Null}"
|
||||||
|
Content="版本v1.0 (655366666)"
|
||||||
|
FontSize="10"
|
||||||
|
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>
|
40
VPet.Solution/Views/SettingEditor/SettingWindow.xaml.cs
Normal file
40
VPet.Solution/Views/SettingEditor/SettingWindow.xaml.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
using HKW.HKWUtils;
|
||||||
|
using Panuon.WPF.UI;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using VPet.Solution.ViewModels.SettingEditor;
|
||||||
|
|
||||||
|
namespace VPet.Solution.Views.SettingEditor;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MainWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class SettingWindow : WindowX
|
||||||
|
{
|
||||||
|
public SettingWindowVM ViewModel => (SettingWindowVM)DataContext;
|
||||||
|
|
||||||
|
public SettingWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.SetViewModel<SettingWindowVM>();
|
||||||
|
this.SetCloseState(WindowCloseState.Hidden);
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (sender is not Frame frame)
|
||||||
|
return;
|
||||||
|
// 清理过时页面
|
||||||
|
while (frame.CanGoBack)
|
||||||
|
frame.RemoveBackEntry();
|
||||||
|
GC.Collect();
|
||||||
|
}
|
||||||
|
}
|
@ -1,15 +1,15 @@
|
|||||||
<Page
|
<Page
|
||||||
x:Class="VPet.Solution.Views.SystemSettingPage"
|
x:Class="VPet.Solution.Views.SettingEditor.SystemSettingPage"
|
||||||
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: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.SettingEditor"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
xmlns:pu="https://opensource.panuon.com/wpf-ui"
|
||||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||||
xmlns:vm="clr-namespace:VPet.Solution.ViewModels"
|
xmlns:vm="clr-namespace:VPet.Solution.ViewModels.SettingEditor"
|
||||||
Title="SystemSettingsPage"
|
Title="SystemSettingsPage"
|
||||||
d:DataContext="{d:DesignInstance Type=vm:SystemSettingPageVM}"
|
d:DataContext="{d:DesignInstance Type=vm:SystemSettingPageVM}"
|
||||||
d:DesignHeight="450"
|
d:DesignHeight="450"
|
@ -13,7 +13,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace VPet.Solution.Views;
|
namespace VPet.Solution.Views.SettingEditor;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SystemSettingsPage.xaml 的交互逻辑
|
/// SystemSettingsPage.xaml 的交互逻辑
|
Loading…
Reference in New Issue
Block a user