Exemple #1
0
        private void QRCodeTimer_Tick(object sender, EventArgs e)
        {
            if (QRCodeBitmap == null)
            {
                return;
            }
            //把ColorFrame的wbData的資料從WriteableBitmap格式,轉成Bitmap格式,才能符合QRcode格式
            ZXing.Result result = reader.Decode(BitmapToWriteableBitmap.BitmapFromWriteableBitmap(QRCodeBitmap));

            if (result != null)
            {
                Console.WriteLine(result.Text);

                //這邊要檢查 List裡有包含單字的陣列
                if (TaskWords.Contains(result.Text))
                {
                    ReturnPostureWords returnPostureWords = new ReturnPostureWords()
                    {
                        PostureWords = result.Text
                    };
                    Success_Change_word(this, returnPostureWords);
                    Console.WriteLine("成功" + result.Text);
                    FirebaseUpload.Upload(ActivityTitle, "正確", new ORcodeObject(result.Text, txtVocabulary.Text, 1));
                }
                else
                {
                    SoundPlay.PlaySoundFailed();
                    //System.Windows.Forms.MessageBox.Show(result.Text);
                    Console.WriteLine("失敗" + result.Text);
                    FirebaseUpload.Upload(ActivityTitle, "錯誤", new ORcodeObject(result.Text, txtVocabulary.Text, 1));
                }
            }
        }
        private void QRCodeTimer_Tick(object sender, EventArgs e)
        {
            ShowScore();

            if (QRCodeBitmap == null)
            {
                return;
            }
            //把ColorFrame的wbData的資料從WriteableBitmap格式,轉成Bitmap格式,才能符合QRcode格式
            ZXing.Result result = reader.Decode(BitmapToWriteableBitmap.BitmapFromWriteableBitmap(QRCodeBitmap));

            if (result != null)
            {
                Console.WriteLine(result.Text);
                if (vocabulary.Give_Vocabulary(posture_number).ToLower().Contains(result.Text.ToLower()))
                {
                    Success_Change_word(this, new EventArgs());
                    Console.WriteLine("成功" + result.Text);
                    FirebaseUpload.Upload(ActivityTitle, "正確", new ORcodeObject(result.Text, txtVocabulary.Text, 1));
                }
                else
                {
                    SoundPlay.PlaySoundFailed();
                    Console.WriteLine("失敗" + result.Text);
                    FirebaseUpload.Upload(ActivityTitle, "錯誤", new ORcodeObject(result.Text, txtVocabulary.Text, 1));
                }
            }
        }
        private void DispatcherTimer_Tick(object sender, EventArgs e)
        {
            //把ColorFrame的wbData的資料從WriteableBitmap格式,轉成Bitmap格式,才能符合QRcode格式
            ZXing.Result result = reader.Decode(BitmapToWriteableBitmap.BitmapFromWriteableBitmap(wbData));

            if (result != null)
            {
                Console.WriteLine(result.Text);
                MessageBox.Show(result.Text);
            }

            result = null;
        }