private void timerCalibtime_Tick(object sender, EventArgs e)
 {
     if (TestContext.m_dicConfig[tmMarcos.kDueTimeALSC1] != null &&
         TestContext.m_dicConfig[tmMarcos.kDueTimeALSC2] != null)
     {
         try
         {
             double   alsc1    = (double)TestContext.m_dicConfig[tmMarcos.kDueTimeALSC1];
             double   alsc2    = (double)TestContext.m_dicConfig[tmMarcos.kDueTimeALSC2];
             double   minvalue = System.Math.Min(alsc1, alsc2) + (7 * 24 * 60 * 60);
             DateTime dt       = DateTime.Now;
             double   nnow     = GT_Function.ConvertDateTimeInt(dt);
             double   nelapse  = minvalue - nnow;
             if (nelapse < 0)
             {
                 lbDueTime.Text = "Please Calib.the ALSC!";
             }
             else
             {
                 lbDueTime.Text = string.Format("{0:D2}H:{1:D2}M:{2:D2}S",
                                                (int)nelapse / 3600, (int)(nelapse - ((int)nelapse / 3600) * 3600) / 60, (int)nelapse % 60);
             }
         }
         catch (Exception ex)
         {
             lbDueTime.Text = "Get Calib. Time Fail!";
         }
     }
     else
     {
         lbDueTime.Text = "Get Calib. Time Fail!";
     }
 }
Exemple #2
0
        public int Write_lightCalibDate()
        {
            CheckAndConnect();
            DateTime dt     = DateTime.Now;
            int      nvalue = (int)GT_Function.ConvertDateTimeInt(dt);
            string   str    = nvalue.ToString("x");

            SetDetectString("@_@");
            WriteString("Write Pulsar Calibration Time:" + str + "\r\n");
            if (WaitForString(100) != -1)
            {
                string ret = ReadString();
                if (ret.IndexOf("Write Pulsar Calibration Time:") != -1 &&
                    ret.IndexOf("Finish") != -1)
                {
                    m_lightdata.m_dt = dt;
                }
                else
                {
                    WriteString("Write Pulsar Calibration Time:" + str + "\r\n");
                }
            }
            else
            {
                WriteString("Write Pulsar Calibration Time:" + str + "\r\n");
            }
            return(0);
        }