using DataRWDAL; 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; using XHandler.Class.DataEx; using XImagingXhandler.XDAL; using static XHandler.Controls.MultiComboBox; using XCore; using System.Runtime.Remoting.Channels; using XHandler.Controls; using XHandler.View.MethodProperty; using XCommon.Log; using DataEntity.Share; namespace XHandler.View.MethodProperty.ElectroPart { /// /// CaptureElectroProperty.xaml 的交互逻辑 /// public partial class CaptureElectroProperty : UserControl, IMethodProperty { ObservableCollection bacteriaList = new ObservableCollection(); BacteriaBll bacteriaBll = new BacteriaBll(); int mark = 0; #region 全局变量 string isrun = ""; string status = ""; string name = ""; string label = ""; int choicemode = 0; string gumLabwareText = ""; // 放胶耗材名称文本 string gumLabwareValue = ""; // 放胶耗材名称Id private int coatingLabwareGotFocus = 0; #endregion public MethodTakePhotoForElectro methodTakePhotoForElectro { get; set; } public MethodTakePhotoForElectro currmethodTakePhotoForElectro = null; public CaptureElectroProperty() { InitializeComponent(); } public CaptureElectroProperty(MethodEx method) { mark = 0; InitializeComponent(); methodTakePhotoForElectro = new MethodTakePhotoForElectro(); methodTakePhotoForElectro.name = method.method_name; methodTakePhotoForElectro.label = method.method_name; methodTakePhotoForElectro.status = (method.isEnabled == true ? "enable" : "disable"); methodTakePhotoForElectro.strIndex = method.strIndex; this.DataContext = methodTakePhotoForElectro; if (methodTakePhotoForElectro.identification == 1) radioBtnManual.IsChecked = true; else radioBtnAuto.IsChecked = true; methodTakePhotoForElectro.identification = 0; if (method.tag != null) { methodTakePhotoForElectro = (MethodTakePhotoForElectro)method.tag; currmethodTakePhotoForElectro = methodTakePhotoForElectro; isrun = methodTakePhotoForElectro.isrun; status = methodTakePhotoForElectro.status; name = methodTakePhotoForElectro.name; label = methodTakePhotoForElectro.label; choicemode = methodTakePhotoForElectro.identification; gumLabwareText = methodTakePhotoForElectro.gumLabwareText; gumLabwareValue = methodTakePhotoForElectro.gumLabwareValue; } radioBtnManual.IsChecked = true; } private void UserControl_Loaded(object sender, RoutedEventArgs e) { mark += 1; try { if (mark > 2) { return; } if (!string.IsNullOrEmpty(label)) { tbxCommandLabel.Text = label; tbxCommandName.Text = name; gridManual.Visibility = Visibility.Visible; // 加载涂布耗材数据 string[] coatingLabwareValues = gumLabwareValue.Split(','); string[] coatingLabwareTexts = gumLabwareText.Split(','); for (int iCoatingLabwareValueIndex = 0; iCoatingLabwareValueIndex < coatingLabwareValues.Length; iCoatingLabwareValueIndex++) { PromptTextBox textBox = placeGumLabwareA; textBox.Tag = coatingLabwareValues[iCoatingLabwareValueIndex]; textBox.Text = coatingLabwareTexts[iCoatingLabwareValueIndex]; } if (choicemode == 1) { radioBtnManual.IsChecked = true; } else if (choicemode == 0) { radioBtnAuto.IsChecked = true; } } else { //gridManual.Visibility = Visibility.Hidden; } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } private void radioBtnManual_Checked(object sender, RoutedEventArgs e) { if (methodTakePhotoForElectro == null) return; methodTakePhotoForElectro.identification = 1; } private void radioBtnAuto_Checked(object sender, RoutedEventArgs e) { if (methodTakePhotoForElectro == null) return; methodTakePhotoForElectro.identification = 0; } private void placeGumLabwareA_TextChanged(object sender, TextChangedEventArgs e) { try { methodTakePhotoForElectro.gumLabwareText = placeGumLabwareA.Text; methodTakePhotoForElectro.gumLabwareValue = placeGumLabwareA.Tag.ToString(); } catch(Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } private void placeGumLabwareA_GotFocus(object sender, RoutedEventArgs e) { coatingLabwareGotFocus = 0; } private void tbxCommandName_TextChanged(object sender, TextChangedEventArgs e) { try { if (mark == 1) { //methodTakePhotoForElectro.name = tbxCommandName.Text; } else { methodTakePhotoForElectro.name = tbxCommandName.Text; } } catch (Exception ex) { LoggerHelper.ErrorLog("ERROR:", ex); } } public void SetTableName(string tableName, Labware lb) { if (lb == null) return; if (gridManual.Visibility == Visibility.Visible) { if (methodTakePhotoForElectro != null) { placeGumLabwareA.Tag = lb.labware_id; placeGumLabwareA.Text = lb.labware_name; } } } } }