Beispiel #1
0
        async void BindData()
        {
            try
            {
                if (!CommonLib.checkconnection())
                {
                    RacoonAlertPopup.textmsg = "Check your internet connection.";

                    await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());

                    return;
                }


                await App.Current.MainPage.Navigation.PushPopupAsync(new LoadPopup());



                firstName = FirstName.Text;

                lastName = LastName.Text;

                userName = UserName.Text;
                emailID  = Email.Text;

                password = Password.Text;

                string postData = "firstname=" + firstName + "&lastname=" + lastName + "&username="******"&email=" + emailID + "&password="******"&CID=1" + "";



                var result = await CommonLib.RegisterUser(CommonLib.ws_MainUrl + "AccountApi/Registration?" + postData);

                if (result != null && result.Status != 0)
                {
                    LoadPopup.CloseAllPopup();

                    RacoonAlertPopup.textmsg = result.msg;

                    await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());

                    await Navigation.PushAsync(new LoginPage());
                }

                else
                {
                    LoadPopup.CloseAllPopup();
                    RacoonAlertPopup.textmsg = result.msg;
                    await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());
                }
            }
            catch (Exception ex)
            {
                LoadPopup.CloseAllPopup();
                await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");
            }
            finally
            {
            }
        }
        async void BindData()
        {
            try
            {
                if (!CommonLib.checkconnection())
                {
                    RacoonAlertPopup.textmsg = "Check your internet connection.";

                    await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());

                    return;
                }


                await App.Current.MainPage.Navigation.PushPopupAsync(new LoadPopup());



                emailID = Email.Text;


                string postData = "&email=" + emailID + "";



                var result = await CommonLib.ForgotPassword(CommonLib.ws_MainUrl + "AccountApi/ForgotPassword?" + postData, "");

                if (result != null && result.Status != 0)
                {
                    LoadPopup.CloseAllPopup();

                    RacoonAlertPopup.textmsg = result.msg;

                    await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());

                    await Navigation.PushAsync(new LoginPage());
                }

                else
                {
                    LoadPopup.CloseAllPopup();
                    RacoonAlertPopup.textmsg = result.msg;
                    await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());
                }
            }
            catch (Exception ex)
            {
                LoadPopup.CloseAllPopup();
                await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");
            }
            finally
            {
            }
        }
Beispiel #3
0
        void AddPageContent()
        {
            this.Title = "Scan Barcode";

            zxing = new ZXingScannerView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };


            zxing.OnScanResult += (result) =>

                                  //Device.BeginInvokeOnMainThread(async () => {

                                  //    // Stop analysis until we navigate away so we don't keep reading barcodes
                                  //    zxing.IsAnalyzing = false;

                                  //    // Show an alert
                                  //    await DisplayAlert("Scanned Barcode", result.Text, "OK");

                                  //    // Navigate away
                                  //    await Navigation.PopAsync();
                                  //});

                                  Device.BeginInvokeOnMainThread(async() =>
            {
                // Stop analysis until we navigate away so we don't keep reading barcodes
                zxing.IsAnalyzing = false;


                //Binding data

                try
                {
                    if (!CommonLib.checkconnection())
                    {
                        RacoonAlertPopup.textmsg = "Check your internet connection.";

                        await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());
                        return;
                    }


                    await App.Current.MainPage.Navigation.PushPopupAsync(new LoadPopup());



                    string postData = "barcode=" + result + "&userId=" + LoginDetails.userId + "";

                    var response = await CommonLib.BarcodeScanner(CommonLib.ws_MainUrl + "AccountApi/ScanBarcode?" + postData, "");

                    if (response != null && response.Status != 0)
                    {
                        LoadPopup.CloseAllPopup();

                        RacoonAlertPopup.textmsg = response.msg;

                        await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());
                        await Navigation.PopAsync();
                    }

                    else
                    {
                        LoadPopup.CloseAllPopup();
                        RacoonAlertPopup.textmsg = response.msg;
                        await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());
                        await Navigation.PopAsync();
                    }
                }
                catch (Exception ex)
                {
                    LoadPopup.CloseAllPopup();
                    await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");
                }
                finally
                {
                }

                // Show an alert


                // Navigate away
            });


            overlay = new ZXingDefaultOverlay
            {
                TopText         = "Hold your phone up to the barcode",
                BottomText      = "Scanning will happen automatically",
                ShowFlashButton = zxing.HasTorch,
            };


            overlay.FlashButtonClicked += (sender, e) => {
                zxing.IsTorchOn = !zxing.IsTorchOn;
            };


            var grid = new Grid
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };


            grid.Children.Add(zxing);
            grid.Children.Add(overlay);

            // The root page of your application
            Content = grid;
        }