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

79 lines
2.5 KiB
C#

using HandyControl.Controls;
using Microsoft.Win32;
using Newtonsoft.Json.Linq;
using ryCommon;
using ryCommonDb;
using System;
using System.Collections.Generic;
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>
/// FrmAddDirect.xaml 的交互逻辑
/// </summary>
public partial class FrmAddDirect : HandyControl.Controls.Window
{
public FrmAddDirect()
{
InitializeComponent();
CbbPlatform.Items.Add("抖音");
CbbPlatform.SelectedIndex = 0;
}
public int SelectedId { get; set; } = 0;
public string PicPath { get; set; } = "";
public void GetInfo()
{
IDbInterface db = new SQLiteDataProvider();
db.ConnDb(LiveTools.Config.DbFullPath);
var ds = db.ReadData("select * from Direct where id=" + SelectedId);
if (ds.HaveData())
{
var row = ds.GetRow(0);
TxtName.Text = row["Name"].ToString();
CbbPlatform.Text= row["Platform"].ToString();
TxtDirectId.Text = row["DirectId"].ToString();
}
ds?.Dispose();
db.Free();
}
private void BtnOK_Click(object sender, RoutedEventArgs e)
{
if (TxtName.Text.Length==0)
{
HandyControl.Controls.MessageBox.Show("请输入名称。", "提示");
return;
}
IDbInterface db = new SQLiteDataProvider();
db.ConnDb(Config.DbFullPath);
ryCommonDb.RyQuickSQL mySQL = new ryCommonDb.RyQuickSQL("Direct");
mySQL.AddField("Name", TxtName.Text);
mySQL.AddField("Platform", CbbPlatform.Text);
mySQL.AddField("DirectId", TxtDirectId.Text);
mySQL.AddField("EditTime",DateTime.Now.ToInt64());
if(SelectedId==-1 || db.Update(mySQL,"id="+ SelectedId)==0)
{
mySQL.AddField("AddTime", DateTime.Now.ToInt64());
db.Insert(mySQL);
}
db.Free();
DialogResult = true;
}
private void BtnCancel_Click(object sender, RoutedEventArgs e)
{
DialogResult = false;
}
}
}