Exemplo n.º 1
0
        public async Task ProcessTransaction(string idPendingTransaction)
        {
            try
            {
                await ShowDialog();

                /*
                 * var mainViewModel = MainViewModel.GetInstace();
                 *
                 * var processQR = await ApiService.WS_ProcessQR<ProcessQR>
                 *      (idPendingTransaction, Util.GetDeviceLanguage());
                 * if (processQR != null)
                 * {
                 *  if (processQR.ErrorCode == 0)
                 *  {
                 *      Vibration.Vibrate();
                 *      await Util.ShowMessage(Languages.Alert, Languages.System_Request_Success, null);
                 *  }
                 * }
                 * else
                 * {
                 *  return;
                 * }
                 */
            }
            catch (Exception ex)
            {
                ServiceBackgroundWorker.GetInstance().SendExceptionWorker(ex.ToString());
                await Util.ShowMessage(Languages.Alert, Languages.System_Process_Error, null);
            }
            finally
            {
                await CloseDialog();
            }
        }
Exemplo n.º 2
0
 public async Task CloseDialog()
 {
     try { await PopupNavigation.Instance.RemovePageAsync(dialogLoading, true); }
     catch (Exception ex)
     {
         ServiceBackgroundWorker.GetInstance().SendExceptionWorker(ex.ToString());
     }
 }
Exemplo n.º 3
0
 private void OnTappedViewCell(object sender, System.EventArgs e)
 {
     try
     {
         if (lastCell != null)
         {
             lastCell.View.BackgroundColor = Color.Transparent;
         }
         var viewCell = (ViewCell)sender;
         if (viewCell.View != null)
         {
             viewCell.View.BackgroundColor = (Color)Application.Current.Resources["ColorType17"];
             lastCell = viewCell;
         }
     }
     catch (Exception ex)
     {
         ServiceBackgroundWorker.GetInstance().SendExceptionWorker(ex.ToString());
     }
 }
Exemplo n.º 4
0
        private async void lstItemTapped(object sender, ItemTappedEventArgs e)
        {
            try
            {
                if (isEnabled)
                {
                    isEnabled = false;
                    var myListView = (ListView)sender;
                    var myItem     = myListView.SelectedItem;

                    Movie movieSelected = (Movie)myItem;

                    MainViewModel.GetInstace().DetailMovieViewModel = new DetailMovieViewModel(movieSelected);
                    Util.ShowNavigationPageDefault(new DetailMoviePage(movieSelected));
                    isEnabled = true;
                }
            }
            catch (Exception ex)
            {
                ServiceBackgroundWorker.GetInstance().SendExceptionWorker(ex.ToString());
                isEnabled = true;
            }
        }
Exemplo n.º 5
0
        private async void LoadLectorQR()
        {
            if (isLoadLectorQR)
            {
                return;
            }

            isLoadLectorQR = true;

            await MainViewModel.GetInstace().CollectViewModel.ShowDialog();

            bool statePermission = await Permissions.GetPermissions(Permission.Camera);

            if (statePermission)
            {
                try
                {
                    await Task.Delay(1000);

                    scanner = new ZXingScannerView
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        Options           = new MobileBarcodeScanningOptions()
                        {
                            PossibleFormats = new List <ZXing.BarcodeFormat>
                            {
                                ZXing.BarcodeFormat.QR_CODE,
                            },
                            DelayBetweenContinuousScans = 2000
                        },
                    };
                    scanner.OnScanResult += (result) =>
                    {
                        scanner.IsAnalyzing = false;
                        if (scanner.IsScanning)
                        {
                            scanner.AutoFocus();
                        }

                        Device.BeginInvokeOnMainThread(async() =>
                        {
                            await MainViewModel.GetInstace().CollectViewModel.ProcessTransaction(result.Text);
                            scanner.IsAnalyzing = true;
                        });
                    };

                    MainPageContainer.Children.Add(scanner);

                    scanner.IsEnabled   = true;
                    scanner.IsAnalyzing = true;
                    scanner.IsScanning  = true;
                }
                catch (Exception ex)
                {
                    ServiceBackgroundWorker.GetInstance().SendExceptionWorker(ex.ToString());
                }
            }
            isFirstTimeOnLoad = false;
            await MainViewModel.GetInstace().CollectViewModel.CloseDialog();

            isLoadLectorQR = false;
        }