123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- 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
- {
- /// <summary>
- /// WpfWindturbine.xaml 的交互逻辑
- /// </summary>
- 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;
- }
- }
- }
- /// <summary>
- /// 测点编码
- /// </summary>
- [Browsable(true), Category("Appearance")]
- public string TestPointId
- {
- get;
- set;
- }
- /// <summary>
- /// 统一编码
- /// </summary>
- [Browsable(true), Category("Appearance")]
- public string UniformCode
- {
- get;
- set;
- }
- /// <summary>
- /// 风机编码
- /// </summary>
- [Browsable(true), Category("Appearance")]
- public string WindTurbineId
- {
- get;
- set;
- }
- /// <summary>
- /// 风场编码
- /// </summary>
- [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);
- }
- }
- }
- }
|