Beispiel #1
0
        private void SettingForm_Load(object sender, EventArgs e)
        {
            try
            {
                this.CenterToScreen();
                // load net setting
                loadConfig();
                // load alarm setting
                // load im
                IMList = LEDConfig.loadIMList();
                // init data grid view
                initDataGrid();
                toolStripStatusLabel.Text = "設定載入完成";
            }
            catch (Exception ex)
            {
                toolStripStatusLabel.Text = "設定載入失敗:" + ex.Message;
            }

            // initialization
            dataGridView_IM.ClearSelection();
            label_help.Text = "";

            // add event handler
            dataGridView_IM.SelectionChanged += new EventHandler(dataGridView_IM_SelectionChanged);

            this.EdaWorker = new EdaWorker(presentIM);
        }
Beispiel #2
0
 //dataGridView handler
 private void dataGridView_IM_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
 {
     // remove corresponding item in the list
     IMList.RemoveAt(e.RowIndex);
     // save the modification
     LEDConfig.saveIMList(IMList);
 }
Beispiel #3
0
 private void loadConfig()
 {
     // load config from ini file
     LEDConfig.loadConfig();
     // fill config to textBoxes
     textBox_IP.Text      = LEDConfig.IpAddr;
     textBox_port.Text    = LEDConfig.port.ToString();
     textBox_idcode.Text  = LEDConfig.IDCode;
     textBox_timeout.Text = LEDConfig.timeout.ToString();
     // init CP5200 connection
     LEDConnection.InitComm();
 }
Beispiel #4
0
        private void inputButton_Click(object sender, EventArgs e)
        {
            try
            {
                // message input method, including add and modify.
                inputIM();
                // save modification made
                LEDConfig.saveIMList(IMList);
            }
            catch (FormatException ex)
            {
                MessageBox.Show(ex.Message);
            }

            // clear dataGridView selection
            dataGridView_IM.ClearSelection();
            // reset input button to "Add" since all selection are cleared
            inputButton.Text = "Add";
        }