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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
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;
using XHandler.Class.DataEx;
using XHandler.Controls;
using XImagingXhandler.XDAL;
 
namespace XHandler.View.Consumables
{
    /// <summary>
    /// 试剂槽设置页面
    /// </summary>
    public partial class ThroughSetting : UserControl
    {
        public Labware labware { get; set; }
 
        public ThroughSetting()
        {
            InitializeComponent();
        }
 
        public ThroughSetting(Labware l)
        {
            InitializeComponent();
            labware = l;
            DataContext = labware;
        }
 
        private void AddGapLabware(int gap)
        {
            gridGapLabware.Children.Clear();
            GapLabware labware = new GapLabware()
            {
                Width = 200,
                GapWidth = 15,
                LabwareGap = gap,
                HorizontalAlignment = HorizontalAlignment.Left,
            };
            gridGapLabware.Children.Add(labware);
        }
 
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (labware == null)
                return;
 
            if (Convert.ToDouble(textboxBottomPartHeight.Text.Trim()) > 0)
            {
                checkboxThroughBottom.IsChecked = true;
            }
 
            btnLeftSideColor.RGB = labware.labware_color_lside;     // 左侧
            btnWideColor.RGB = labware.labware_color_front;         // 前侧
            btnTopColor.RGB = labware.labware_color_top;            // 顶面
            btnLineColor.RGB = labware.labware_color_line;          // 边框线
        }
 
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox btn = (CheckBox)sender;
            int nGap = 0;
            if (checkboxWN.IsChecked == true)
            {
                nGap = nGap | GapLabware.WN;
            }
            if (checkboxWS.IsChecked == true)
            {
                nGap = nGap | GapLabware.WS;
            }
            if (checkboxEN.IsChecked == true)
            {
                nGap = nGap | GapLabware.EN;
            }
            if (checkboxES.IsChecked == true)
            {
                nGap = nGap | GapLabware.ES;
            }
            AddGapLabware(nGap);
        }
 
        #region 宽边颜色
        private void btnWideColor_SelectedColorChangedEvent(object sender, EventArgs e)
        {
            if (labware == null)
            {
                return;
            }
 
            labware.labware_color_front = btnWideColor.RGB;
        }
        #endregion
 
        #region 窄边颜色
        private void btnLeftSideColor_SelectedColorChangedEvent(object sender, EventArgs e)
        {
            if (labware == null)
            {
                return;
            }
 
            labware.labware_color_lside = btnLeftSideColor.RGB;
        }
        #endregion
 
        #region 顶部颜色
        private void btnTopColor_SelectedColorChangedEvent(object sender, EventArgs e)
        {
            if (labware == null)
            {
                return;
            }
 
            labware.labware_color_top = btnTopColor.RGB;
        }
        #endregion
 
        #region 边线颜色
        private void btnLineColor_SelectedColorChangedEvent(object sender, EventArgs e)
        {
            if (labware == null)
            {
                return;
            }
 
            labware.labware_color_line = btnLineColor.RGB;
        }
        #endregion
 
        private void checkboxThroughBottom_Checked(object sender, RoutedEventArgs e)
        {
            if (checkboxThroughBottom.IsChecked == true)
            {
                textblockBottomPartHeight.Visibility = Visibility.Visible;
                textboxBottomPartHeight.Visibility = Visibility.Visible;
                imageBottomPartHeight.Visibility = Visibility.Visible;
            }
            else
            {
                textblockBottomPartHeight.Visibility = Visibility.Collapsed;
                textboxBottomPartHeight.Visibility = Visibility.Collapsed;
                imageBottomPartHeight.Visibility = Visibility.Collapsed;
            }
        }
    }
}