schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using System;
using System.Collections.ObjectModel;
using System.Windows.Controls;
using System.Windows.Input;
using XHandler.Class;
using XHandler.Class.DataEx;
using XImagingXhandler.XDAL;
 
namespace XHandler.View.Consumables
{
    /// <summary>
    /// CircularDishSetting.xaml 的交互逻辑
    /// </summary>
    public partial class CircularDishSetting : UserControl
    {
        public Labware labware { get; set; }
 
        public CircularDishSetting()
        {
            InitializeComponent();
        }
 
        public CircularDishSetting(Labware l)
        {
            InitializeComponent();
 
            labware = l;
            this.DataContext = labware;
            btnTopColor.RGB = labware.labware_color_top;        // 顶面
 
            ObservableCollection<string> divisionList = DataModule.getInstance().GetDivisionList();
            cbDivision.ItemsSource = divisionList;
            string division = labware.labware_round_division.ToString() + Properties.Resources.strDivision;
            if(divisionList.Contains(division))
                cbDivision.SelectedItem = division;
 
            ObservableCollection<string> specsDiameterList = DataModule.getInstance().GetSpecsDiameterList();
            cbSpecsDiameter.ItemsSource = specsDiameterList;
            string diameter = labware.labware_round_diameter + " mm";
            if(specsDiameterList.Contains(diameter))
                cbSpecsDiameter.SelectedItem = diameter;
 
            ObservableCollection<string> specsHeightList = DataModule.getInstance().GetSpecsHeightList();
            cbSpecsHeight.ItemsSource = specsHeightList;
            string height = labware.labware_round_height + " mm";
            if(specsHeightList.Contains(height)) 
                cbSpecsHeight.SelectedItem = height;
        }
 
        #region 顶部颜色
        private void btnTopColor_SelectedColorChangedEvent(object sender, EventArgs e)
        {
            if (labware == null)
            {
                return;
            }
 
            labware.labware_color_top = btnTopColor.RGB;
        }
        #endregion
 
        private void PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            if (!Utilities.isNumberic(e.Text))
            {
                e.Handled = true;
            }
            else
                e.Handled = false;
        }
 
        private void cbDivision_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string strDivision = cbDivision.SelectedItem as string;
            string tmp = strDivision.Substring(0, 1);
            int division = 1;
            int.TryParse(tmp, out division);
            labware.labware_round_division = division;
        }
 
        private void cbSpecsDiameter_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string strDiameter = cbSpecsDiameter.SelectedItem as string;
            string[] ary = strDiameter.Split(' ');
            int diameter = 35;
            int.TryParse(ary[0], out diameter);
            labware.labware_round_diameter = diameter;
        }
 
        private void cbSpecsHeight_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string strHeight = cbSpecsHeight.SelectedItem as string;
            string[] ary = strHeight.Split(' ');
            int height = 9;
            int.TryParse(ary[0], out height);
            labware.labware_round_height = height;
        }
 
        private void tbInnerBottomDiameter_TextChanged(object sender, TextChangedEventArgs e)
        {
 
        }
    }
}