using CommunityToolkit.Mvvm.Messaging; using DotNet4.Utilities; using HandyControl.Controls; using LiveTools.Data; using LiveTools.RuleItem; using Microsoft.Win32; 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 { /// /// Rule_SoundPlay.xaml 的交互逻辑 /// public partial class Rule_Variable : UserControl, IRule { public Rule_Variable() { InitializeComponent(); } public string RuleID { get;} = "Variable"; public int ID { get; set; } = 0; public void LoadSetting(JObject jo) { CbbVariable.Text = jo.GetJsonValue("Variable", ""); CbbOpMode.SelectedIndex=jo.GetJsonValue("OpMode", 0,2,0); NumValue.Value = jo.GetJsonValue("Value",1); } public JObject SettingJson() { return new JObject() { { "Name",this.GetType().Name}, { "Mode",RuleID}, { "Variable", CbbVariable.Text}, { "OpMode",CbbOpMode.SelectedIndex }, { "Value", NumValue.Value } }; } public void Run(EffectInfo info, JObject jo) { //for (int m = 0; m < info.LoopCount; m++) //{ // for (int i = 0; i < info.Count; i++) // { // Random rd2 = new Random(Guid.NewGuid().GetHashCode()); // this.Dispatcher.Invoke(new Action(() => // { // Image simpleImage = new Image(); // simpleImage.Width = info.PicSize; // //Canvas.SetLeft(simpleImage, i * 300); // // Set the image source. // simpleImage.Source = GetImage(info.PicPath); // cvsGround.Children.Add(simpleImage); // RotateTransform rotateTransform = new RotateTransform(rd2.Next(0, 181)); // simpleImage.RenderTransform = rotateTransform; // KK(simpleImage); // })); // } //} } public bool CheckVerification() { return true; } private void UserControl_Loaded(object sender, RoutedEventArgs e) { } private void BtnClose_Click(object sender, RoutedEventArgs e) { WeakReferenceMessenger.Default.Send(new RuleMsg() { ID = ID, Message="Close" }); } } }