private void DownloadButton_Click(object sender, EventArgs e)
        {
            SystemTray.GetProgressIndicator(this).IsVisible = true;

            var result = MessageBox.Show("Download this book's info again?", "Download", MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                /*
                 * var ean = TextBox_EAN.Text;
                 *
                 * string newEAN = "";
                 * foreach (char c in ean)
                 * {
                 *  if (0 <= c.CompareTo('0') && c.CompareTo('9') <= 0)
                 *  {
                 *      newEAN += c;
                 *  }
                 * }
                 *
                 * TextBox_EAN.Text = newEAN;
                 */


                aws = new AmazonWebService(TextBox_EAN.Text);
                aws.GetItemInfoFromAmazonCompleted += new AmazonWebService.GetItemInfoFromAmazonCompletedEventHandler(this.aws_GetItemInfoFromAmazonCompleted);

                aws.GetItemInfo();
            }
        }
        //オートフォーカスが完了したら呼び出される
        void camera_AutoFocusCompleted(object sender, CameraOperationCompletedEventArgs e)
        {
            //アマゾンからデータを取得するインスタンスにイベントハンドラを追加
            //AmazonWebService aws = new AmazonWebService();
            //aws.Comp += new AmazonWebService.GetItemInfoFromAmazonCompletedEventHandler(this.aws_GetItemInfoFromAmazonCompleted);

            //ItemData itemData = new ItemData();

            //cameraインスタンスがnullの場合は即return。そうしないと下の「プレビューフレームの取得」でnullreferenceexceptionが出てしまう。readTimerとのタイミングの問題か?
            if (camera == null)
            {
                return;
            }

            // コントロールへのアクセスを行うのでUIスレッドにて非同期で実行。UIへのアクセスは別のスレッドからはできないため。
            Dispatcher.BeginInvoke(() =>
            {
                // プレビューフレームの取得
                var luminanceSource = new PreviewFrameLuminanceSource((int)camera.PreviewResolution.Width, (int)camera.PreviewResolution.Height);

                camera.GetPreviewBufferY(luminanceSource.Buffer);

                // リーダーインスタンス生成
                var reader = new EAN13Reader();

                // バーコード解析用のBitmapを作成
                var binarizer = new HybridBinarizer(luminanceSource);
                var binBitmap = new BinaryBitmap(binarizer);


                Result result = null;
                try
                {
                    // バーコードの解析(デコード)を行う。
                    //resultにEANが入る。

                    result = reader.decode(binBitmap);
                }
                catch (ReaderException)
                {
                    // プレビューフレーム内にバーコードが見つからなかった場合
                    // 読み取り例外のReaderExceptionが発行されてしまう
                    TextBlock_Result.Text = "Can not read barcode.";
                    return;
                }
                catch (Exception ex)
                {
                    throw ex;
                }


                //読み取ったEANがデータベースに登録済みかチェック
                if (BookView.Exist(result.Text) != null)
                {
                    //登録済みの場合
                    TextBlock_Result.Text = result.Text + " is exists";
                }
                else
                {
                    //未登録の場合。Amazonへリクエスト
                    TargetEAN = result.Text;

                    aws = new AmazonWebService(result.Text);
                    //アマゾンからデータを取得するインスタンスにイベントハンドラを追加
                    aws.GetItemInfoFromAmazonCompleted += new AmazonWebService.GetItemInfoFromAmazonCompletedEventHandler(this.aws_GetItemInfoFromAmazonCompleted);
                    aws.GetItemInfo();
                }
            });

            //イベントを削除
            camera.AutoFocusCompleted -= camera_AutoFocusCompleted;
        }