| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 | 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;namespace Aitex.UI.RecipeEditor.View{    /// <summary>    /// Interaction logic for RecipeNameInputDlg.xaml    /// </summary>    public partial class EndPointDlg : Window    {        public EndPointConfigItem ConfigItem        {            get;            set;        }        public class AlogarithmTypeItem        {            public string AlogarithmName { get; set; }        }        public List<AlogarithmTypeItem> AlgorithmTypes { get; set; }        public string SelectedConfig { get; set; }        public EndPointDlg( )        {            InitializeComponent();            AlgorithmTypes = new List<AlogarithmTypeItem>()            {                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";        }        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)        {                        this.DialogResult = true;        }        private void TextBoxEx_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)        {            if (sender is TextBox txt)            {                var regionList = new List<string> { "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<string> { "A", "B", "C", "D" };                var res = ExpressionWindow.TransExpression(txt.Text, regionList);                txt.Foreground = res ? Brushes.Black : Brushes.Red;            }        }    }}
 |