using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; 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.Navigation; using System.Windows.Shapes; namespace IntelligentControlForsx.MyControls { /// /// WpfWindturbine.xaml 的交互逻辑 /// public partial class WpfWindturbine8ZT : UserControl { public WpfWindturbine8ZT() { InitializeComponent(); this.WState = 1; } public static readonly DependencyProperty StateProperty = DependencyProperty.Register("WState", typeof(int), typeof(WpfWindturbine)); public int WState { get { return (int)GetValue(StateProperty); } set { //this.Dispatcher.Invoke(new Action(delegate { // //这里写代码 SetValue(StateProperty, value); //})); switch (value) { // 0-停机-TJTS、 1-上电-SDTS、2-待机-DJTS、3-启动-QDTS、4-并网-BWTS、5-故障-GZTS、6-维护-WHTS、 7-离线-LXTS case 0: VisualStateManager.GoToState(this, "Stop", false); break; case 1: VisualStateManager.GoToState(this, "OnPower", true); break; case 2: VisualStateManager.GoToState(this, "Standby", false); break; case 3: VisualStateManager.GoToState(this, "Start", false); break; case 4: VisualStateManager.GoToState(this, "Online", false); break; case 5: VisualStateManager.GoToState(this, "Fault", false); break; case 6: VisualStateManager.GoToState(this, "Maintain", false); break; default: VisualStateManager.GoToState(this, "Offline", false); break; } } } /// /// 测点编码 /// [Browsable(true), Category("Appearance")] public string TestPointId { get; set; } /// /// 统一编码 /// [Browsable(true), Category("Appearance")] public string UniformCode { get; set; } /// /// 风机编码 /// [Browsable(true), Category("Appearance")] public string WindTurbineId { get; set; } /// /// 风场编码 /// [Browsable(true), Category("Appearance")] public string WindPowerId { get; set; } public event EventHandler MyClick; public event EventHandler MyMouseEnter; public event EventHandler MyMouseLeave; private void Grid_MouseDown(object sender, MouseButtonEventArgs e) { if (MyClick != null) { MyClick(this, e); } } private void Grid_MouseEnter_1(object sender, MouseEventArgs e) { if (MyMouseEnter != null) { MyMouseEnter(this, e); } } private void Grid_MouseLeave_1(object sender, MouseEventArgs e) { if (MyMouseLeave != null) { MyMouseLeave(this, e); } } } }