Exemple #1
0
        public static void UVStartCollect()
        {
            string exePath = System.Environment.CurrentDirectory;

            System.IO.File.Copy("CurvTemplate.mdb", "Curv.mdb", true);
            conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Curv.mdb");
            conn.Open();
            string           sql = "select * from Curv";
            OleDbDataAdapter da  = new OleDbDataAdapter(sql, conn);

            uvValue_DataTable = new DataTable();
            da.Fill(uvValue_DataTable);

            uvValue_DataTable.Columns.Add("isCollectorBottle", typeof(int));
            uvValue_DataTable.Columns.Add("New", typeof(bool));
            uvValue_DataTable.RowChanged += new DataRowChangeEventHandler(Row_Changed);

            uvDataTableReadLock = true;
            CurvShow.StartCollector();

            t_UVPara.data = new double[3];
            CurvPeak.collectorButtleNo = 0;

            th_writeTable = new Thread(WriteDataTable);
            th_writeTable.Start();
            th_writeDataBase = new Thread(WriteDataBase);
            th_writeDataBase.Start();

            curvQueue = new Queue <double> [3];
        }
Exemple #2
0
 public static void UVDispose()
 {
     if (th_writeTable != null && th_writeTable.IsAlive)
     {
         th_writeTable.Abort();
     }
     if (th_writeDataBase != null && th_writeDataBase.IsAlive)
     {
         th_writeDataBase.Abort();
     }
     CurvShow.DisposeCollector();
 }
Exemple #3
0
        public static void UVStopCollect()
        {
            uvValue_DataTable.RowChanged -= new DataRowChangeEventHandler(Row_Changed);
            if (th_writeTable != null && th_writeTable.IsAlive)
            {
                th_writeTable.Abort();
            }
            if (th_writeDataBase != null && th_writeDataBase.IsAlive)
            {
                th_writeDataBase.Abort();
            }
            CurvShow.StopCollector();
            //conn.Close();
            //conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Curv.mdb");
            //conn.Open();
            //string sql = "select * from Curv";
            //OleDbDataAdapter da = new OleDbDataAdapter(sql, conn);
            //uvValue_DataTable = new DataTable();
            //da.Fill(uvValue_DataTable);
            DataRow drs = uvValue_DataTable.Rows[0];

            drs["VPS"]             = t_UVPara.vps;
            drs["xUnit"]           = CurvShow.CurvRuler.curvX_unit;
            drs["yUnit"]           = CurvShow.CurvRuler.curvY_unit;
            drs["Curv0WaveLength"] = t_UVPara.waveLength1;
            drs["Curv1WaveLength"] = t_UVPara.waveLength2;
            drs["Curv2WaveLength"] = t_UVPara.waveLength3;
            drs["UVType"]          = t_UVPara.uvWaveLengthCnt;
            //OleDbCommand OleCmd = new OleDbCommand(
            //    "insert into Curv ([VPS], [xUnit], [yUnit], [Curv0WaveLength], [Curv1WaveLength], [Curv2WaveLength]) values('" + drs["VPS"] + "','" + drs["xUnit"] + "','" + drs["yUnit"] + "','" + drs["Curv0WaveLength"] + "','" + drs["Curv1WaveLength"] + "','" + drs["Curv2WaveLength"] + "')", conn);
            OleDbCommand OleCmd = new OleDbCommand(
                "update Curv set VPS='" + t_UVPara.vps
                + "',xUnit='" + CurvShow.CurvRuler.curvX_unit
                + "',yUnit='" + CurvShow.CurvRuler.curvY_unit
                + "',Curv0WaveLength='" + t_UVPara.waveLength1.ToString()
                + "',Curv1WaveLength='" + t_UVPara.waveLength2.ToString()
                + "',Curv2WaveLength='" + t_UVPara.waveLength3.ToString()
                + "',UVType='" + drs["UVType"]
                + "' where ID=1", conn);

            OleCmd.ExecuteNonQuery();
            OleCmd = new OleDbCommand(
                "update Curv set Curv0WaveLength='" + System.Drawing.ColorTranslator.ToHtml(CurvShow.CurvRuler.curv0Color)
                + "',Curv1WaveLength='" + System.Drawing.ColorTranslator.ToHtml(CurvShow.CurvRuler.curv1Color)
                + "',Curv2WaveLength='" + System.Drawing.ColorTranslator.ToHtml(CurvShow.CurvRuler.curv2Color)
                + "' where ID=2", conn);
            OleCmd.ExecuteNonQuery();
        }
Exemple #4
0
 public static void UVPauseCollect(bool ISRun)
 {
     if (ISRun)
     {
         CurvShow.StartCollector();
         //th_writeTable = new Thread(WriteDataTable);
         //th_writeTable.Start();
         //th_writeDataBase = new Thread(WriteDataBase);
         //th_writeDataBase.Start();
     }
     else
     {
         //th_writeTable.Abort();
         //th_writeDataBase.Abort();
         CurvShow.StopCollector();
     }
 }