Exemple #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnReadRe_Click(object sender, System.EventArgs e)
 {
     GRStation[] sts = this.GetSelectGRStations();
     if (sts.Length > 0)
     {
         foreach (GRStation st in sts)
         {
             //GRReadTwoPressChaCommand cmd = new GRReadTwoPressChaCommand( st );
             GRReadRepumpPressSettings cmd = new GRReadRepumpPressSettings(st);
             Task task = new Task(cmd, new ImmediateTaskStrategy());
             task.AfterProcessReceived += new EventHandler(task_AfterProcessReceived);
             Singles.S.TaskScheduler.Tasks.AddFirstExectueTask(task);
         }
         MessageBox.Show("命令已提交", "提示",
                         MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         MessageBox.Show("请选择站点", "提示",
                         MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Exemple #2
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 = "设置成功";
//					}
                    GRReadTwoPressChaCommand grreadtwopresscha = t.CommCmd as GRReadTwoPressChaCommand;
                    if (grreadtwopresscha != null)
                    {
                        lvi.SubItems[1].Text = grreadtwopresscha.CyclePumpCtrlMode.ToString();
                        lvi.SubItems[2].Text = grreadtwopresscha.PressChaSet.ToString();
                        lvi.SubItems[5].Text = "读取成功";
                    }

                    GRWriteTwoPressChaCommand grwritetwopresscha = t.CommCmd as GRWriteTwoPressChaCommand;
                    if (grwritetwopresscha != null)
                    {
                        lvi.SubItems[1].Text = grwritetwopresscha.CyclePumpCtrlMode.ToString();
                        lvi.SubItems[2].Text = grwritetwopresscha.PressChaSet.ToString();
                        lvi.SubItems[5].Text = "设置成功";
                    }

                    GRReadRepumpPressSettings grreadrepumppresssetting = t.CommCmd as GRReadRepumpPressSettings;
                    if (grreadrepumppresssetting != null)
                    {
                        lvi.SubItems[3].Text = grreadrepumppresssetting.Mode.ToString();
                        lvi.SubItems[4].Text = grreadrepumppresssetting.RePressSet.ToString();
                        lvi.SubItems[5].Text = "读取成功";
                    }

                    GRWriteRepumpPressSettings grwriterepumppressseting = t.CommCmd as GRWriteRepumpPressSettings;
                    if (grwriterepumppressseting != null)
                    {
                        lvi.SubItems[3].Text = grwriterepumppressseting.RepumpMode.ToString();
                        lvi.SubItems[4].Text = grwriterepumppressseting.PressSet.ToString();
                        lvi.SubItems[5].Text = "设置成功";
                    }
                }
                else
                {
                    lvi.SubItems[5].Text = GetCommResultTextDetail(t.LastCommResultState);
                }
            }
        }