private void LogOutButton_TouchUpInside(object sender, EventArgs e) { LogOutButton.Enabled = false; var alertLoading = AlertControllerHelper.ShowAlertLoading(); PresentViewController(alertLoading, true, async() => { if (App.CurrentUserEnvironment.Device != null) { if (await App.Locator.Login.Disconnect(App.CurrentUserEnvironment.Device.UidDevice) == 1) { var oneSignal = (ServiceLocator.Current.GetInstance <IOneSignal>()); oneSignal.DeleteTag(App.CurrentUserEnvironment.User.IdUser.ToString() + (DataService.UseStaging ? "s" : "p")); oneSignal.SetSubscription(false); DismissViewController(false, () => { UIApplication.SharedApplication.KeyWindow.RootViewController = UIStoryboard.FromName("Main", null).InstantiateViewController("LoginView"); }); } } else { DismissViewController(false, null); } }); }
private void NextButton_TouchUpInside(object sender, EventArgs e) { var zone = _mapControlManager.PointsOfZone.Select(el => new LatitudeLongitude(el.Coordinate.Latitude, el.Coordinate.Longitude)).ToList(); var listOfPoints = new List <LatitudeLongitude>(); var time = (DateTime.UtcNow - App.Locator.DetailSeekios.SeekiosSelected.DateLastCommunication).Value.TotalHours; //If last position known > 1 hour ago if (time > 1) { var popup = AlertControllerHelper.CreateAlertToInformSeekiosPositionMoreThan1Hour(() => { if (_mapControlManager.PointsOfZone != null) { App.Locator.ModeZone.GoToSecondPage(zone); } else { App.Locator.ModeZone.GoToSecondPage(null); } }); PresentViewController(popup, true, null); } //else we verify if the last position known is in the zone or not else { //verify zone validity if (_mapControlManager.PointsOfZone == null) { App.Locator.ModeZone.GoToSecondPage(null); } App.Locator.ModeZone.GoToSecondPage(zone); } }
/// <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); } }); } }
/// <summary> /// Display the popup to choose between camera and librairy /// </summary> private void ModifySeekiosImageButton_TouchDown(object sender, EventArgs e) { var alert = AlertControllerHelper.CreateActionSheetToPickPictureSeekios(() => { _isSelectedImage = true; if (UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.Camera)) { CameraHelper.TakePicture(this, PictureSelected); } else { CameraHelper.SelectPicture(this, PictureSelected); } } , () => { _isSelectedImage = true; CameraHelper.SelectPicture(this, PictureSelected); } , () => { if (App.Locator.AddSeekios.UpdatingSeekios != null && !string.IsNullOrEmpty(App.Locator.AddSeekios.UpdatingSeekios.SeekiosPicture)) { _isSelectedImage = true; SeekiosImageView.Image = UIImage.FromBundle("DefaultSeekios"); App.Locator.AddSeekios.SeekiosImage = null; SaveButton.Enabled = true; } }); PresentViewController(alert, true, null); }
private void ModifyUserImageButton_TouchUpInside(object sender, EventArgs e) { var alert = AlertControllerHelper.CreateActionSheetToPickPictureUser(() => { if (UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.Camera)) { CameraHelper.TakePicture(this, PictureSelected); } else { CameraHelper.SelectPicture(this, PictureSelected); } } , () => { CameraHelper.SelectPicture(this, PictureSelected); } , () => { if (!string.IsNullOrEmpty(App.CurrentUserEnvironment.User.UserPicture)) { UserImageView.Image = UIImage.FromBundle("DefaultUser"); App.Locator.Parameter.UserPicture = new byte[0]; SaveButton.Enabled = true; _hasDataChanged = true; } }); PresentViewController(alert, true, null); }
/// <summary> /// Create an account /// </summary> private void RegistrationButton_TouchUpInside(object sender, EventArgs e) { if (VerificationFieldCreateAccount()) { var alert = AlertControllerHelper.CreatePopupCGU(async() => { RegistrationButton.Enabled = false; if (await App.Locator.Login.CreateAccount(FirstNameTextField.Text , LastNameTextField.Text , DeviceInfoHelper.DeviceModel , DeviceInfoHelper.Platform , DeviceInfoHelper.Version , DeviceInfoHelper.GetDeviceUniqueId , DeviceInfoHelper.CountryCode)) { RegistrationButton.Enabled = true; BackButton_TouchUpInside(null, null); } else { BackButton_TouchUpInside(null, null); } }, () => { UIApplication.SharedApplication.OpenUrl(new NSUrl("https://seekios.com/Home/CGU")); }); PresentViewController(alert, true, null); } }
public void ShowLoadingLayout() { if (CurrentViewController == null) { throw new Exception("CurrentViewController can not be null in DialogService"); } CurrentViewController.PresentViewController(AlertControllerHelper.ShowAlertLoading(), true, null); }
private void NeedUpdateButton_TouchDown(object sender, EventArgs e) { var popup = AlertControllerHelper.CreatePopupSeekiosNeedUpdate(() => { UIApplication.SharedApplication.OpenUrl(new NSUrl("https://seekios.com/Home/UserManual")); }); PresentViewController(popup, true, null); }
/// <summary> /// Display a popup with information about the seekios update /// </summary> private void NeedUpdateButton_TouchDown(object sender, EventArgs e) { var popup = AlertControllerHelper.CreatePopupSeekiosNeedUpdate(() => { UIApplication.SharedApplication.OpenUrl(new NSUrl(App.TutorialHelpLink)); }); PresentViewController(popup, true, null); }
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" }); }
/// <summary> /// Event to save the alert /// </summary> private async void SaveButton_TouchUpInside(object sender, EventArgs e) { var isFieldsValid = true; // verification title alert if (string.IsNullOrEmpty(AlertTitleTextField.Text)) { AlertTitleTextField.Layer.BorderColor = UIColor.FromRGB(255, 76, 57).CGColor; isFieldsValid = false; } else { AlertTitleTextField.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; } // verification message alert if (string.IsNullOrEmpty(AlertMessageTextField.Text)) { AlertMessageTextField.Layer.BorderColor = UIColor.FromRGB(255, 76, 57).CGColor; isFieldsValid = false; } else { AlertMessageTextField.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; } // verification recipients if (App.Locator.AlertSOS.LsRecipients.Count == 0) { ViewBehindScrollView.Layer.BorderColor = UIColor.FromRGB(255, 76, 57).CGColor; isFieldsValid = false; } else { ViewBehindScrollView.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor; } // add the alert in the view model if (isFieldsValid) { SaveButton.Enabled = false; // display the loading layout var alertLoading = AlertControllerHelper.ShowAlertLoading(); PresentViewController(alertLoading, true, null); if (await App.Locator.AlertSOS.InsertOrUpdateAlertSOS(AlertTitleTextField.Text, AlertMessageTextField.Text)) { alertLoading.DismissViewController(true, null); } else { alertLoading.DismissViewController(true, null); SaveButton.Enabled = true; } } }
private void UpdatePasswordButton_TouchUpInside(object sender, EventArgs e) { var popup = AlertControllerHelper.ShowPopupUpdatePassword((passwordOld, password1, password2, errorLabel) => { App.Locator.Parameter.OldPassword = passwordOld.Text; App.Locator.Parameter.NewPassword = password1.Text; App.Locator.Parameter.NewPasswordReenter = password2.Text; UpdatePassword(); return(true); }); PresentViewController(popup, true, null); }
public override void SetDataAndStyleToView() { Title = Application.LocalizedString("TransactionTitle"); NoCreditLabel.Text = Application.LocalizedString("TransactionNoCredit"); // display the loading layout var alertLoading = AlertControllerHelper.ShowAlertLoading(); PresentViewController(alertLoading, true, async() => { await App.Locator.TransactionHistoric.GetTransactionHistoricByUser(); Tableview.Source = new HistoriqueSource(this); Tableview.Hidden = false; RefreshTable(); DismissViewController(false, null); alertLoading.DismissViewController(false, null); }); }
private void RefreshMarkers() { //if (_mapControlManager.ZonePolygon == null || _mapControlManager.ZonePolygon.Points.Count() == 0) //{ // NumberOfPointsLabel.Text = "0/" + App.Locator.ModeZone.MAX_NUMBER_OF_POINTS; // SurfaceLabel.Text = string.Format("0 {0}", "km²"); // return; //} FocusOnZoneButton.Hidden = true; // 1 points if (_mapControlManager.ZonePolygon.Points.Count() == 2 && _isNoPoint) { _isNoPoint = false; //NumberOfPointsLabel.Text = "1 / " + App.Locator.ModeZone.MAX_NUMBER_OF_POINTS; NumberOfPointsLabel.Text = Application.LocalizedString("Need3PointsForZone"); FocusOnZoneButton.Hidden = true; } // 0 points else if (_mapControlManager.ZonePolygon.Points.Count() == 2) { _isNoPoint = true; //NumberOfPointsLabel.Text = "0 / " + App.Locator.ModeZone.MAX_NUMBER_OF_POINTS; NumberOfPointsLabel.Text = Application.LocalizedString("ClickOnMap"); FocusOnZoneButton.Hidden = true; } // 2 points and more else { _isNoPoint = true; NumberOfPointsLabel.Text = Application.LocalizedString("Need3PointsForZone"); if ((_mapControlManager.ZonePolygon.Points.Count() - 1) == 10) { var actionSheetAlert = AlertControllerHelper.CreatePopupMaximumPointZone(); PresentViewController(actionSheetAlert, true, null); } if (_mapControlManager.ZonePolygon.Points.Count() - 1 > 2) { FocusOnZoneButton.Hidden = false; NumberOfPointsLabel.Text = string.Empty; } } //var surface = AreaHelper.CalculateAreaOfGPSPolygonOnEarthInSquareMeters(_mapControlManager.PointsOfZone); //SurfaceLabel.Text = AreaHelper.SerializeArea(surface); }
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(); }); } }
/// <summary> /// Event for adding a contact from the popup when no data /// </summary> private void EmptyDataButton_TouchUpInside() { var alertView = AlertControllerHelper.ShowAlertToAddContact((displayNameTextField, emailTextField) => { if (App.Locator.Alert.LsRecipients.Any((arg) => arg.Email.ToLower() == emailTextField.Text.Trim().ToLower())) { return(false); } // adding contact in the contact container if (VerificationFields(emailTextField)) { var recipient = new AlertRecipientDTO(); recipient.DisplayName = displayNameTextField.Text; recipient.Email = emailTextField.Text.Trim(); AddRecipientToRecipientContainer(recipient); return(true); } return(false); }); PresentViewController(alertView, true, null); }
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(); }
private UIButton CreateMoreButton(float x, double latitude, double longitude, bool isAlert = false) { var moreButton = new UIButton(UIButtonType.Custom); moreButton.Frame = new RectangleF(x, 4f, 30f, 30f); if (isAlert) { moreButton.SetImage(UIImage.FromBundle("MoreAlert"), UIControlState.Normal); } else { moreButton.SetImage(UIImage.FromBundle("More"), UIControlState.Normal); } moreButton.TouchUpInside += (s, e) => { var alert = AlertControllerHelper.CreateAlertOnMarkerMap(() => { var coordinate = new CLLocationCoordinate2D(latitude, longitude); var mapItem = new MKMapItem(new MKPlacemark(coordinate)); mapItem.OpenInMaps(new MKLaunchOptions() { MapCenter = coordinate }); } , () => { var item = FromObject(SeekiosApp.Helper.StringHelper.GoogleMapLinkShare(latitude, longitude)); var activityItems = new NSObject[] { item }; UIActivity[] applicationActivities = null; var activityController = new UIActivityViewController(activityItems, applicationActivities); if (_mapViewcontroller != null) { _mapViewcontroller.PresentViewController(activityController, true, null); } else if (_mapHistoriccontroller != null) { _mapHistoriccontroller.PresentViewController(activityController, true, null); } else if (_mapAllSeekios != null) { _mapAllSeekios.PresentViewController(activityController, true, null); } else if (_modeZonecontroller != null) { _modeZonecontroller.PresentViewController(activityController, true, null); } } , () => { var geoCode2 = new CLGeocoder(); geoCode2.ReverseGeocodeLocation(new CLLocation(latitude, longitude), (placemarks, error) => { if (placemarks?.Count() > 0) { UIPasteboard.General.String = FormatSeekiosAdress(placemarks.Last()); } else { var alert2 = AlertControllerHelper.CreateAlertOnMarkerMapNoAdress(); if (_mapViewcontroller != null) { _mapViewcontroller.PresentViewController(alert2, true, null); } else if (_mapHistoriccontroller != null) { _mapHistoriccontroller.PresentViewController(alert2, true, null); } else if (_mapAllSeekios != null) { _mapAllSeekios.PresentViewController(alert2, true, null); } else if (_modeZonecontroller != null) { _modeZonecontroller.PresentViewController(alert2, true, null); } } }); }); var geoCode = new CLGeocoder(); geoCode.ReverseGeocodeLocation(new CLLocation(latitude, longitude), (placemarks, error) => { if (placemarks?.Count() > 0) { alert.Title = FormatSeekiosAdress(placemarks.Last()); } else { alert.Title = Application.LocalizedString("NoAdressSeekios"); } }); if (_mapViewcontroller != null) { _mapViewcontroller.PresentViewController(alert, true, null); } else if (_mapHistoriccontroller != null) { _mapHistoriccontroller.PresentViewController(alert, true, null); } else if (_mapAllSeekios != null) { _mapAllSeekios.PresentViewController(alert, true, null); } else if (_modeZonecontroller != null) { _modeZonecontroller.PresentViewController(alert, true, null); } }; return(moreButton); }
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(); })); }
partial void RefreshInProgressButton_Click(UIButton sender) { var actionSheetAlert = AlertControllerHelper.CreateAlertOnClickRefreshButton(MapViewModelBase.Seekios.SeekiosName); PresentViewController(actionSheetAlert, true, null); }