Пример #1
0
 /// <summary>
 /// 非同期に細胞応答の描画を実行
 /// </summary>
 private async void AsyncRefresh2()
 {
     await Task.Run(() =>
     {
         CellResponse0 = new CellResponse(0);
         CellResponse1 = new CellResponse(1);
         CellResponse2 = new CellResponse(2);
         CellResponse3 = new CellResponse(3);
         CellResponse4 = new CellResponse(4);
         CellResponse5 = new CellResponse(5);
         CellResponse6 = new CellResponse(6);
         CellResponse0.Show();
         CellResponse1.Show();
         CellResponse2.Show();
         CellResponse3.Show();
         CellResponse4.Show();
         CellResponse5.Show();
         CellResponse6.Show();
         while (true)
         {
             if (ReturnFlag)
             {
                 CellResponse0.Close();
                 CellResponse1.Close();
                 CellResponse2.Close();
                 CellResponse3.Close();
                 return;
             }
             else if (DrawFlag_Cell)
             {
                 CellResponse0.DrawRefresh(NDS_NL_BMP[0], NDS_L_BMP[0], DSC_BMP[0], MDC_BMP[0]);
                 CellResponse1.DrawRefresh(NDS_NL_BMP[1], NDS_L_BMP[1], DSC_BMP[1], MDC_BMP[1]);
                 CellResponse2.DrawRefresh(NDS_NL_BMP[2], NDS_L_BMP[2], DSC_BMP[2], MDC_BMP[2]);
                 CellResponse3.DrawRefresh(NDS_NL_BMP[3], NDS_L_BMP[3], DSC_BMP[3], MDC_BMP[3]);
                 CellResponse4.DrawRefresh(NDS_NL_BMP[4], NDS_L_BMP[4], DSC_BMP[4], MDC_BMP[4]);
                 CellResponse5.DrawRefresh(NDS_NL_BMP[5], NDS_L_BMP[5], DSC_BMP[5], MDC_BMP[5]);
                 CellResponse6.DrawRefresh(NDS_NL_BMP[6], NDS_L_BMP[6], DSC_BMP[6], MDC_BMP[6]);
                 DrawFlag_Cell = false;
             }
         }
     });
 }
Пример #2
0
        /// <summary>
        /// Receive Cell Response ボタンのイベントハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonReceiveCell_Click(object sender, EventArgs e)
        {
            CellResponse0 = new CellResponse(0);
            CellResponse0.Show();
            //接続状況のチェック
            if (!tcp.Connected)
            {
                MessageBox.Show("サーバーと未接続です");
                return;
            }
            //FPGAへトリガー送信
            sendData.Add(0x05);
            ns.Write(sendData.ToArray(), 0, sendData.Count);
            sendData.Clear();
            //計測開始
            sw.Start();
            //データ受信
            byte[] NDS_NL_temp = Receive_NDS(39, 23, Num_RF);
            byte[] NDS_L_temp  = Receive_NDS(39, 23, Num_RF);
            byte[] DSC_temp    = Receive_DSC(31, 23, Num_RF);
            byte[] MDC_temp    = Receive_MDC(31, 31, Num_RF);

            //配列を結合
            List <int> NDS_NL = CellResponse0.Bind(NDS_NL_temp, 2);
            List <int> NDS_L  = CellResponse0.Bind(NDS_L_temp, 2);
            List <int> DSC    = CellResponse0.Bind(DSC_temp, 3);
            List <int> MDC    = CellResponse0.Bind(MDC_temp, 4);
            //ビットマップ変換
            List <Image> NDS_NL_BMP = CellResponse0.Convert_BMP_NDS_ALL(NDS_NL, 897, Num_RF);
            List <Image> NDS_L_BMP  = CellResponse0.Convert_BMP_NDS_ALL(NDS_L, 897, Num_RF);
            List <Image> DSC_BMP    = CellResponse0.Convert_BMP_DSC_ALL(DSC, 713, Num_RF);
            List <Image> MDC_BMP    = CellResponse0.Convert_BMP_MDC_ALL(MDC, 961, Num_RF);

            //描画処理
            CellResponse0.DrawRefresh(NDS_NL_BMP[0], NDS_L_BMP[0], DSC_BMP[0], MDC_BMP[0]);
            //計測終了
            sw.Stop();
            textBox_FrameRate.Text = (sw.ElapsedMilliseconds).ToString();
            sw.Reset();
        }