Esempio n. 1
0
 /// <summary>
 /// Delete the seekios
 /// </summary>
 private async void DeleteButton_TouchUpInside(object sender, EventArgs e)
 {
     if (await AlertControllerHelper.ShowAlert(Application.LocalizedString("Delete")
                                               , Application.LocalizedString("SureToDeleteSeekios")
                                               , Application.LocalizedString("Yes")
                                               , Application.LocalizedString("No")) == 0)
     {
         // display the loading layout
         var alertLoading = AlertControllerHelper.ShowAlertLoading();
         PresentViewController(alertLoading, true, async() =>
         {
             if (await App.Locator.DetailSeekios.DeleteSeekios() == 1)
             {
                 DismissViewController(false, () =>
                 {
                     App.Locator.AddSeekios.IsGoingBack = true;
                     App.Locator.AddSeekios.IsAdding    = true;
                     GoBack(true);
                 });
             }
             else
             {
                 DismissViewController(false, null);
             }
         });
     }
 }
Esempio n. 2
0
        private async void InitializeInAppPurchases()
        {
            PurchaseManager = new InAppPurchaseManager();
            // assembly public key
            string value = Xamarin.InAppPurchase.Utilities.Security.Unify(
                new string[] { "1322f985c2", "a34166b24", "ab2b367", "851cc6" },
                new int[] { 0, 1, 2, 3 });

            PurchaseManager.PublicKey           = value;
            PurchaseManager.ApplicationUserName = "******";

            // be sure the user can make payment
            if (!PurchaseManager.CanMakePayments)
            {
                // the user is not able to make payment
                await AlertControllerHelper.ShowAlert(Application.LocalizedString("PaymentFailure")
                                                      , Application.LocalizedString("CantPurchase")
                                                      , Application.LocalizedString("Close"));
            }

            // be sure the user has access to internet
            PurchaseManager.NoInternetConnectionAvailable += async() =>
            {
                // the user is has not internet
                await AlertControllerHelper.ShowAlert(Application.LocalizedString("PaymentFailure")
                                                      , Application.LocalizedString("NoInternet")
                                                      , Application.LocalizedString("Close"));
            };

            // display any invalid product IDs
            PurchaseManager.ReceivedInvalidProducts += (productIDs) =>
            {
                Console.WriteLine("The following IDs were rejected by the iTunes App Store:");
                foreach (string ID in productIDs)
                {
                    Console.WriteLine(ID);
                }
            };

            // setup automatic purchase persistance and load any previous purchases
            PurchaseManager.AutomaticPersistenceType     = InAppPurchasePersistenceType.LocalFile;
            PurchaseManager.PersistenceFilename          = "AtomicData";
            PurchaseManager.ShuffleProductsOnPersistence = false;
            PurchaseManager.RestoreProducts();
            PurchaseManager.QueryInventory(new string[]
            {
                "com.thingsoftomorrow.seekios.observation",
                "com.thingsoftomorrow.seekios.discovery",
                "com.thingsoftomorrow.seekios.exploration",
                "com.thingsoftomorrow.seekios.aventure",
                "com.thingsoftomorrow.seekios.epopee"
            });
        }
 private void DisplayLastAlertSOS()
 {
     if (App.Locator.DetailSeekios.AlertNeedsToBeRead())
     {
         var popup = AlertControllerHelper.CreateAlertToInformAlertSOS(async() =>
         {
             if (await App.Locator.DetailSeekios.NotifyAlertSOSHasBeenRead(_seekiosSelected.Idseekios) <= 0)
             {
                 await AlertControllerHelper.ShowAlert(string.Empty
                                                       , Application.LocalizedString("AlertCannotBeSavedAsRead")
                                                       , Application.LocalizedString("Close"));
             }
             else
             {
                 _seekiosSelected = App.CurrentUserEnvironment.LsSeekios.FirstOrDefault(f => f.UIdSeekios == App.Locator.DetailSeekios.SeekiosSelected.UIdSeekios);
                 SetDataAndStyleToView();
                 UpdateBatteryView();
             }
         });
         PresentViewController(popup, true, () => { popup.Dispose(); });
     }
 }
