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 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;
// }
// }
}
}
///
/// 测点编码
///
[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);
}
}
}
}