/// <summary> /// タイマーの間隔毎に呼ばれる /// </summary> private void TimerWait_Tick(object sender, EventArgs e) { // 処理中はタイマー停止させる TimerWait.Stop(); // カメラから画像を取得できれば処理 if (VideoImageView.Image != null) { // カメラ画像からQRコード認識、デコード string data = Decode(VideoImageView.Image); // デコード成功の場合 if (data != null) { // デコード結果をクラスメンバ変数へ設定 this.ReturnValue = data; // カメラの画像取得を停止 VideoCaptureStop(); // ウィンドウクローズ this.Close(); // タイマー毎の処理終了(タイマーは再開させないこと) return; } } // 処理後QR認識出来ない場合、タイマー再開 TimerWait.Start(); }
/// <summary> /// 終了処理 /// </summary> public new void Dispose() { // カメラデータの取得停止 VideoCaptureStop(); // カメラデバイスの開放 VideoSource = null; // QR読取りタイマーの停止 TimerWait.Stop(); }