Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ccmd"></param>
        /// <param name="ccpd"></param>
        private void Exe(CommCmdMakerDelegate ccmd, CommCmdProcessDelegate ccpd)
        {
            System.Diagnostics.Debug.Assert(ccmd != null &&
                                            ccpd != null);

            if (IsSelectedXgStation())
            {
                XGStation xgst = GetSelectedXg();
                if (IsGprsConnected(xgst))
                {
                    CommCmdBase  cmd      = ccmd(xgst);
                    TaskStrategy strategy = new ImmediateTaskStrategy();

                    Task t = new Task(cmd, strategy);
                    frmControlProcess f = new frmControlProcess(t);
                    Singles.S.TaskScheduler.Tasks.AddFirstExectueTask(t);
                    f.ShowDialog();

                    if (t.LastCommResultState == CommResultState.Correct)
                    {
                        ccpd(cmd);
                    }
                }
                else
                {
                    ShowNotConnect();
                }
            }
            else
            {
                ShowNoStationSelected();
            }
        }
Пример #2
0
        private void btnRead_Click(object sender, System.EventArgs e)
        {
            // is connected?
            GRReadGiveModeCommand cmd = new GRReadGiveModeCommand(_grst);

            Task t = new Task(cmd, new ImmediateTaskStrategy());

            Singles.S.TaskScheduler.Tasks.Add(t);
            frmControlProcess f = new frmControlProcess(t);

            f.ShowDialog();

            if (t.LastCommResultState == CommResultState.Correct)
            {
                if (cmd.GiveTempMode == GiveTempMode.TempLine)
                {
                    this.rdoGiveTempLine.Checked = true;
                }
                else
                {
                    this.rdoGiveTempValue.Checked = true;
                    this.txtGiveTempValue.Text    = cmd.GiveTempValue.ToString();
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 立即采集供热控制器实时数据
        /// </summary>
        private void CollGRRealData()
        {
            string stName = GetSelectStationName();

            if (stName == null || stName.Length == 0)
            {
                return;
            }
            GRStation grSt = Singles.S.GRStsCollection.GetGRStation(stName);

            if (grSt != null)
            {
                string remoteIP = grSt.DestinationIP;
                string serverIP = grSt.ServerIP;
                if (serverIP == XGConfig.Default.ServerIP)
                {
                    if (IsConnected(remoteIP))
                    {
                        GRRealDataCommand cmd = new GRRealDataCommand(grSt);
                        Task t = new Task(cmd, new ImmediateTaskStrategy());
                        Singles.S.TaskScheduler.Tasks.Add(t);
                        frmControlProcess f = new frmControlProcess(t);
                        f.ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show(string.Format("站点 {0} 尚未与中心建立连接", grSt.StationName));
                    }
                }
                else
                {
                    MsgBox.Show(string.Format("站点 {0} 不连接到本台服务器,不能执行操作", grSt.StationName));
                }
            }
        }
Пример #4
0
        private void CreateImmediateTaskAndExecute(CommCmdBase cmd)
        {
            Task t = new Task(cmd, new ImmediateTaskStrategy());

            Singles.S.TaskScheduler.Tasks.Add(t);
            frmControlProcess f = new frmControlProcess(t);

            f.ShowDialog();
        }
Пример #5
0
        private void btnWirte_Click(object sender, System.EventArgs e)
        {
            float k = 0, b = 0;

            if (_readids == null)
            {
                MsgBox.Show("请先读取参数!");
                return;
            }

            try
            {
                k = float.Parse(this.txtK.Text);
            }
            catch
            {
                MsgBox.Show("K值输入错误");
                return;
            }

            try
            {
                b = float.Parse(this.txtB.Text);
            }
            catch
            {
                MsgBox.Show("B值输入错误");
                return;
            }

            if (!(k >= 0.5F && k <= 1.5F))
            {
                MsgBox.Show("K值必须介于 0.5 到 1.5 之间");
                return;
            }

            if (!(b >= -10F && b <= 10F))
            {
                MsgBox.Show("B值必须介于 -10 到 10 之间");
                return;
            }

            GRWriteTEMPOP     cmd = new GRWriteTEMPOP(_st, this._readids, k, b);
            Task              t   = new Task(cmd, new ImmediateTaskStrategy());
            frmControlProcess f   = new frmControlProcess(t);

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

            DialogResult r = f.ShowDialog(this);
        }
Пример #6
0
        private void Read()
        {
            GRReadTempWLAlarmSetCommand cmd = new GRReadTempWLAlarmSetCommand(_grSt);
            Task t = new Task(cmd, new ImmediateTaskStrategy());
            frmControlProcess f = new frmControlProcess(t);

            Singles.S.TaskScheduler.Tasks.Add(t);
            DialogResult r = f.ShowDialog(this);

            if (t.LastCommResultState == CommResultState.Correct)
            {
                txtOneGiveTempLo.Text = cmd.OneGiveTempLo.ToString();
                txtTwoGiveTempHi.Text = cmd.TwoGiveTempHiSetV.ToString();
                txtWLLo.Text          = cmd.wlLoSetV.ToString();
            }
        }
Пример #7
0
        private void btnRead_Click(object sender, System.EventArgs e)
        {
//            GRReadPressAlarmSetCommand cmd = new GRReadPressAlarmSetCommand( _grSt );
            GRReadOpenDegree  cmd = new GRReadOpenDegree(_st);
            Task              t   = new Task(cmd, new ImmediateTaskStrategy());
            frmControlProcess f   = new frmControlProcess(t);

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

            DialogResult r = f.ShowDialog(this);

            if (t.LastCommResultState == CommResultState.Correct)
            {
                this.txtMin.Text = cmd.MinOpenDegree.ToString();
                this.txtMax.Text = cmd.MaxOpenDegree.ToString();
            }
        }
Пример #8
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);
            }
        }
