/// <summary> /// Gets the geoLocators asynchronously; returns one GeoLocator /// </summary> public Task <ServiceProviderDatumCollection <GeoLocator> > GetGeoLocatorsAsync() { var result = new ServiceProviderDatumCollection <GeoLocator>(); result.Add(new GeoLocator(Name, ExternalName) { ServiceProviderGroup = new ServiceProviderGroup(this.ServiceProvider) }); return(TaskEx.FromResult(result)); }
/// <summary> /// Converts the storage model to a QueryViewModel that can be used within Lite. /// </summary> /// <param name="messenger">The messenger the ViewModel should be connected to</param> /// <param name="sources">The sources available for resolution of the Table</param> /// <returns>A LiteQueryViewModel</returns> public async Task <LiteQueryViewModel> ToUserQueryViewModel(Messenger messenger, ServiceProviderDatumCollection <FeatureSourceDescriptor> sources) { LiteQueryViewModel result = null; if (TransactionContext.ActiveContext.ProjectName == this.ProjectName) { var serviceProvider = ServiceProviderManager.Instance.ServiceProvider(ProviderName); if (serviceProvider != null) { var group = ProviderGroup.ToServiceProviderGroup(serviceProvider); var source = sources.Find(group); if (source != null) { var table = source.TableDescriptors[TableName]; // Check the table, since it can have disappeared in the mean-time if (table != null) { // Ensure we have a table with fields and all await table.EvaluateAsync(); var parameterDefinitions = this.ParameterDefinitions.ToParameterDefinitionCollection(serviceProvider); var queryDefinition = new FeatureCollectionQueryDefinition() { ServiceProviderGroup = table.ServiceProviderGroup, Context = ServiceProviderDatumContext.User, Name = Name, ExternalName = ExternalName, TableDescriptor = table, ParameterDefinitions = parameterDefinitions }; result = new LiteQueryViewModel(messenger, queryDefinition, PredicateText); } } } } return(result); }