async void Handle_Clicked(object sender, System.EventArgs e) { var checkPasswordIsValid = new CloudData(); AuthenticationResult token = await checkPasswordIsValid.GetAccessToken(""); string UserConferencePassword = App.Current.Properties["Password"].ToString(); string PasswordFromAPI = checkPasswordIsValid.GetAccessID().Result; System.Diagnostics.Debug.WriteLine("Debug: Password must be " + PasswordFromAPI); if (PasswordFromAPI != "disable_conference_scanner_password") { if (UserConferencePassword != PasswordFromAPI) { await DisplayAlert("Alert", "The password in your profile does not match the current Conference Password. Please contact Microlise to obtain the latest one, edit your profile, then try again", "OK"); return; } } var scanPage = new FullScreenScanning(); var resultsPage = new Views.SubmitResult(); // Navigate to our scanner page //await Navigation.PushModalAsync(scanPage); if (App.IsEmuTest == false) { Application.Current.MainPage = scanPage; } else { var barCode = new Models.Item { Id = "12345678910", Text = "Please click the button below to submit your scanned code to the Microlise database" }; resultsPage.BindingContext = barCode; Application.Current.MainPage = resultsPage; } //NavigationPage.SetHasBackButton(this, false); }
public void Handle_OnScanResult(Result result) { if (HasResult == true) { return; // do nothing - stop having more than one popup open } Device.BeginInvokeOnMainThread(async() => { HasResult = true; //_scanView.IsAnalyzing = false; //_scanView.IsScanning = false; if (result.Text.Length > 200) { await DisplayAlert("Alert", "The code scanned is larger than can be stored in the database", "OK"); return; } var action = await DisplayAlert("Scanned result", result.Text, "Submit", "Keep Scanning"); if (result.Text == "http://www.homster.net") { throw new System.Exception { }; } var encodedString = HttpUtility.UrlEncode(result.Text); if (action) { var barCode = new Item { Id = encodedString, Text = "Please click the button below to submit your scanned code to the Microlise database" }; //var Submit = new SubmitResult(); //Submit.SubmitCodeToCloud(result.Text); var Submit = new Views.SubmitResult(); Submit.BindingContext = barCode; // Navigate to our scanner page //await Navigation.PushModalAsync(Submit); //NavigationPage.SetHasBackButton(this, false); Application.Current.MainPage = Submit; HasResult = false; _scanView.IsAnalyzing = false; } else { HasResult = false; if (_scanView.IsScanning == false) { _scanView.IsScanning = true; System.Diagnostics.Debug.WriteLine("Debug: user has elected to keep scanning, setting IsScanning to True"); } if (_scanView.IsAnalyzing == false) { _scanView.IsAnalyzing = true; System.Diagnostics.Debug.WriteLine("Debug: user has elected to keep scanning, setting IsAnalyzing to True"); } } }); }