Example #1
0
// TODO ###########################################################################################################

        private async void getQuestions(DTO.QRCodeDTO aQRCDTO)
        {
            // step 1
            // Request

            /*DTO.RequestDTO rDTO = new DTO.RequestDTO();
             * rDTO.deviceID = Helper.Functions.GetDeviceID();
             * string requestDTOJSON = JsonConvert.SerializeObject(rDTO);
             * string jsonString = await Helper.Functions.sendDataToServer(aURL, requestDTOJSON);
             *
             * if (jsonString.Equals(""))
             *  mDialog("Keine Daten vom Server erhalten!");
             * // step 2
             * // questions
             * else
             * {
             *  DTO.QuestionsDTO qDTO = JsonConvert.DeserializeObject<DTO.QuestionsDTO>(jsonString);
             *  if (qDTO == null)
             *      mDialog("Falsche Daten eingelesen!");
             *  // step 3
             *  // navigate to the next page
             *  else
             *  {
             *      Helper.Functions.sendDataTOCourse obj;
             *      obj.qDTO = qDTO;
             *      obj.url = Helper.Functions.cutURLBeforEndpoint(aURL, "questions");
             *      Frame.Navigate(typeof(Course), obj);
             *  }
             *
             * }*/
        }
Example #2
0
        void AnalyzeBitmap(Bitmap bitmap, TimeSpan time)
        {
            Result result = null;

            try
            {
                result = reader.Decode(
                    bitmap.Buffers[0].Buffer.ToArray(),
                    (int)bitmap.Buffers[0].Pitch,
                    (int)bitmap.Dimensions.Height,
                    BitmapFormat.Gray8
                    );
            }
            catch
            {
                mDialog("Fehler beim Einlesen des QR-Codes");
            }

            if (result != null)
            {
                var ignore = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    DispatcherTimerOff();
                    removeEffects();

                    // show frame, progress ring and text
                    this.waitFrame.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    this.waitText.Visibility  = Windows.UI.Xaml.Visibility.Visible;
                    this.waitRing.IsActive    = true;

                    // QR-Code hat nun einen json string
                    // host + andere (uid)
                    DTO.QRCodeDTO qrcDTO = JsonConvert.DeserializeObject <DTO.QRCodeDTO>(result.Text);
                    if (qrcDTO == null)
                    {
                        mDialog("Falscher QR-Code!" + Environment.NewLine + "Weiter scannen?");
                    }
                    else
                    {
                        // check http url
                        if (Uri.IsWellFormedUriString(qrcDTO.host, UriKind.RelativeOrAbsolute))
                        {
                            getQuestions(qrcDTO);
                        }
                        else
                        {
                            mDialog("Keine gültige URL gefunden!");
                        }
                    }
                });
            }
        }