private async Task getProductDetails()
        {
            if (PBAApplication.getInstance().IsPremiumUser())
            {
                VisibilityMode = Visibility.Collapsed;
                CurrentLicense = "You have already upgraded to premium service";
            }
            else
            {
                VisibilityMode = Visibility.Visible;

                CurrentLicense = "Currently you are using free version of the app";

                try
                {
                    //ListingInformation li = await CurrentAppSimulator.LoadListingInformationAsync();
                    ListingInformation li = await CurrentApp.LoadListingInformationAsync();

                    ProductListing pListing;
                    if (li.ProductListings.TryGetValue("premium_user", out pListing))
                    {
                        PremiumPrice = pListing.FormattedPrice;
                    }
                    else
                    {
                        PremiumPrice = "1.00 USD";
                    }
                }
                catch (Exception ex)
                {
                    PremiumPrice = "1.00 USD";
                }
            }
        }
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
        {
            GoogleAnalytics.EasyTracker.GetTracker().SendView("MainPage");

            if (suspensionState.Any())
            {
                _infoText = suspensionState[nameof(_infoText)]?.ToString();
            }

            PhoneBillList = PBAApplication.getInstance().PhoneBillList.ToList();

            if (PhoneBillList.Count <= 0)
            {
                InfoText = "Upload a Bill to start analyzing";
            }
            else
            {
                InfoText = "Select a bill to analyze OR upload a new one";
            }

            if (PBAApplication.getInstance().IsPremiumUser())
            {
                VisibilityMode = Visibility.Collapsed;
            }
            else
            {
                VisibilityMode = Visibility.Visible;
            }

            await Task.CompletedTask;
        }
        public async Task UpgradeToPremium()
        {
            MessageDialog messageDialog;

            try
            {
                //PurchaseResults results = await CurrentAppSimulator.RequestProductPurchaseAsync("premium_user");
                PurchaseResults results = await CurrentApp.RequestProductPurchaseAsync("premium_user");

                //Check the license state to determine if the in-app purchase was successful.
                if (PBAApplication.getInstance().IsPremiumUser())
                {
                    messageDialog  = new MessageDialog("Thank you! Please restart the app for changes to take efffect.");
                    VisibilityMode = Visibility.Collapsed;
                    CurrentLicense = "You have already upgraded to premium service";
                }
                else
                {
                    messageDialog = new MessageDialog("Some error occured during purchase. Please try again.");
                }
            }
            catch (Exception ex)
            {
                // The in-app purchase was not completed because an error occurred.
                messageDialog = new MessageDialog("Some exception occured during purchase. Please try again.");
            }

            await messageDialog.ShowAsync();
        }
        public async void SaveContactData(object sender, RoutedEventArgs e)
        {
            Views.Busy.SetBusy(true, "Saving Data.. Please Wait...");
            PBAApplication.getInstance().SaveContactData(ContactList);
            Views.Busy.SetBusy(false);

            MessageDialog messageDialog = new MessageDialog("Super.. Contact data saved.");
            await messageDialog.ShowAsync();
        }
        public void OnNavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)
        {
            Views.Busy.SetBusy(true, "Wait Madi...");
            ObservablePhoneBill pb = PBAApplication.getInstance().GetObservablePhoneBill(BillNo);

            if (pb != null)
            {
                sender.AddWebAllowedObject("phone_bill", pb);
            }
        }
Exemplo n.º 6
0
 public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
 {
     if (PBAApplication.getInstance().IsPremiumUser())
     {
         VisibilityMode = Visibility.Collapsed;
     }
     else
     {
         VisibilityMode = Visibility.Visible;
     }
     //FileName = (suspensionState.ContainsKey(nameof(FileName))) ? suspensionState[nameof(FileName)]?.ToString() : parameter?.ToString();
     FilePassword = "";
     await Task.CompletedTask;
 }
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> suspensionState)
        {
            GoogleAnalytics.EasyTracker.GetTracker().SendView("DetailPage");
            BillNo = (suspensionState.ContainsKey(nameof(BillNo))) ? suspensionState[nameof(BillNo)]?.ToString() : parameter?.ToString();

            if (PBAApplication.getInstance().IsPremiumUser())
            {
                VisibilityMode = Visibility.Collapsed;
            }
            else
            {
                VisibilityMode = Visibility.Visible;
            }

            await Task.CompletedTask;
        }
