123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- 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 WpfWindturbine : UserControl
- {
- public WpfWindturbine()
- {
- InitializeComponent();
- this.State = 1;
-
- }
- public static readonly DependencyProperty StateProperty =
- DependencyProperty.Register("State", typeof(int), typeof(WpfWindturbine));
- public int State
- {
- get { return (int)GetValue(StateProperty); }
- set
- {
- //this.Dispatcher.Invoke(new Action(delegate {
- // //这里写代码
-
- SetValue(StateProperty, value);
- //}));
- switch (value)
- {
- case 0:
- VisualStateManager.GoToState(this, "standby", false);
- break;
- case 1:
- VisualStateManager.GoToState(this, "run", true);
- break;
- case 2:
- VisualStateManager.GoToState(this, "stop", false);
- break;
- case 3:
- VisualStateManager.GoToState(this, "interrupt", false);
- break;
- case 4:
- VisualStateManager.GoToState(this, "repair", false);
- break;
- case 5:
- VisualStateManager.GoToState(this, "powercuts", false);
- break;
- case 6:
- VisualStateManager.GoToState(this, "powercuts2", false);
- break;
- default:
- VisualStateManager.GoToState(this, "staticrun", false);
- break;
- }
- // set
- //{
- // this.Dispatcher.Invoke(new Action(delegate {
- // //这里写代码
- // SetValue(StateProperty, value);
- // }));
- // switch (value)
- // {
- // case 0:
- // {
- // this.Dispatcher.Invoke(new Action(delegate
- // {
- // VisualStateManager.GoToState(this, "standby", false);
- // }));
- // break;
- // }
- // case 1:
- // {
- // this.Dispatcher.Invoke(new Action(delegate
- // {
- // VisualStateManager.GoToState(this, "run", false);
- // }));
- // break;
- // }
- // case 2:
- // {
- // this.Dispatcher.Invoke(new Action(delegate
- // {
- // VisualStateManager.GoToState(this, "stop", false);
- // }));
- // break;
- // }
- // case 3:
- // {
- // this.Dispatcher.Invoke(new Action(delegate
- // {
- // VisualStateManager.GoToState(this, "interrupt", false);
- // }));
- // break;
- // }
- // case 4:
- // {
- // this.Dispatcher.Invoke(new Action(delegate
- // {
- // VisualStateManager.GoToState(this, "repair", false);
- // }));
- // break;
- // }
- // case 5:
- // {
- // this.Dispatcher.Invoke(new Action(delegate
- // {
- // VisualStateManager.GoToState(this, "powercuts", false);
- // }));
- // break;
- // }
- // case 6:
- // {
- // this.Dispatcher.Invoke(new Action(delegate
- // {
- // VisualStateManager.GoToState(this, "powercuts2", false);
- // }));
- // break;
- // }
- // default:
- // {
- // this.Dispatcher.Invoke(new Action(delegate
- // {
- // VisualStateManager.GoToState(this, "staticrun", 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);
- }
- }
- }
- }
|