Esempio n. 4
0
        private async void BuyProducts(int index)
        {
            if (ListInAppProducts.Count <= 0 || index == -1)
            {
                return;
            }
            if (!App.DeviceIsConnectedToInternet)
            {
                await AlertControllerHelper.ShowAlert(Application.LocalizedString("PaymentFailure")
                                                      , Application.LocalizedString("NoInternet")
                                                      , Application.LocalizedString("Close"));

                return;
            }

            var alert = new UIAlertView(Application.LocalizedString("BuyPack")
                                        , string.Format(Application.LocalizedString("SureToBuy")
                                                        , GetProductTitle(ListInAppProducts[index].ProductIdentifier)
                                                        , ListInAppProducts[index].FormattedPrice)
                                        , null
                                        , Application.LocalizedString("Cancel")
                                        , Application.LocalizedString("Buy"));

            // wireup events
            alert.CancelButtonIndex = 0;
            alert.Clicked          += (caller, buttonArgs) =>
            {
                // does the user want to purchase?
                if (buttonArgs.ButtonIndex == 1)
                {
                    // yes, request purchase item
                    _purchaseManager.BuyProduct(ListInAppProducts[index]);
                }
            };

            // display dialog
            alert.Show();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // button click seekios tutorial
            SeekiosTutorialButton.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
                App.Locator.LeftMenu.GoToListTutorial();
            }));

            // button click my consomation
            HistoriqueConsommationButton.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
                App.Locator.Credits.GoToCreditHistoric();
            }));

            // button click on add a seekios
            AddSeekiosButton.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
                App.Locator.LeftMenu.GoToAddSeekios();
            }));

            // button click on map all seekios
            MapButton.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                if (App.CurrentUserEnvironment.LsSeekios.Count == 0)
                {
                    AlertControllerHelper.ShowAlert(Application.LocalizedString("ZeroSeekios")
                                                    , Application.LocalizedString("NeedAtLeastOneSeekios")
                                                    , Application.LocalizedString("Close"));
                }
                else
                {
                    if (App.CurrentUserEnvironment.LsSeekios.All(a => a.LastKnownLocation_latitude == App.DefaultLatitude &&
                                                                 a.LastKnownLocation_longitude == App.DefaultLongitude))
                    {
                        if (App.CurrentUserEnvironment.LsSeekios.Count == 1)
                        {
                            AlertControllerHelper.ShowAlert(Application.LocalizedString("NoPosition")
                                                            , Application.LocalizedString("OneSeekiosNewlyAdded")
                                                            , Application.LocalizedString("Close"));
                        }
                        else
                        {
                            AlertControllerHelper.ShowAlert(Application.LocalizedString("NoPosition")
                                                            , Application.LocalizedString("PluralSeekiosNewlyAdded")
                                                            , Application.LocalizedString("Close"));
                        }
                    }
                    else
                    {
                        NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
                        App.Locator.LeftMenu.GoToSeekiosMapAllSeekios();
                    }
                }
            }));

            // button click on feedback
            FeedbackButton.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                var feedbackManager = BITHockeyManager.SharedHockeyManager.FeedbackManager;
                feedbackManager.ShowFeedbackListView();
                feedbackManager.ShowFeedbackComposeView();
                NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
            }));

            // button click on Parameter
            UserImageView.UserInteractionEnabled = true;
            UserImageView.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
                App.Locator.LeftMenu.GoToParameter();
            }));
            EmailUser.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
                App.Locator.LeftMenu.GoToParameter();
            }));
            NameUser.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
                App.Locator.LeftMenu.GoToParameter();
            }));
            SettingsImageView.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
                App.Locator.LeftMenu.GoToParameter();
            }));
            CreditsTitleLabel.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
                App.Locator.LeftMenu.GoToParameter();
            }));
            CreditsLabel.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                NavigationService.LeftMenuView.RevealViewController().RightRevealToggleAnimated(true);
                App.Locator.LeftMenu.GoToParameter();
            }));
        }