Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void task_AfterProcessReceived(object sender, EventArgs e)
        {
            Task      t    = sender as Task;
            GRStation grst = t.CommCmd.Station as GRStation;

            if (grst != null)
            {
                ListViewItem lvi = GetLviByGRStation(grst);

                if (t.LastCommResultState == CommResultState.Correct)
                {
                    GRReadTLCommand grreadtlcmd = t.CommCmd as GRReadTLCommand;
                    if (grreadtlcmd != null)
                    {
                        lvi.SubItems[1].Text = grreadtlcmd.TimeTempLine.ToString();
                        lvi.SubItems[2].Text = "读取成功";
                    }

                    GRWriteTimeTempLine grwritetimetemplinecmd = t.CommCmd as GRWriteTimeTempLine;
                    if (grwritetimetemplinecmd != null)
                    {
                        lvi.SubItems[1].Text = grwritetimetemplinecmd.TimeTempLine.ToString();
                        lvi.SubItems[2].Text = "设置成功";
                    }
                }
                else
                {
                    lvi.SubItems[1].Text = "";
                    lvi.SubItems[2].Text = GetCommResultTextDetail(t.LastCommResultState);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRead_Click(object sender, System.EventArgs e)
        {
            ArrayList list = new ArrayList();

            foreach (ListViewItem lvi in this.lvXg.Items)
            {
                if (lvi.Checked)
                {
                    list.Add(lvi.Tag as GRStation);
                }
            }

            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    GRStation       grst = list[i] as GRStation;
                    GRReadTLCommand cmd  = new GRReadTLCommand(grst);
                    Task            task = new Task(cmd, new ImmediateTaskStrategy());

                    Singles.S.TaskScheduler.Tasks.AddFirstExectueTask(task);
                    task.AfterProcessReceived += new EventHandler(task_AfterProcessReceived);
                }
                MessageBox.Show("命令已提交", "提示",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("请先选择站点", "提示",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 3
0
        private void ReadTL(string remoteIP, int address)
        {
            GRStation st = GetGRStation(remoteIP, address);

            if (st != null)
            {
                GRReadTLCommand c = new GRReadTLCommand(st);
                this.CreateImmediateTaskAndExecute(c);
            }
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRead_Click(object sender, System.EventArgs e)
        {
            GRReadTLCommand cmd = new GRReadTLCommand(_grSt);
            Task            t   = new Task(cmd, new ImmediateTaskStrategy());

            Singles.S.TaskScheduler.Tasks.Add(t);

            frmControlProcess f = new frmControlProcess(t);

            f.ShowDialog(this);
            if (t.LastCommResultState == CommResultState.Correct)
            {
                this._isReadTempLineSuccess = true;
                this._timeTempLine          = cmd.TimeTempLine;
                ShowTL(cmd.TemperatureLine);
            }
        }