Main.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. using System;
  2. using DevExpress.XtraBars;
  3. using UAS_DeviceMonitor.DataOperate;
  4. using System.Data;
  5. using System.Text;
  6. using UAS_DeviceMonitor.Entity;
  7. using UAS_DeviceMonitor.PublicMethod;
  8. using DevExpress.XtraGrid.Views.Grid;
  9. using System.Collections.Generic;
  10. using System.Drawing;
  11. using DevExpress.XtraBars.Ribbon;
  12. using System.Threading;
  13. using UAS_DeviceMonitor.CustomerControl.PictureEditWithText;
  14. using System.Windows.Forms;
  15. using DevExpress.XtraEditors.Controls;
  16. namespace UAS_DeviceMonitor
  17. {
  18. public partial class Main : RibbonForm
  19. {
  20. StringBuilder sql = new StringBuilder();
  21. DataHelper dh;
  22. ModeBusTCPServer mbt = new ModeBusTCPServer();
  23. #region 初始化代码
  24. public Main()
  25. {
  26. dh = new DataHelper();
  27. SystemInf.dh = dh;
  28. InitializeComponent();
  29. dpc_enableCheckEdit.QueryCheckStateByValue += CheckedEdit_QueryCheckStateByValue;
  30. CommandSetRepositoryItemComboBox1.ParseEditValue += CommandSetRepositoryItemComboBox1_ParseEditValue;
  31. CheckEditCommandSet.QueryCheckStateByValue += CheckedEdit_QueryCheckStateByValue;
  32. PollSettingItemSearchLookUpEdit.ParseEditValue += PollSettingItemSearchLookUpEdit_ParseEditValue;
  33. GridViewPollSetting.RowCellStyle += GridViewPollSetting_RowCellStyle;
  34. #region 添加发送接收编码规则的静态值
  35. ComboBoxData cbd = new ComboBoxData();
  36. cbd.Text = "UTF-8";
  37. cbd.Value = "UTF-8";
  38. ComboBoxData cbd1 = new ComboBoxData();
  39. cbd1.Text = "Hexadecimal";
  40. cbd1.Value = "Hexadecimal";
  41. ComboBoxData cbd2 = new ComboBoxData();
  42. cbd2.Text = "ASCII";
  43. cbd2.Value = "ASCII";
  44. CommandSetRepositoryItemComboBox1.Items.Add(cbd);
  45. CommandSetRepositoryItemComboBox1.Items.Add(cbd1);
  46. CommandSetRepositoryItemComboBox1.Items.Add(cbd2);
  47. #endregion
  48. }
  49. private void CommandSetRepositoryItemComboBox1_ParseEditValue(object sender, ConvertEditValueEventArgs e)
  50. {
  51. string val = "";
  52. if (e.Value != null)
  53. {
  54. val = e.Value.ToString();
  55. }
  56. else
  57. {
  58. val = "FALSE";//默认为不选
  59. }
  60. e.Value = val;
  61. e.Handled = true;
  62. }
  63. private void PollSettingItemSearchLookUpEdit_ParseEditValue(object sender, ConvertEditValueEventArgs e)
  64. {
  65. e.Handled = true;
  66. }
  67. private void Main_Load(object sender, EventArgs e)
  68. {
  69. //设备列表
  70. GridDeviceList.GetDataSQL = "select de_id,de_code,de_name,de_spec,de_indate,de_runstatus,de_address,de_wccode,de_vendcode,de_vendname from device".ToUpper();
  71. ToolPageControlDeviceList.Gridcontrol = GridDeviceList;
  72. //轮询业务
  73. //GridPolling.GetDataSQL = "select 0 CHECKEDCOLUMN,pl_id,pl_code,pl_name,pl_type,pl_dccode,pl_remark from polling".ToUpper();
  74. //GridPolling.ID = "pl_id";
  75. //GridPolling.TableName = "polling";
  76. //GridPolling.InsertSQL = "insert into polling(pl_id,pl_code,pl_name,pl_type,pl_dccode,pl_remark) values(polling_seq.nextval,:pl_code,:pl_name,:pl_type,:pl_dccode,:pl_remark)";
  77. //ButtonDeletePolling.Grid = GridPolling;
  78. //ButtonSavePolling.Grid = GridPolling;
  79. //ButtonAddPolling.Grid = GridPolling;
  80. //轮询配置界面
  81. GridPollingSetting.GetDataSQL = "SELECT '' POLLSETTINGSTATUSCOLUMN,0 CHECKEDCOLUMN,DPC_ID,DPC_DECODE ,DPC_INTERVAL ,DPC_DCCODE ,DPC_FUNCTION , nvl(DPC_ENABLE,0)DPC_ENABLE,DPC_STATUS ,DPC_REMARK FROM DEVICEPOLLINGCONFIG ORDER BY DPC_ID";
  82. GridPollingSetting.ID = "DPC_ID";
  83. GridPollingSetting.TableName = "DEVICEPOLLINGCONFIG";
  84. GridPollingSetting.InsertSQL = "insert into DEVICEPOLLINGCONFIG(DPC_ID,DPC_DECODE ,DPC_INTERVAL ,DPC_DCCODE ,DPC_FUNCTION , DPC_ENABLE,DPC_STATUS ,DPC_REMARK) values(DEVICEPOLLINGCONFIG_seq.nextval,:DPC_DECODE ,:DPC_INTERVAL ,:DPC_DCCODE ,:DPC_FUNCTION , :DPC_ENABLE,:DPC_STATUS ,:DPC_REMARK)";
  85. ButtonSaveCommandSet.Grid = GridPollingSetting;
  86. ButtonNewCommandSet.Grid = GridPollingSetting;
  87. ButtonDeleteCommandSet.Grid = GridPollingSetting;
  88. //指令设置界面
  89. GridCommandSetting.GetDataSQL = "select 0 CHECKEDCOLUMN,dc_id,dc_code,dc_name,dc_value,dc_sendcoding,dc_receivecoding from devicecommand ".ToUpper();
  90. GridCommandSetting.TableName = "devicecommand";
  91. GridCommandSetting.ID = "dc_id";
  92. GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding)";
  93. ButtonSaveCommand.Grid = GridCommandSetting;
  94. ButtonDeleteCommand.Grid = GridCommandSetting;
  95. ButtonNewCommand.Grid = GridCommandSetting;
  96. //设备联网配置界面
  97. GridDeviceNetSetting.GetDataSQL = "SELECT 0 CHECKEDCOLUMN,DNC_ID,DNC_DECODE,DNC_GATEWAY,DNC_UPPERIP,DNC_PORT,DNC_MAC,DNC_IP,DNC_TYPE FROM DEVICENETCONFIG order by DNC_ID";
  98. GridDeviceNetSetting.ID = "dnc_id";
  99. GridDeviceNetSetting.TableName = "DEVICENETCONFIG";
  100. GridDeviceNetSetting.InsertSQL = "insert into DEVICENETCONFIG(DNC_ID,DNC_DECODE,DNC_GATEWAY,DNC_UPPERIP,DNC_PORT,DNC_MAC,DNC_IP,DNC_TYPE) values(DEVICENETCONFIG_SEQ.NEXTVAL,:DNC_DECODE,:DNC_GATEWAY,:DNC_UPPERIP,:DNC_PORT,:DNC_MAC,:DNC_IP,:DNC_TYPE)";
  101. ButtonDeleteNetConfig.Grid = GridDeviceNetSetting;
  102. ButtonAddNetConfig.Grid = GridDeviceNetSetting;
  103. ButtonSaveNetConfig.Grid = GridDeviceNetSetting;
  104. Ptime = new Dictionary<int, PollingTimer>();
  105. }
  106. #endregion
  107. #region 界面通用事件
  108. /// <summary>
  109. /// 选项卡切换不同XPage
  110. /// </summary>
  111. /// <param name="sender"></param>
  112. /// <param name="e"></param>
  113. private void ButtonItem_ItemClick(object sender, ItemClickEventArgs e)
  114. {
  115. HideXPage(e.Item.Tag.ToString());
  116. }
  117. /// <summary>
  118. /// 根据点击按钮的Tag显示对应的XPage
  119. /// </summary>
  120. /// <param name="PageName"></param>
  121. private void HideXPage(string PageName)
  122. {
  123. for (int i = 0; i < MainTabControl.TabPages.Count; i++)
  124. {
  125. if (MainTabControl.TabPages[i].Name == PageName)
  126. MainTabControl.TabPages[i].PageVisible = true;
  127. else
  128. MainTabControl.TabPages[i].PageVisible = false;
  129. }
  130. }
  131. /// <summary>
  132. /// 勾选Grid的CheckBox
  133. /// </summary>
  134. /// <param name="sender"></param>
  135. /// <param name="e"></param>
  136. private void CheckedEdit_QueryCheckStateByValue(object sender, DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventArgs e)
  137. {
  138. string val = "";
  139. if (e.Value != null)
  140. {
  141. val = e.Value.ToString();
  142. }
  143. else
  144. {
  145. val = "FALSE";//默认为不选
  146. }
  147. switch (val.ToUpper())
  148. {
  149. case "TRUE":
  150. case "YES":
  151. case "1":
  152. e.CheckState = System.Windows.Forms.CheckState.Checked;
  153. break;
  154. case "FALSE":
  155. case "NO":
  156. case "0":
  157. e.CheckState = System.Windows.Forms.CheckState.Unchecked;
  158. break;
  159. default:
  160. e.CheckState = System.Windows.Forms.CheckState.Checked;
  161. break;
  162. }
  163. e.Handled = true;
  164. }
  165. #endregion
  166. #region PageCommandSet业务代码(指令设置)
  167. /// <summary>
  168. /// 判断指令编号不能重复
  169. /// </summary>
  170. /// <param name="sender"></param>
  171. /// <param name="e"></param>
  172. private void ButtonSaveCommand_Click(object sender, EventArgs e)
  173. {
  174. GridCommandSetting.InsertSQL = "insert into devicecommand(dc_id,dc_code,dc_name,dc_value,dc_debrand,dc_sendcoding,dc_receivecoding) values(devicecommand_seq.nextval,:dc_code,:dc_name,:dc_value,'" + BaseUtil.GetComboxEditValue(Brand) + "',:dc_sendcoding,:dc_receivecoding)";
  175. ButtonSaveCommand.DoSave();
  176. }
  177. /// <summary>
  178. /// 加载ComBox品牌数据
  179. /// </summary>
  180. /// <param name="sender"></param>
  181. /// <param name="e"></param>
  182. private void PageCommandSet_VisibleChanged(object sender, EventArgs e)
  183. {
  184. if (PageCommandSet.PageVisible)
  185. {
  186. DataTable dt = (DataTable)SystemInf.dh.ExecuteSql("select * from devicebrand", "select");
  187. BaseUtil.FillComBoxEditWidthDataTable(Brand, "db_name", "db_code", dt);
  188. GridCommandSetting.Condition = " where dc_debrand='" + BaseUtil.GetComboxEditValue(Brand) + "' order by dc_id";
  189. }
  190. }
  191. private void Brand_SelectedIndexChanged(object sender, EventArgs e)
  192. {
  193. GridCommandSetting.Condition = " where dc_debrand='" + BaseUtil.GetComboxEditValue(Brand) + "' order by dc_id";
  194. GridCommandSetting.RefreshData();
  195. }
  196. #endregion
  197. #region PagePollingSetting业务代码(轮询配置)
  198. PollingTask pt = new PollingTask();
  199. /// <summary>
  200. /// 绘制轮询配置状态栏
  201. /// </summary>
  202. List<int> PollSettingPaintRowIndex = new List<int>();
  203. private void ButtonStartPolling_Click(object sender, EventArgs e)
  204. {
  205. GridView grid = GridViewPollSetting;
  206. mbt.Open();
  207. for (int i = 0; i < GridPollingSetting.RowCount; i++)
  208. {
  209. Polling pl = new Polling();
  210. pl.Id = int.Parse(GridViewPollSetting.GetRowCellValue(i, "DPC_ID").ToString());
  211. pl.DeviceCode = GridViewPollSetting.GetRowCellValue(i, "DPC_DECODE").ToString();
  212. pl.CommandCode = GridViewPollSetting.GetRowCellValue(i, "DPC_DCCODE").ToString();
  213. pl.Interval = int.Parse(GridViewPollSetting.GetRowCellValue(i, "DPC_INTERVAL").ToString());
  214. pl.SendRadix = GridViewPollSetting.GetRowCellValue(i, "DPC_INTERVAL").ToString();
  215. pl.Enable = GridViewPollSetting.GetRowCellValue(i, "DPC_ENABLE").ToString() != "0";
  216. pl.Dh = new DataHelper();
  217. if (pl.Enable)
  218. {
  219. pt.AddTask(RunTask, pl);
  220. //添加到状态为运行的行
  221. PollSettingPaintRowIndex.Add(i);
  222. GridPollingSetting.Focus();
  223. }
  224. }
  225. }
  226. /// <summary>
  227. /// 绘制轮询状态
  228. /// </summary>
  229. /// <param name="sender"></param>
  230. /// <param name="e"></param>
  231. private void GridViewPollSetting_RowCellStyle(object sender, RowCellStyleEventArgs e)
  232. {
  233. if (e.Column.Name.ToUpper() == "POLLSETTINGSTATUSCOLUMN" && PollSettingPaintRowIndex.Contains(e.RowHandle))
  234. {
  235. e.Appearance.BackColor = Color.Green;
  236. }
  237. }
  238. Dictionary<int, PollingTimer> Ptime;
  239. private void RunTask(object i)
  240. {
  241. PollingTimer timer = new PollingTimer();
  242. Polling pl = (Polling)i;
  243. timer.Polling = i;
  244. timer.Interval = pl.Interval * 5000;
  245. timer.Elapsed += Timer_Tick;
  246. timer.Start();
  247. try
  248. {
  249. if (!Ptime.ContainsKey(pl.Id))
  250. Ptime.Add(pl.Id, timer);
  251. }
  252. catch (Exception)
  253. {
  254. if (!Ptime.ContainsKey(pl.Id))
  255. Ptime.Add(pl.Id, timer);
  256. }
  257. }
  258. /// <summary>
  259. /// 轮询执行的业务
  260. /// </summary>
  261. /// <param name="sender"></param>
  262. /// <param name="e"></param>
  263. private void Timer_Tick(object sender, EventArgs e)
  264. {
  265. PollingTimer timer = (PollingTimer)sender;
  266. Polling pl = (Polling)timer.Polling;
  267. DataHelper dh = pl.Dh;
  268. string Decode = pl.DeviceCode;
  269. string Dccode = pl.CommandCode;
  270. DataTable dt = (DataTable)dh.ExecuteSql("select dnc_ip,dnc_port from DEVICENETCONFIG where dnc_decode='" + Decode + "'", "select");
  271. DataTable dt1 = (DataTable)dh.ExecuteSql("select dc_sendcoding,dc_value,dc_receivecoding from devicecommand where dc_code='" + Dccode + "'", "select");
  272. if (dt.Rows.Count > 0)
  273. {
  274. string IP = dt.Rows[0]["dnc_ip"].ToString() + ":" + dt.Rows[0]["dnc_port"].ToString();
  275. string SendCoding = "";
  276. string ReceiveCoding = "";
  277. string Command = "";
  278. if (dt1.Rows.Count > 0)
  279. {
  280. SendCoding = dt1.Rows[0]["dc_sendcoding"].ToString();
  281. ReceiveCoding = dt1.Rows[0]["dc_receivecoding"].ToString();
  282. Command = dt1.Rows[0]["dc_value"].ToString();
  283. }
  284. mbt.Send(IP, SendCoding, ReceiveCoding, Command);
  285. //处理2秒之内返回的指令
  286. Thread.Sleep(2000);
  287. if (mbt.Returnvalue.ContainsKey(IP))
  288. {
  289. mbt.Returnvalue.Remove(IP);
  290. dh.UpdateByCondition("DEVICEPOLLINGCONFIG", "dpc_status='Running'", "dpc_decode='" + Decode + "' and dpc_dccode='" + Dccode + "'");
  291. }
  292. else
  293. {
  294. dh.UpdateByCondition("DEVICEPOLLINGCONFIG", "dpc_status='Stop'", "dpc_decode='" + Decode + "' and dpc_dccode='" + Dccode + "'");
  295. }
  296. }
  297. }
  298. /// <summary>
  299. /// 停止全部轮询
  300. /// </summary>
  301. /// <param name="sender"></param>
  302. /// <param name="e"></param>
  303. private void ButtonPausePolling_Click(object sender, EventArgs e)
  304. {
  305. foreach (var item in Ptime)
  306. {
  307. item.Value.Stop();
  308. }
  309. PollSettingPaintRowIndex.Clear();
  310. GridPollingSetting.Focus();
  311. Ptime.Clear();
  312. }
  313. private void GridViewPollSetting_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
  314. {
  315. GridViewPollSetting.SetRowCellValue(e.RowHandle, e.Column, e.Value);
  316. if (e.Column.Name.ToUpper() == "DPC_ENABLE")
  317. {
  318. if (GridViewPollSetting.GetRowCellValue(e.RowHandle, "DPC_ENABLE").ToString() == "0")
  319. {
  320. int id = int.Parse(GridViewPollSetting.GetRowCellValue(e.RowHandle, "DPC_ID").ToString());
  321. if (Ptime.ContainsKey(id))
  322. {
  323. Ptime[id].Stop();
  324. Ptime.Remove(id);
  325. PollSettingPaintRowIndex.Remove(e.RowHandle);
  326. }
  327. }
  328. else
  329. {
  330. Polling pl = new Polling();
  331. pl.Id = int.Parse(GridViewPollSetting.GetRowCellValue(e.RowHandle, "DPC_ID").ToString());
  332. pl.DeviceCode = GridViewPollSetting.GetRowCellValue(e.RowHandle, "DPC_DECODE").ToString();
  333. pl.Interval = int.Parse(GridViewPollSetting.GetRowCellValue(e.RowHandle, "DPC_INTERVAL").ToString());
  334. pl.Enable = GridViewPollSetting.GetRowCellValue(e.RowHandle, "DPC_ENABLE").ToString() != "0";
  335. pl.Dh = new DataHelper();
  336. if (pl.Enable)
  337. pt.AddTask(RunTask, pl);
  338. PollSettingPaintRowIndex.Add(e.RowHandle);
  339. }
  340. }
  341. }
  342. /// <summary>
  343. /// 设置GridView多选放大镜
  344. /// </summary>
  345. /// <param name="sender"></param>
  346. /// <param name="e"></param>
  347. private void PagePollingSetting_VisibleChanged(object sender, EventArgs e)
  348. {
  349. if (PagePollingSetting.PageVisible)
  350. {
  351. DataTable dt = (DataTable)SystemInf.dh.ExecuteSql("SELECT DC_CODE,DC_NAME,DC_REMARK FROM DEVICECOMMAND", "select");
  352. PollSettingItemSearchLookUpEdit.DataSource = dt;
  353. PollSettingItemSearchLookUpEdit.DisplayMember = "DC_CODE";
  354. PollSettingItemSearchLookUpEdit.ValueMember = "DC_CODE";
  355. }
  356. }
  357. #endregion
  358. #region 设备查看界面
  359. private void PageDeviceStatus_VisibleChanged(object sender, EventArgs e)
  360. {
  361. if (PageDeviceStatus.PageVisible)
  362. {
  363. DataTable dt = (DataTable)dh.ExecuteSql("select distinct de_code,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG on dpc_decode=de_code order by de_code", "select");
  364. //界面重新展示时如过数量不一致则重新绘制
  365. if (PanelDeviceStatus.Controls.Count != dt.Rows.Count)
  366. {
  367. int CountPerRow = PanelDeviceStatus.Width / 110;
  368. int RightPadding = PanelDeviceStatus.Width % 110;
  369. int Count = dt.Rows.Count;
  370. int RowCount = Count % CountPerRow == 0 ? Count / CountPerRow : Count / CountPerRow + 1;
  371. int LastRowCount = 0;
  372. for (int i = 0; i < PanelDeviceStatus.Controls.Count; i++)
  373. {
  374. PanelDeviceStatus.Controls[i].Dispose();
  375. }
  376. for (int j = 0; j < RowCount; j++)
  377. {
  378. //如果是最后一行则循环尾数
  379. if (j == RowCount - 1)
  380. {
  381. LastRowCount = Count % CountPerRow;
  382. }
  383. for (int i = 0; i < (j == RowCount - 1 ? LastRowCount : CountPerRow); i++)
  384. {
  385. PictureEditWithText pic = new PictureEditWithText();
  386. pic.Name = dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j;
  387. pic.Anchor = AnchorStyles.Left;
  388. pic.Anchor = AnchorStyles.Top;
  389. pic.Picedit.Properties.SizeMode = PictureSizeMode.Squeeze;
  390. if (dt.Rows[j * CountPerRow + i]["dpc_status"].ToString() != "Running")
  391. {
  392. CommonTipController.SetToolTip(pic.Picedit, "离线");
  393. pic.Picedit.Image = Properties.Resources.network_offline;
  394. }
  395. else
  396. {
  397. CommonTipController.SetToolTip(pic.Picedit, "在线");
  398. pic.Picedit.Image = Properties.Resources.net_connected;
  399. }
  400. pic.Text = dt.Rows[j * CountPerRow + i]["de_code"].ToString();
  401. pic.Picedit.BorderStyle = BorderStyles.HotFlat;
  402. pic.Location = new Point((10 + RightPadding) / 2 + 110 * i, 10 + j * 130);
  403. PanelDeviceStatus.Controls.Add(pic);
  404. }
  405. }
  406. BaseUtil.CleanMemory();
  407. TimerDeviceStatus.Start();
  408. }
  409. }
  410. }
  411. //重新展示设备图像界面
  412. private void ShowDeviceStatus()
  413. {
  414. DataTable dt = (DataTable)dh.ExecuteSql("select distinct de_code,dpc_status,dpc_id from device left join DEVICEPOLLINGCONFIG on dpc_decode=de_code order by de_code", "select");
  415. int CountPerRow = PanelDeviceStatus.Width / 110;
  416. int RightPadding = PanelDeviceStatus.Width % 110;
  417. int Count = dt.Rows.Count;
  418. int RowCount = Count % CountPerRow == 0 ? Count / CountPerRow : Count / CountPerRow + 1;
  419. int LastRowCount = 0;
  420. //只更换现有控件的图片,不必重新绘制控件
  421. for (int j = 0; j < RowCount; j++)
  422. {
  423. //如果是最后一行则循环尾数
  424. if (j == RowCount - 1)
  425. {
  426. LastRowCount = Count % CountPerRow;
  427. }
  428. for (int i = 0; i < (j == RowCount - 1 ? LastRowCount : CountPerRow); i++)
  429. {
  430. if (dt.Rows[j * CountPerRow + i]["dpc_status"].ToString() != "Running")
  431. {
  432. (PanelDeviceStatus.Controls[dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j] as PictureEditWithText).Picedit.Image = Properties.Resources.network_offline;
  433. }
  434. else
  435. {
  436. (PanelDeviceStatus.Controls[dt.Rows[j * CountPerRow + i]["de_code"].ToString() + i + j] as PictureEditWithText).Picedit.Image = Properties.Resources.net_connected;
  437. }
  438. }
  439. }
  440. }
  441. //刷新界面
  442. private void TimerDeviceStatus_Tick(object sender, EventArgs e)
  443. {
  444. if (PageDeviceStatus.PageVisible)
  445. {
  446. ShowDeviceStatus();
  447. }
  448. }
  449. private void PanelDeviceStatus_SizeChanged(object sender, EventArgs e)
  450. {
  451. if (PageDeviceStatus.PageVisible)
  452. {
  453. ShowDeviceStatus();
  454. TimerDeviceStatus.Start();
  455. }
  456. }
  457. #endregion
  458. }
  459. }