using MECF.Framework.Common.CommonData.Reservoir;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.Common.Persistent.Reservoirs;
using MECF.Framework.Common.RecipeCenter;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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
{
///
/// DosingControl.xaml 的交互逻辑
///
public partial class DosingControl : UserControl
{
public DosingControl()
{
InitializeComponent();
}
#region 内部变量
private int _menuID;
#endregion
#region 属性
public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
"ModuleName", typeof(string), typeof(DosingControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
///
/// 模块名称
///
public string ModuleName
{
get
{
return (string)this.GetValue(ModuleNameProperty);
}
set
{
this.SetValue(ModuleNameProperty, value);
}
}
public static readonly DependencyProperty MenuNameProperty = DependencyProperty.Register(
"MenuName", typeof(string), typeof(DosingControl), new FrameworkPropertyMetadata("Counters", FrameworkPropertyMetadataOptions.AffectsRender));
///
/// 菜单名称
///
public string MenuName
{
get
{
return (string)this.GetValue(MenuNameProperty);
}
set
{
this.SetValue(MenuNameProperty, value);
}
}
public static readonly DependencyProperty ReplenNumProperty = DependencyProperty.Register(
"ReplenNum", typeof(int), typeof(DosingControl), new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender));
///
/// Replen数量
///
public int ReplenNum
{
get
{
return (int)this.GetValue(ReplenNumProperty);
}
set
{
this.SetValue(ReplenNumProperty, value);
}
}
public static readonly DependencyProperty ReplenDatasProperty = DependencyProperty.Register(
"ReplenDatas", typeof(ObservableCollection), typeof(DosingControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
///
/// ReplenDatas
///
public ObservableCollection ReplenDatas
{
get
{
return (ObservableCollection)this.GetValue(ReplenDatasProperty);
}
set
{
this.SetValue(ReplenDatasProperty, value);
}
}
public static readonly DependencyProperty ReplensPersistentCollectionProperty = DependencyProperty.Register(
"ReplensPersistentCollection", typeof(ObservableCollection), typeof(DosingControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
///
/// Replen Persistent数据集合
///
public ObservableCollection ReplensPersistentCollection
{
get
{
return (ObservableCollection)this.GetValue(ReplensPersistentCollectionProperty);
}
set
{
this.SetValue(ReplensPersistentCollectionProperty, value);
}
}
public static readonly DependencyProperty IsAutoEnabledProperty = DependencyProperty.Register(
"IsAutoEnabled", typeof(bool), typeof(DosingControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
///
/// IsAutoEnabled
///
public bool IsAutoEnabled
{
get
{
return (bool)this.GetValue(IsAutoEnabledProperty);
}
set
{
this.SetValue(IsAutoEnabledProperty, value);
}
}
public static readonly DependencyProperty IsDisableProperty = DependencyProperty.Register(
"IsDisableEnabled", typeof(bool), typeof(DosingControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
///
/// IsDisableEnabled
///
public bool IsDisableEnabled
{
get
{
return (bool)this.GetValue(IsDisableProperty);
}
set
{
this.SetValue(IsDisableProperty, value);
}
}
public static readonly DependencyProperty IsManualorAutoProperty = DependencyProperty.Register(
"IsManualorAuto", typeof(bool), typeof(DosingControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
///
/// IsManualorAuto
///
public bool IsManualorAuto
{
get
{
return (bool)this.GetValue(IsManualorAutoProperty);
}
set
{
this.SetValue(IsManualorAutoProperty, value);
}
}
public static readonly DependencyProperty SelectedRecipeNodeProperty = DependencyProperty.Register("SelectedRecipeNode", typeof(RecipeNode), typeof(DosingControl));
///
/// SelectedReicpe节点
///
public RecipeNode SelectedRecipeNode
{
get
{
return (RecipeNode)this.GetValue(SelectedRecipeNodeProperty);
}
set
{
this.SetValue(SelectedRecipeNodeProperty, value);
}
}
public static readonly DependencyProperty SelectedRecipeBufferProperty = DependencyProperty.Register("SelectedRecipeBuffer", typeof(RecipeNode), typeof(DosingControl));
///
/// SelectedReicpeBuffer
///
public RecipeNode SelectedRecipeBuffer
{
get
{
return (RecipeNode)this.GetValue(SelectedRecipeBufferProperty);
}
set
{
this.SetValue(SelectedRecipeBufferProperty, value);
}
}
#endregion
///
/// 前一个Menu
///
///
///
private void Prev_Click(object sender, RoutedEventArgs e)
{
if(_menuID > 0)
{
_menuID --;
}
SetMenuVisible(_menuID);
}
///
/// 后一个Menu
///
///
///
private void Next_Click(object sender, RoutedEventArgs e)
{
if (_menuID < 2)
{
_menuID++;
}
SetMenuVisible(_menuID);
}
///
/// 设置Menu的Visibility
///
///
private void SetMenuVisible(int menuID)
{
switch (menuID)
{
case 0:
MenuName = "Counters";
Counters.Visibility = Visibility.Visible;
Calibrate.Visibility = Visibility.Collapsed;
Recipes.Visibility = Visibility.Collapsed;
break;
case 1:
MenuName = "Recipes";
Counters.Visibility = Visibility.Collapsed;
Calibrate.Visibility = Visibility.Collapsed;
Recipes.Visibility = Visibility.Visible;
break;
case 2:
MenuName = "Calibrate";
Counters.Visibility = Visibility.Collapsed;
Calibrate.Visibility = Visibility.Visible;
Recipes.Visibility = Visibility.Collapsed;
break;
default:
break;
}
}
}
}