private async Task DisplayFeatureActionMenuAsync(Feature feature) { string result = await NavigationService.GetCurrentPage().DisplayActionSheet((string)feature.Properties[Constants.NameProperty], "Dismiss", "Delete", "View"); switch (result) { case "Delete": shakeService.Start(); await FeatureStore.DeleteItem(feature); RefreshMap(); break; case "View": if (feature.Properties.ContainsKey(Constants.LogTimestampsProperty)) { await NavigationService.NavigateToLoggerPage(feature); } else { await NavigationService.NavigateToEditPage(feature); } break; default: break; } }
public override async Task <string> GetOrNullAsync(FeatureDefinition feature) { if (!CurrentClient.IsAuthenticated) { return(null); } return(await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentClient.Id)); }
public async override Task <string> GetOrNullAsync(FeatureDefinition feature) { var editionId = PrincipalAccessor.Principal?.FindEditionId(); if (editionId == null) { return(null); } return(await FeatureStore.GetOrNullAsync(feature.Name, Name, editionId.Value.ToString())); }
public async Task ImportRawGeoJSON(string contents) { try { int successfulImports = await FeatureStore.ImportRawContents(contents); await NavigationService.ShowImportAlert(successfulImports); } catch (Exception ex) { await NavigationService.ShowAlert("Import Error", ex.Message, false); } }
public bool IsActive(string featureKey, FeatureContext featureContext) { if (featureContext.InternalFeatureContext == null) { featureContext.InternalFeatureContext = new InternalFeatureContext() { Features = this } } ; return(FeatureStore.GetFeature(featureKey).IsActive(featureContext)); }
/// <summary> /// Call the Feature Store to delete seleted feature. /// </summary> /// <param name="feature">Feature to delete.</param> /// <returns></returns> private async Task DeleteFeature(Feature feature) { if (IsBusy) { return; } IsBusy = true; shakeService.Start(); await FeatureStore.DeleteItem(feature); IsBusy = false; }
public async void UndoDelete() { bool result = await NavigationService.GetCurrentPage().DisplayAlert("Undo Delete", "", "Undo", "Cancel"); if (result) { string contents = File.ReadAllText(Constants.DELETED_FEATURE_FILE); try { _ = await FeatureStore.ImportRawContents(contents); } catch (Exception ex) { await NavigationService.ShowAlert("Recovery Error", ex.Message, false); } } }
/// <summary> /// Shows native share sheet that exports all features. /// </summary> /// <returns></returns> private async Task ShowShareSheet() { if (IsBusy) { return; } IsBusy = true; ShareFileRequest share = new ShareFileRequest { Title = "Share Features", File = new ShareFile(await FeatureStore.ExportFeatures(FeatureList), "application/json"), }; share.PresentationSourceBounds = DeviceInfo.Platform == DevicePlatform.iOS && DeviceInfo.Idiom == DeviceIdiom.Tablet ? new System.Drawing.Rectangle((int)(DeviceDisplay.MainDisplayInfo.Width * .474), 80, 0, 0) : System.Drawing.Rectangle.Empty; await Share.RequestAsync(share); IsBusy = false; }
public async Task ImportFeatureList() { try { FeatureCollection featureCollection = (FeatureCollection)GeoJSONObject.ImportGeoJSON(Constants.FeaturesFileContents); _ = await FeatureStore.ImportItems(featureCollection.Features); } catch { bool result = await NavigationService.ShowAlert("Feature List Error", "Groundsman was unable to load your saved features. Would you like to export the corrupted features?", true); if (result) { await Share.RequestAsync(new ShareFileRequest { Title = "Groundsman Feature List (Corrupted)", File = new ShareFile(Constants.FEATURES_FILE, "application/json"), }); } await FeatureStore.ResetItems(); } }
public override async Task <string> GetOrNullAsync(FeatureDefinition feature) { return(await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentTenant.Id?.ToString()).ConfigureAwait(false)); }
public IEnumerable <IFeatureFlag> GetAllFeatures() { var a = FeatureStore.GetAllFeatures().ToArray(); return(a); // a.Select(x => x.Name); }
public async override Task <string> GetOrNullAsync(FeatureDefinition feature) { return(await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentTenant.Id?.ToString())); }
public override async Task <string> GetOrNullAsync(FeatureDefinition feature) { return(await FeatureStore.GetOrNullAsync(feature.Name, Name, _currentUser?.Id?.ToString())); }
public static bool IsActive(string featureKey, FeatureContext featureContext) { return(FeatureStore.GetFeature(featureKey).IsActive(featureContext)); }