VPet/VPet.Solution/ViewModels/MainWindowVM.cs
Hakoyu 5c5fafee94 **VPet.Solution:**
- 主界面布局修改, 添加`第一次启动失败`按钮

SettingEditor:
- 设置主页面修改, 添加`全部重置`按钮, 列表项右键菜单功能移至页面右侧
- 模组管理页面修复名称和描述未载入翻译的问题

SaveViewer:
- 存档列表添加`哈希`列
2024-01-25 21:56:38 +08:00

59 lines
1.7 KiB
C#

using HKW.HKWUtils.Observable;
using LinePutScript.Localization.WPF;
using Panuon.WPF.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VPet.Solution.ViewModels;
public class MainWindowVM : ObservableClass<MainWindowVM>
{
public MainWindowVM()
{
LocalizeCore.StoreTranslation = true;
LocalizeCore.LoadDefaultCulture();
CurrentCulture = LocalizeCore.CurrentCulture;
FirstStartFailedCommand.ExecuteCommand += FirstStartFailedCommand_ExecuteCommand;
OpenLocalTextCommand.ExecuteCommand += OpenLocalTextCommand_ExecuteCommand;
}
private void OpenLocalTextCommand_ExecuteCommand()
{
var sb = new StringBuilder();
foreach (var a in LocalizeCore.StoreTranslationList)
sb.AppendLine(a.Replace("\r\n", "\\r\\n"));
MessageBoxX.Show(sb.ToString());
}
private void FirstStartFailedCommand_ExecuteCommand()
{
Utils.OpenLink(
"https://steamcommunity.com/games/1920960/announcements/detail/3681184905256253203"
);
}
#region Property
public IEnumerable<string> AvailableCultures => LocalizeCore.AvailableCultures;
#region CurrentCulture
private string _currentCulture = string.Empty;
public string CurrentCulture
{
get => _currentCulture;
set
{
SetProperty(ref _currentCulture, value);
LocalizeCore.LoadCulture(_currentCulture);
}
}
#endregion
#endregion
#region Command
public ObservableCommand FirstStartFailedCommand { get; } = new();
public ObservableCommand OpenLocalTextCommand { get; } = new();
#endregion
}