| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 | using MECF.Framework.Common.Equipment;using MECF.Framework.Common.OperationCenter;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>    /// RecipeLoad.xaml 的交互逻辑    /// </summary>    public partial class RecipeLoad : UserControl    {        public RecipeLoad()        {            InitializeComponent();        }        public static readonly DependencyProperty SelectedRecipeNodeProperty = DependencyProperty.Register("SelectedRecipeNode", typeof(RecipeNode), typeof(RecipeLoad),               new FrameworkPropertyMetadata(null, new PropertyChangedCallback(SelectedRecipeNodeChanged)));        /// <summary>        /// 当前选中recipe节点        /// </summary>        public RecipeNode SelectedRecipeNode        {            get            {                return (RecipeNode)this.GetValue(SelectedRecipeNodeProperty);            }            set            {                this.SetValue(SelectedRecipeNodeProperty, value);            }        }        public static readonly DependencyProperty RecipeTypeProperty = DependencyProperty.Register("RecipeType", typeof(string), typeof(RecipeLoad));        /// <summary>        /// Recipe类型        /// </summary>        public string RecipeType        {            get            {                return (string)this.GetValue(RecipeTypeProperty);            }            set            {                this.SetValue(RecipeTypeProperty, value);            }        }        public static readonly DependencyProperty ModuleProperty = DependencyProperty.Register("Module", typeof(string), typeof(RecipeLoad));        /// <summary>        /// Module        /// </summary>        public string Module        {            get            {                return (string)this.GetValue(ModuleProperty);            }            set            {                this.SetValue(ModuleProperty, value);            }        }        public static readonly DependencyProperty LoadEnabledProperty = DependencyProperty.Register("LoadEnabled", typeof(bool), typeof(RecipeLoad),               new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));        /// <summary>        /// Load按钮可用性        /// </summary>        public bool LoadEnabled        {            get            {                return (bool)this.GetValue(LoadEnabledProperty);            }            set            {                this.SetValue(SelectedRecipeNodeProperty, value);            }        }        public static readonly DependencyProperty HeadNameProperty = DependencyProperty.Register("HeadName", typeof(string), typeof(RecipeLoad));        /// <summary>        /// HeadName        /// </summary>        public string HeadName        {            get            {                return (string)this.GetValue(HeadNameProperty);            }            set            {                this.SetValue(HeadNameProperty, value);            }        }        public static readonly DependencyProperty ReplenNameProperty = DependencyProperty.Register("ReplenName", typeof(string), typeof(RecipeLoad));        /// <summary>        /// ReplenName        /// </summary>        public string ReplenName        {            get            {                return (string)this.GetValue(ReplenNameProperty);            }            set            {                this.SetValue(ReplenNameProperty, value);            }        }        public static readonly DependencyProperty RecipeModeValueProperty = DependencyProperty.Register(          "RecipeModeValue", typeof(string), typeof(RecipeLoad));        /// <summary>        /// OpertationModeValue        /// </summary>        public string RecipeModeValue        {            get            {                return (string)this.GetValue(RecipeModeValueProperty);            }            set            {                this.SetValue(RecipeModeValueProperty, value);            }        }        private static void SelectedRecipeNodeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)        {            if(e.NewValue!=null)            {                d.SetValue(LoadEnabledProperty, true);            }            else            {                d.SetValue(LoadEnabledProperty, false);            }        }        private void LoadRecipe_Click(object sender, RoutedEventArgs e)        {            if (RecipeType == "rds")            {                InvokeClient.Instance.Service.DoOperation($"{Module}.LoadRecipe", SelectedRecipeNode.RecipeFullFileName, ReplenName);            }            else            {                InvokeClient.Instance.Service.DoOperation($"{Module}.LoadRecipe", SelectedRecipeNode.RecipeFullFileName);            }        }    }}
 |