123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- 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
- {
- /// <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; }
- 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<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";
- 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<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;
- //}
- }
- }
- }
|