using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.OperationCenter;
using CyberX8_Themes.CustomControls;
using System;
using System.Collections.Generic;
using System.Diagnostics.Eventing.Reader;
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.Navigation;
using System.Windows.Shapes;
namespace CyberX8_Themes.UserControls
{
///
/// Pump1.xaml 的交互逻辑
///
public partial class ReservoirPump : UserControl
{
public ReservoirPump()
{
InitializeComponent();
}
public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
"ModuleName", typeof(string), typeof(ReservoirPump),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
///
/// 模块名称
///
public string ModuleName
{
get
{
return (string)this.GetValue(ModuleNameProperty);
}
set
{
this.SetValue(ModuleNameProperty, value);
}
}
public static readonly DependencyProperty PumpTypeProperty = DependencyProperty.Register(
"PumpType", typeof(string), typeof(ReservoirPump),
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
///
/// Pump类型
///
public string PumpType
{
get
{
return (string)this.GetValue(PumpTypeProperty);
}
set
{
this.SetValue(PumpTypeProperty, value);
}
}
public static readonly DependencyProperty IsOpenPumpProperty = DependencyProperty.Register(
"IsOpenPump", typeof(bool), typeof(ReservoirPump), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
public bool IsOpenPump
{
get { return (bool)this.GetValue(IsOpenPumpProperty); }
set { SetValue(IsOpenPumpProperty, value); }
}
public static readonly DependencyProperty RotateTransformValueProperty = DependencyProperty.Register(
"RotateTransformValue", typeof(int), typeof(ReservoirPump));
public int RotateTransformValue
{
get { return (int)this.GetValue(RotateTransformValueProperty); }
set { this.SetValue(RotateTransformValueProperty, value); }
}
private void OpenClick(object sender, RoutedEventArgs e)
{
//IsOpenPump = true;
if (PumpType.Contains("Replen"))
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ReplenPumpOn", PumpType);
}
else
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.{PumpType}On");
}
}
private void CloseClick(object sender, RoutedEventArgs e)
{
//IsOpenPump = false;
if (PumpType.Contains("Replen"))
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.ReplenPumpOff", PumpType);
}
else
{
InvokeClient.Instance.Service.DoOperation($"{ModuleName}.{PumpType}Off");
}
}
}
}