12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using ProjectManagementSystem.Common.Core;
- using ProjectManagementSystem.Common.Logger;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace ProjectManagementSystem.UI
- {
- public partial class DebugAlarmLightUI : UserControl,IDisplayUI
- {
- public DebugAlarmLightUI()
- {
- InitializeComponent();
- }
- public bool Init()
- {
- dataGridUI1.dataGridView1.CellClick += DataGridView1_CellClick;
- comboBox2.SelectedIndex = 0;
- return true;
- }
- private void DataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- textBox1.Text = dataGridUI1.GetCurrentColValue("DeviceId");
- }
- public void UpdateDisplay()
- {
- if (!this.Visible) return;
- var dataList = DeviceControl.Instance.Communication.InfoAlarmLightDictionary.Values.ToList();
- dataGridUI1.ShowDataGrid(dataList);
- }
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
- int deviceId = int.Parse(textBox1.Text);
- int code = int.Parse(comboBox2.Text);
- DeviceControl.Instance.SetAlarmLight(deviceId, code);
- }
- catch (Exception ex)
- {
- CLog.Instance.SystemLog.WriteException("UI", ex);
- MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }
- }
|