Пример #9
0
        private void Write()
        {
            float onegtl;
            float twogth;
            float wllo;

            try
            {
                onegtl = Convert.ToSingle(txtOneGiveTempLo.Text);
            }
            catch
            {
                MsgBox.Show("一次供低温报警值错误");
                return;
            }

            try
            {
                twogth = Convert.ToSingle(txtTwoGiveTempHi.Text);
            }
            catch
            {
                MsgBox.Show("二次供高温报警值错误");
                return;
            }

            try
            {
                wllo = Convert.ToSingle(txtWLLo.Text);
            }
            catch
            {
                MsgBox.Show("水箱水位低报警值错误");
                return;
            }

            GRWriteTempWLAlarmSetCommand cmd = new GRWriteTempWLAlarmSetCommand(_grSt,
                                                                                onegtl, twogth, wllo);
            Task t = new Task(cmd, new ImmediateTaskStrategy());

            Singles.S.TaskScheduler.Tasks.Add(t);
            frmControlProcess f = new frmControlProcess(t);
            DialogResult      r = f.ShowDialog(this);
        }
Пример #10
0
        private void btnRead_Click(object sender, System.EventArgs e)
        {
            GRReadTEMPOP      cmd = new GRReadTEMPOP(_st);
            Task              t   = new Task(cmd, new ImmediateTaskStrategy());
            frmControlProcess f   = new frmControlProcess(t);

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

            DialogResult r = f.ShowDialog(this);

            if (t.LastCommResultState == CommResultState.Correct)
            {
                //this.txtMin.Text = cmd.MinOpenDegree.ToString();
                this.txtK.Text = cmd.K.ToString();
                this.txtB.Text = cmd.B.ToString();
                _readids       = cmd.Ids;
                //this.txtMax.Text = cmd.MaxOpenDegree.ToString();
            }
        }
Пример #11
0
        private void btnWirte_Click(object sender, System.EventArgs e)
        {
            byte min = 0, max = 0;

            try
            {
                min = byte.Parse(this.txtMin.Text);
            }
            catch
            {
                MsgBox.Show("最小阀门开度错误");
                return;
            }
            try
            {
                max = byte.Parse(this.txtMax.Text);
            }
            catch
            {
                MsgBox.Show("最大阀门开度错误");
                return;
            }

            if (min > 100 || max > 100)
            {
                MsgBox.Show("阀门开度不能大于100");
                return;
            }

            if (min > max)
            {
                MsgBox.Show("最小阀门开度 不能大于 最大阀门开度");
                return;
            }
            GRWriteOpenDegree cmd = new GRWriteOpenDegree(_st, min, max);
            Task t                = new Task(cmd, new ImmediateTaskStrategy());
            frmControlProcess f   = new frmControlProcess(t);

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

            DialogResult r = f.ShowDialog(this);
        }
Пример #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnWrite_Click(object sender, System.EventArgs e)
        {
//			if( ! _isReadTempLineSuccess )
//			{
//				MessageBox.Show( "请先读取曲线数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error );
//				return ;
//			}

            TemperatureLine line = new TemperatureLine();

            try
            {
                for (int i = 0; i < TemperatureLine.TemperaturePointNumber; i++)
                {
                    int ot  = Convert.ToInt32(dataGrid1[i, 1]);
                    int gt2 = Convert.ToInt32(dataGrid1[i, 2]);
                    //                line[0] = new TemperatureLinePoint(
                    line[i] = new TemperatureLinePoint(ot, gt2);
                }
            }
            catch (Exception ex)
            {
                MsgBox.Show(ex.ToString());
                return;
            }

            if (!line.Check())
            {
                MsgBox.Show("输入数据错误,室外温度、二次供温必须依次序增减");
                return;
            }

//            GRWriteTLCommand cmd = new GRWriteTLCommand( _grSt ,line, _timeTempLine );
            GRWriteOTGT2Line cmd = new GRWriteOTGT2Line(_grSt, line);
            Task             t   = new Task(cmd, new ImmediateTaskStrategy());

            Singles.S.TaskScheduler.Tasks.Add(t);
            frmControlProcess f = new frmControlProcess(t);

            f.ShowDialog();
        }
Пример #13
0
        private void Write()
        {
            float onegpl;
            float twogph;
            float twobph;
            float twobpl;

            try
            {
                onegpl = Convert.ToSingle(txtOneGivePressLo.Text);
            }
            catch
            {
                MsgBox.Show("一次供低压报警值错误");
                return;
            }

            try
            {
                twogph = Convert.ToSingle(txtTwoGivePressHi.Text);
            }
            catch
            {
                MsgBox.Show("二次供高压报警值错误");
                return;
            }
            try
            {
                twobph = Convert.ToSingle(txtTwoBackPressHi.Text);
            }
            catch
            {
                MsgBox.Show("二次回高压报警值错误");
                return;
            }

            try
            {
                twobpl = Convert.ToSingle(txtTwoBackPressLo.Text);
            }
            catch
            {
                MsgBox.Show("二次回低压报警值错误");
                return;
            }

            GRWritePressAlarmSetCommand cmd = new GRWritePressAlarmSetCommand(_grSt,
                                                                              onegpl,
                                                                              twogph,
                                                                              twobph,
                                                                              twobpl);

            Task t = new Task(cmd, new ImmediateTaskStrategy());

            Singles.S.TaskScheduler.Tasks.Add(t);
            frmControlProcess f = new frmControlProcess(t);
            DialogResult      r = f.ShowDialog(this);

            if (t.LastCommResultState == CommResultState.Correct)
            {
            }
        }