|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using BPASmartClient.Helper;
- using FryPot_DosingSystem.Model;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- 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.Shapes;
-
- namespace FryPot_DosingSystem.View
- {
- /// <summary>
- /// NewRecipeView.xaml 的交互逻辑
- /// </summary>
- public partial class NewRecipeView : Window
- {
- public NewRecipeView()
- {
- InitializeComponent();
- this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
- ActionManage.GetInstance.CancelRegister("CloseNewRecipeView");
- ActionManage.GetInstance.Register(new Action(() => { this.Close();}), "CloseNewRecipeView");
- }
-
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
-
- private void ComboBox_KeyUp(object sender, KeyEventArgs e)
- {
- var res = sender as ComboBox;
- Json<MaterialNames>.Read();
-
- if (res.Text != null)
- {
- var datas = Json<MaterialNames>.Data.Names.Where(s => s.Contains(res.Text.Trim()));
- // var datas = Json<MaterialNames>.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim()));
- if (datas.Count() > 0)
- {
- res.ItemsSource = datas;
- res.IsDropDownOpen = true;
- }
- else
- {
- res.IsDropDownOpen = false;
- }
- }
- }
-
- private void ComboBox_LostFocus(object sender, RoutedEventArgs e)
- {
- var res = sender as ComboBox;
- if (res.Text != null)
- {
- if (!MaterialNames.GetInstance.Names.Contains(res.Text.Trim()))//判断是否存在原料
- {
- MaterialNames.GetInstance.Names.Add(res.Text.Trim());
- Json<MaterialNames>.Data = MaterialNames.GetInstance;
- Json<MaterialNames>.Save();
- }
-
- }
- }
-
- private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
- {
- if (sender is TextBox txt)
- {
- if (new Regex("^[1-8]$").IsMatch(txt.Text))//全匹配
- {
-
- }
- else
- {
- txt.Text=string.Empty;
- }
- }
- }
- }
- }
|