Exemple #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            if (jWorkSGSOP == null)
            {
                return;
            }
            jWorkSGSOP.Exec(Environment.TickCount);
            if (jWorkSGSOP.IsError)
            {
                prsl(1, jWorkSGSOP.LastError);
                jWorkSGSOP.Dispose();
                jWorkSGSOP     = null;
                cbWork.Checked = false;
                cbWork.Text    = cbWork.Checked ? "Стоп" : "Пуск";
                Stop(false);
                return;
            }
            DateTime dt = DateTime.Now;
            TimeSpan ts = dt0 - dt;

            if (ts < new TimeSpan())
            {
                cbWork.Checked = false;
                cbWork.Text    = cbWork.Checked ? "Стоп" : "Пуск";
                Stop(true);
                return;
            }
            prsl(0, Math.Round(ts.TotalSeconds).ToString() + " c, измерений: " + bank.GetCountOfUnit(Share.EUnit.SG).ToString());
            timer1.Enabled = true;
        }
Exemple #2
0
 void Stop(bool _Ok)
 {
     if (jWorkSGSOP != null)
     {
         jWorkSGSOP.Finish();
         jWorkSGSOP.Dispose();
         jWorkSGSOP = null;
     }
     if (_Ok && OnInsert != null)
     {
         OnInsert(sgWorkPars.IsGraph);
     }
     bank = null;
 }
Exemple #3
0
 private void cbWork_Click(object sender, EventArgs e)
 {
     cbWork.Text = cbWork.Checked ? "Стоп" : "Пуск";
     if (cbWork.Checked)
     {
         bank = new Bank(new cIW()
         {
             SG = true
         });
         jWorkSGSOP = new JWorkSGSOP(sgWorkPars, bank, SL);
         jWorkSGSOP.Start(Environment.TickCount);
         dt0            = DateTime.Now.AddSeconds(sgWorkPars.SOPPeriod);
         timer1.Enabled = true;
     }
     else
     {
         timer1.Enabled = false;
         Stop(true);
     }
 }