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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
| using DataEntity.Share;
| using System;
| using System.Collections.Generic;
| 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.Shapes;
| using XCommon.Log;
| using XHandler.Class.DataEx;
| using XImagingXhandler.XDAL;
|
| namespace XHandler.View.Dialog
| {
| /// <summary>
| /// PlsArmChannelWin.xaml 的交互逻辑
| /// </summary>
| public partial class PlsArmChannelWin : Window
| {
| public string armText= string.Empty;
| public string armValue = string.Empty;
| public string channelText= string.Empty;
| public int[] channelArray=new int[0];
|
| public PlsArmChannelWin()
| {
| InitializeComponent();
| this.Owner = (Window)Shared.Main;
| this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
| }
|
| #region 界面加载
| private void Window_Loaded(object sender, RoutedEventArgs e)
| {
| try
| {
| List<DeviceArm> armList = DataModule.getInstance().GetDeviceArmWithAll();
| cbArm.ItemsSource = armList;
| cbArm.SelectedIndex = 0;
|
| if (Shared.ChannelCount > 1)
| {
| tipsChannel.CanEdit = true;
|
| if (Shared.ChannelCount.Equals(96))
| {
| tipsChannel.Visibility = Visibility.Collapsed;
| }
| }
| }
| catch(Exception ex)
| {
| LoggerHelper.ErrorLog("page load error", ex);
| }
| }
| #endregion
|
| private void btnCancel_Click(object sender, RoutedEventArgs e)
| {
| this.DialogResult = false;
| this.Close();
| }
|
| private void btnClose_Click(object sender, RoutedEventArgs e)
| {
| this.DialogResult = false;
| this.Close();
| }
|
| private void btnOK_Click(object sender, RoutedEventArgs e)
| {
| this.DialogResult = true;
| this.Close();
| }
|
| private void cbArm_SelectionChanged(object sender, SelectionChangedEventArgs e)
| {
| try
| {
| DeviceArm arm = cbArm.SelectedItem as DeviceArm;
| armText = arm.device_arm_name;
| armValue = arm.device_arm_id.ToString();
| channelArray = tipsChannel.SelectedChannels.ToArray();
| if (arm.arm_type.Equals(-1))
| {
| gdContent.RowDefinitions[2].Height = new GridLength(0);
| return;
| }
| else
| {
| gdContent.RowDefinitions[2].Height = new GridLength(60);
| }
| if (Shared.ChannelCount.Equals(96))
| {
| channelArray = new int[] {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};
| }
| else
| {
| // 臂未选择
| if (cbArm.SelectedIndex < 0 )
| {
| gdContent.RowDefinitions[2].Height = new GridLength(0);
| return;
| }
|
| tipsChannel_SelectedChangedEvent(null, null);
| }
|
| ReceiveAndUpdate(armValue);
| }
| catch (Exception ex)
| {
| LoggerHelper.ErrorLog(" cbArm_SelectionChanged ERROR:", ex);
| }
| }
|
| /// <summary>
| /// 通道设置变更后,更新节点
| /// </summary>
| /// <param name="testDesign"></param>
| public void ReceiveAndUpdate(string armVale)
| {
| try
| {
| // 获取当前设备臂信息
| List<DeviceArm> deviceArmList = DeviceArmDB.GetDeviceArmFromdb(Shared.SoftwareInformation.software_information_id);
| Shared.DeviceArmList = deviceArmList;
| DeviceArm deviceArm = Shared.DeviceArmList.SingleOrDefault(x => x.software_information_id.Equals(Shared.SoftwareInformation.software_information_id) && x.arm_type.Equals(1) && x.device_arm_id.Equals(Convert.ToInt32(armVale)));
| tipsChannel.TotalChannels = deviceArm.channels;
| tipsChannel.SetTotalChannelCount(deviceArm.channels);
| if (deviceArm.device_arm_property == "")
| {
| tipsChannel.SelectedChannels = new List<int> { };
| tipsChannel.SetSelectedChannels();
| //Shared.ChannelsId = new int[];
| return;
| }
| string[] strChannels = deviceArm.device_arm_property.Trim().Split(',');
| int[] iChannels = new int[strChannels.Length];
| for (int j = 0; j < strChannels.Length; j++)
| {
| iChannels[j] = Convert.ToInt32(strChannels[j]);
| }
|
| if (iChannels.Length > 0)
| {
| tipsChannel.SelectedChannels = iChannels.ToList();
| tipsChannel.SetSelectedChannels();
| }
|
| channelArray = iChannels.ToArray();
| }
| catch (Exception ex)
| {
| LoggerHelper.ErrorLog("tipsChannel_SelectedChangedEvent ERROR:", ex);
| }
| }
|
| private void tipsChannel_SelectedChangedEvent(object sender, EventArgs e)
| {
| try
| {
| channelArray = tipsChannel.SelectedChannels.ToArray();
| }
| catch (Exception ex)
| {
| LoggerHelper.ErrorLog("tipsChannel_SelectedChangedEvent ERROR:", ex);
| }
| }
| }
| }
|
|