Exemplo n.º 8
0
        private void _deleteOldBills()
        {
            // See if other bills exist
            PBAApplication app = PBAApplication.getInstance();

            List <ObservablePhoneBill> pb_list = app.PhoneBillList.ToList();
            int count = pb_list.Count();

            if (count > 0)
            {
                // Issue a warning that old bills will be deleted.
                foreach (ObservablePhoneBill pbill in pb_list)
                {
                    app.DeletePhoneBill(pbill.BillNo);
                }
            }
        }
        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            // long-running startup tasks go here
            //await Task.Delay(2000);
            PBAApplication.getInstance().InitializeApplication();

            // Register backgroud task for Push Notifications
            await registerBackgroundTaskForPushNotification();

            var launchKind = DetermineStartCause(args);

            switch (launchKind)
            {
            case AdditionalKinds.SecondaryTile:
                var tileargs = args as LaunchActivatedEventArgs;
                NavigationService.Navigate(typeof(Views.MainPage), tileargs.Arguments);
                break;

            case AdditionalKinds.Toast:
                var toastargs = args as ToastNotificationActivatedEventArgs;
                if (toastargs.Argument.Equals("ShowInfoMessage"))
                {
                    //NavigationService.Navigate(typeof(Views.InfoDisplayPage));
                }
                else
                {
                    NavigationService.Navigate(typeof(Views.MainPage));
                }
                break;

            case AdditionalKinds.JumpListItem:
                //NavigationService.Navigate(typeof(Views.InfoDisplayPage));
                break;

            case AdditionalKinds.Primary:

            case AdditionalKinds.Other:
                NavigationService.Navigate(typeof(Views.MainPage));
                break;
            }

            await Task.CompletedTask;
        }
        public async void SyncContactsFromDevice(object sender, RoutedEventArgs e)
        {
            Views.Busy.SetBusy(true, "Please Wait...We are mapping phone numbers to your contacts");

            bool success = await PBAApplication.getInstance().SyncContactsFromDevice();

            ContactList.Clear();
            ContactList = PBAApplication.getInstance().GetAppContactList().ToList();

            Views.Busy.SetBusy(false);

            MessageDialog messageDialog;

            if (success)
            {
                messageDialog = new MessageDialog("Super.. Your contacts are mapped.");
            }
            else
            {
                messageDialog = new MessageDialog("Oops !! Something went wrong, we could not read map contacts.");
            }
            await messageDialog.ShowAsync();
        }
Exemplo n.º 11
0
        public async void ParseFile(object sender, RoutedEventArgs e)
        {
            MessageDialog messageDialog;

            if (_serviceProvider == null)
            {
                messageDialog = new MessageDialog("Please select a service provider from the list.");
                await messageDialog.ShowAsync();

                return;
            }

            if (_file == null)
            {
                messageDialog = new MessageDialog("Please select a file.");
                await messageDialog.ShowAsync();

                return;
            }

            PBAApplication             app     = PBAApplication.getInstance();
            List <ObservablePhoneBill> pb_list = app.PhoneBillList.ToList();
            int count = pb_list.Count();

            if (count > 0 && !app.IsPremiumUser())
            {
                messageDialog = new MessageDialog("You are using a free version of the app. Would you like to upgrade?");
                messageDialog.Commands.Add(new UICommand("OK"));
                messageDialog.Commands.Add(new UICommand("Later"));

                messageDialog.DefaultCommandIndex = 0;
                messageDialog.CancelCommandIndex  = 1;

                IUICommand command = await messageDialog.ShowAsync();

                if (command.Label.Equals("OK"))
                {
                    NavigationService.Navigate(typeof(Views.UpgradePage), "");
                    return;
                }
                else
                {
                    _deleteOldBills();
                }
            }

            PhoneBill pb = new PhoneBill(_file);

            pb.BillType     = _serviceProvider.Code;
            pb.FilePassword = FilePassword;

            Views.Busy.SetBusy(true, "Please Wait...We are reading your bill information");
            bool success = await pb.ReadPDFFile();

            Views.Busy.SetBusy(false);

            if (success)
            {
                messageDialog = new MessageDialog("Super.. We have read your bill. You can analyze it now.");

                // Add to main List
                PBAApplication.getInstance().AddBillToList(pb);
            }
            else
            {
                messageDialog = new MessageDialog("Oops !! Something went wrong, we could not understand your bill. Please try again.");
            }

            await messageDialog.ShowAsync();
        }