Esempio n. 1
0
 public void Begin()
 {
     for (int i = 0; i < 400; i++)
     {
         double[,] data = new double[16, 10000];
         for (int j = 0; j < 16; j++)
         {
             for (int k = 0; k < 10000; k++)
             {
                 data[j, k] = i * 10000 + k;
             }
         }
         dataWriter.AcceptNewData(data);
         Thread.Sleep(5);
     }
     dataWriter.FinishWrite();
 }
Esempio n. 2
0
        /// <summary>
        /// AI任务结束
        /// 保存时间文件及配置文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AIStopHandler(object sender, EventArgs e)
        {
            //sender其实就是ai
            IBasicAI thisAI = (IBasicAI)sender;

            System.Diagnostics.Debug.WriteLine("AIThing stop! Thread no: " + Thread.CurrentThread.ManagedThreadId.ToString() + " " + Path);

            //只有AutoWriteDataToFile == true,才写文件
            if (thisAI.StaticConfig.AutoWriteDataToFile)
            {
                //不再读数据,把数据文件写完
                dataWriter.FinishWrite();
            }

            //停止任务
            TryStop();

            //产生AITaskFinished事件
            MyHub.EventHub.Publish(Path, "AITaskFinished", "AITaskFinished");
        }