| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 | 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 PunkHPX8_Themes.UserControls{    /// <summary>    /// DosingControl.xaml 的交互逻辑    /// </summary>    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));        /// <summary>        /// 模块名称        /// </summary>        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));        /// <summary>        /// 菜单名称        /// </summary>        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));        /// <summary>        /// Replen数量        /// </summary>        public int ReplenNum        {            get            {                return (int)this.GetValue(ReplenNumProperty);            }            set            {                this.SetValue(ReplenNumProperty, value);            }        }        public static readonly DependencyProperty ReplenDatasProperty = DependencyProperty.Register(           "ReplenDatas", typeof(ObservableCollection<ReplenData>), typeof(DosingControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));        /// <summary>        /// ReplenDatas        /// </summary>        public ObservableCollection<ReplenData> ReplenDatas        {            get            {                return (ObservableCollection<ReplenData>)this.GetValue(ReplenDatasProperty);            }            set            {                this.SetValue(ReplenDatasProperty, value);            }        }               public static readonly DependencyProperty ReplensPersistentCollectionProperty = DependencyProperty.Register(           "ReplensPersistentCollection", typeof(ObservableCollection<ReplenPersistentValue>), typeof(DosingControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));        /// <summary>        /// Replen Persistent数据集合        /// </summary>        public ObservableCollection<ReplenPersistentValue> ReplensPersistentCollection        {            get            {                return (ObservableCollection<ReplenPersistentValue>)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));        /// <summary>        /// IsAutoEnabled        /// </summary>        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));        /// <summary>        /// IsDisableEnabled        /// </summary>        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));        /// <summary>        /// IsManualorAuto        /// </summary>        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));        /// <summary>        /// SelectedReicpe节点        /// </summary>        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));        /// <summary>        /// SelectedReicpeBuffer        /// </summary>        public RecipeNode SelectedRecipeBuffer        {            get            {                return (RecipeNode)this.GetValue(SelectedRecipeBufferProperty);            }            set            {                this.SetValue(SelectedRecipeBufferProperty, value);            }        }        #endregion        /// <summary>        /// 前一个Menu        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void Prev_Click(object sender, RoutedEventArgs e)        {            if(_menuID > 0)            {                _menuID --;            }            SetMenuVisible(_menuID);        }        /// <summary>        /// 后一个Menu        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void Next_Click(object sender, RoutedEventArgs e)        {            if (_menuID < 2)            {                _menuID++;            }            SetMenuVisible(_menuID);        }        /// <summary>        /// 设置Menu的Visibility        /// </summary>        /// <param name="menuID"></param>        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;            }        }           }}
 |