// private bool IsNameConnected /// <summary> /// /// </summary> /// <returns></returns> private GRStation GetGRStation() { if (this.lvGprsStation.SelectedItems.Count > 0) { ListViewItem lvi = lvGprsStation.SelectedItems[0]; string stName = lvi.Text; GRStation st = Singles.S.GRStsCollection.GetGRStation(stName); return(st); // return stName; } return(null); }
/// <summary> /// /// </summary> /// <param name="remoteIP"></param> /// <param name="address"></param> private void GRCollRealData(string remoteIP, int address) { GRStation st = GetGRStation(remoteIP, address); if (st != null) { GRRealDataCommand cmd = new GRRealDataCommand(st); // Task t = new Task( cmd, new ImmediateTaskStrategy () ); //// t.BeforeExecuteTask += new EventHandler(t_BeforeExecuteTask); //// t.AfterExecuteTask += new EventHandler(t_AfterExecuteTask); // Singles.S.TaskScheduler.Tasks.Add( t ); // // frmControlProcess f = new frmControlProcess( t ); // f.ShowDialog(); this.CreateImmediateTaskAndExecute(cmd); } }
/// <summary> /// stop recruit pump operation /// </summary> private void StopRePump(bool isStop) { GRStation st = GetGRStation(); if (st != null && IsConnected(st.DestinationIP)) { // bool isStop = chkStop.Checked; GRRePumpOpCmd c = new GRRePumpOpCmd(st, isStop ? PumpOP.Stop : PumpOP.Start); string op = string.Format("{0}补水泵", isStop ? "停止" : "启动"); XGDB.InsertCtrlLog(DateTime.Now, st.StationName, op, "xd"); CreateImmediateTaskAndExecute(c); } else { ShowNotConnectedMsg(); } }
/// <summary> /// press alarm set /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPressAlarmSet_Click(object sender, System.EventArgs e) { if (!IsSelect()) { ShowNotSelectMsg(); return; } string ip = GetRemoteIP(); GRStation st = this.GetGRStation(ip, DEFAILT_ADDRESS); if (st != null && IsConnected(ip)) { frmPressAlarmSet f = new frmPressAlarmSet(st); f.ShowDialog(); } else { ShowNotConnectedMsg(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnGiveTempMode_Click(object sender, System.EventArgs e) { if (!IsSelect()) { ShowNotSelectMsg(); return; } string remoteIP = GetRemoteIP(); if (remoteIP != string.Empty) { if (IsConnected(remoteIP)) { GRStation grst = GetGRStation(remoteIP, DEFAILT_ADDRESS); frmGiveTempMode f = new frmGiveTempMode(grst); f.ShowDialog(); } else { ShowNotConnectedMsg(); return; } } }