using System; using System.Collections.Generic; 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.Shapes; using System.Text.RegularExpressions; //using EPDViewerLib; using MECF.Framework.Common.CommonData; using CyberX8_Core; namespace CyberX8_MainPages.Views { /// /// Interaction logic for RecipeNameInputDlg.xaml /// public partial class EndPointDlg : Window { public EndPointConfigItem ConfigItem { get; set; } public class AlogarithmTypeItem { public string AlogarithmName { get; set; } } public List AlgorithmTypes { get; set; } public string SelectedConfig { get; set; } private Recipe currentRecipe; private int? stepno ; public EndPointDlg(string para, EndPointConfigItem endPointConfigItem,Recipe recipe) { InitializeComponent(); string[] paras = para.Split('.'); if (paras.Length == 2) { this.Title = $"RecipeName:{paras[0]},StepNo:{paras[1].ToString()}"; stepno = Convert.ToInt32(paras[1])-1; } else { this.Title = "Error"; } AlgorithmTypes = new List() { new AlogarithmTypeItem() { AlogarithmName = "Unknown"}, new AlogarithmTypeItem() { AlogarithmName = "Above_ABS_Value"}, new AlogarithmTypeItem() { AlogarithmName = "Below_ABS_Value"}, new AlogarithmTypeItem() { AlogarithmName = "Drop_Percent"}, new AlogarithmTypeItem() { AlogarithmName = "Up_Percent"}, new AlogarithmTypeItem() { AlogarithmName = "Range_In"}, new AlogarithmTypeItem() { AlogarithmName = "Gradient"}, new AlogarithmTypeItem() { AlogarithmName = "Peek"}, new AlogarithmTypeItem() { AlogarithmName = "Valley"}, new AlogarithmTypeItem() { AlogarithmName = "Min_Drop_Percent"}, new AlogarithmTypeItem() { AlogarithmName = "Min_Up_Percent"}, new AlogarithmTypeItem() { AlogarithmName = "Max_Drop_Percent"}, new AlogarithmTypeItem() { AlogarithmName = "Max_Up_Percent"}, new AlogarithmTypeItem() { AlogarithmName = "Rise_Fall"}, new AlogarithmTypeItem() { AlogarithmName = "Fall_Rise"}, }; Loaded += new RoutedEventHandler(EndPointDlg_Loaded); SelectedConfig = "BelowValue3"; ConfigItem = endPointConfigItem; currentRecipe = recipe; } void EndPointDlg_Loaded(object sender, RoutedEventArgs e) { DataContext = ConfigItem; } private void buttonCancel_Click(object sender, RoutedEventArgs e) { this.DialogResult = false; } private void buttonOK_Click(object sender, RoutedEventArgs e) { if (stepno != null) { currentRecipe.Steps[(int)stepno].EPDConfig = ConfigItem.ToValue(); this.DialogResult = true; } } private void TextBoxEx_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { //if (sender is TextBox txt) //{ // var regionList = new List { "A", "B", "C", "D"}; // var input = new ExpressionWindow(txt, regionList); // input.Show(); //} } private void TextBoxEx_TextChanged(object sender, TextChangedEventArgs e) { //if (sender is TextBox txt) //{ // var regionList = new List { "A", "B", "C", "D" }; // var res = ExpressionWindow.TransExpression(txt.Text, regionList); // txt.Foreground = res ? Brushes.Black : Brushes.Red; //} } } }