示例#1
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();
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, System.EventArgs e)
        {
            int ot, twogp;

            try
            {
                ot = Convert.ToInt32(txtOutsideTemp.Text);
            }
            catch
            {
                MsgBox.Show("室外温度输入错误");
                return;
            }
            try
            {
                twogp = Convert.ToInt32(txtTwoGiveTemp.Text);
            }
            catch
            {
                MsgBox.Show("二次供温输入错误");
                return;
            }

//            if (!( ot >= -50 && ot <= 10 ))
            if (!TemperatureLinePoint.IsValidOutsideTemperature(ot))
            {
                string s = string.Format("室外温度必须介于 {0} 到 {1} 之间",
                                         TemperatureLinePoint.MIN_OUTSIDE_TEMPERATURE,
                                         TemperatureLinePoint.MAX_OUTSIDE_TEMPERATURE);
                MsgBox.Show(s);
                return;
            }

//            if (!( twogp >= 40 && twogp <= 90 ) )
            if (!TemperatureLinePoint.IsValidTwoGiveTemperature(twogp))
            {
                string s = string.Format("二次供温必须介于 {0} 到 {1} 之间",
                                         TemperatureLinePoint.MIN_TWOGIVE_TEMPERATURE,
                                         TemperatureLinePoint.MAX_TWOGIVE_TEMPERATURE);
                MsgBox.Show(s);
                return;
            }

            int row = dataGrid1.CurrentRowIndex;

            if (row == -1)
            {
                return;
            }

            int otP, otN, twogpP, twogpN;

            getNear(row, out otP, out otN, out twogpP, out twogpN);

            if (otP != INV && ot < otP)
            {
                m();
                return;
            }

            if (otN != INV && ot > otN)
            {
                m();
                return;
            }

            if (twogpP != INV && twogp > twogpP)
            {
                m();
                return;
            }

            if (twogpN != INV && twogp < twogpN)
            {
                m();
                return;
            }


            dataGrid1 [row, 1] = ot;
            dataGrid1 [row, 2] = twogp;
            refreshGP();
        }