RyLiveTools/Source/Tools/Setting/FrmSetting.xaml.cs
如果当时 0ec1400de9 ### 2024-04-12更新
------
####  V1.0.2404.1201
- 新增支持手动运行规则。
- 规则播放时间间隔不再针对全局声效,而只针对当前规则声效。
- 修复规则中播放文件夹可能导致无法执行的BUG。
- 修复规则不勾选礼物和点赞,则无法执行的BUG。
2024-04-13 10:13:30 +08:00

58 lines
2.1 KiB
C#

using CommunityToolkit.Mvvm.Messaging;
using DotNet4.Utilities;
using LiveTools.Data;
using Newtonsoft.Json.Linq;
using ryCommon;
using ryCommonDb;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace LiveTools
{
/// <summary>
/// FrmLogin.xaml 的交互逻辑
/// </summary>
public partial class FrmSetting : UserControl
{
public FrmSetting()
{
InitializeComponent();
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
Json json = new Json(RyFiles.ReadAllText(Config.UserDbFolder + "\\Setting.json"));
ChkGiftTrigger.IsChecked = json.GetJsonValue("GiftTrigger", true);
ChkPlaySound.IsChecked = json.GetJsonValue("PlaySound", true);
ChkMultiPlaySound.IsChecked = json.GetJsonValue("MultiPlaySound", true);
NumPicSize.Value = json.GetJsonValue("PicSize", 70);
NumPicCount.Value = json.GetJsonValue("PicCount", 10);
}
private void BtnOK_Click(object sender, RoutedEventArgs e)
{
Json json = new Json(RyFiles.ReadAllText(Config.UserDbFolder + "\\Setting.json"));
json.SetJsonValue("GiftTrigger", ChkGiftTrigger.IsChecked??true);
json.SetJsonValue("PlaySound", ChkPlaySound.IsChecked ?? true);
json.SetJsonValue("MultiPlaySound", ChkMultiPlaySound.IsChecked ?? true);
json.SetJsonValue("PicSize", NumPicSize.Value.ToInt());
json.SetJsonValue("PicCount", NumPicCount.Value.ToInt());
RyFiles.WriteAllText(Config.UserDbFolder + "\\Setting.json",json.Text);
Config.LoadSetting();
HandyControl.Controls.MessageBox.Show("保存成功。", "提示");
}
}
}