protected override Task <IEnumerable <IEntityValue> > CreateValuesAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, ValueEditor providerState)
 {
     return(Task.FromResult(UIEditorMetadataProducer.CreateMetadataValues(parent, providerState, _properties)));
 }
        public async Task <(EntityIdentity oldProfileId, EntityIdentity newProfileId)?> RenameLaunchProfileAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, string currentProfileName, string newProfileName, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();

            ILaunchSettings launchSettings = await _launchSettingsProvider.WaitForFirstSnapshot(cancellationToken);

            ProjectSystem.Debug.ILaunchProfile?existingProfile = launchSettings.Profiles.FirstOrDefault(p => StringComparers.LaunchProfileNames.Equals(p.Name, currentProfileName));
            if (existingProfile is not null)
            {
                var writableProfile = new WritableLaunchProfile(existingProfile);
                writableProfile.Name = newProfileName;

                await _launchSettingsProvider.RemoveProfileAsync(currentProfileName);

                await _launchSettingsProvider.AddOrUpdateProfileAsync(writableProfile.ToLaunchProfile(), addToFront : false);

                if (_launchSettingsProvider.CurrentSnapshot is IVersionedLaunchSettings versionedLaunchSettings)
                {
                    queryExecutionContext.ReportUpdatedDataVersion(_launchSettingsTracker.VersionKey, versionedLaunchSettings.Version);
                }

                return(CreateLaunchProfileId(parent, currentProfileName), CreateLaunchProfileId(parent, newProfileName));
            }

            return(null);
        }
Exemplo n.º 3
0
 protected override void PrepareSearchSettings(IQueryExecutionContext context)
 {
     mapper.PrepareSearchSettings(context);
 }
Exemplo n.º 4
0
 protected override Task <IEnumerable <IEntityValue> > CreateValuesAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, PropertyProviderState providerState)
 {
     return(Task.FromResult(UIPropertyEditorDataProducer.CreateEditorValues(queryExecutionContext, parent, providerState.ContainingRule, providerState.PropertyName, _properties)));
 }
Exemplo n.º 5
0
 protected abstract TDocument ConvertDocument(Document doc, IQueryExecutionContext context);
Exemplo n.º 6
0
 protected abstract void PrepareSearchSettings(IQueryExecutionContext context);
        public void CopyFromDocument(Document source, IQueryExecutionContext context, T target)
        {
            var value = GetFieldValue(source);

            propertyInfo.SetValue(target, value, null);
        }
Exemplo n.º 8
0
 protected abstract IDocumentKey GetDocumentKey(Document doc, IQueryExecutionContext context);
Exemplo n.º 9
0
        protected override Task <IEnumerable <IEntityValue> > CreateValuesAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, UnconfiguredProject providerState)
        {
            queryExecutionContext.ReportProjectVersion(providerState);

            return(PropertyPageDataProducer.CreatePropertyPageValuesAsync(queryExecutionContext, parent, providerState, _projectStateProvider, _properties));
        }
 protected abstract Task <IEntityValue?> TryCreateEntityOrNullAsync(IQueryExecutionContext queryExecutionContext, EntityIdentity id);
        protected override async Task <IEnumerable <IEntityValue> > CreateValuesAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, ContextAndRuleProviderState providerState)
        {
            if (await providerState.ProjectState.GetMetadataVersionAsync() is (string versionKey, long versionNumber))
            {
                queryExecutionContext.ReportInputDataVersion(versionKey, versionNumber);
            }

            return(CategoryDataProducer.CreateCategoryValues(queryExecutionContext, parent, providerState.Rule, _properties));
        }
Exemplo n.º 12
0
        public async Task <IEnumerable <IEntityValue> > RetrieveAllLaunchProfileEntitiesAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, ILaunchProfilePropertiesAvailableStatus requestedProperties)
        {
            if (await _project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog)
            {
                ILaunchSettings launchSettings = await _launchSettingsProvider.WaitForFirstSnapshot();

                return(createLaunchProfileValues(launchSettings));
            }

            return(Enumerable.Empty <IEntityValue>());

            IEnumerable <IEntityValue> createLaunchProfileValues(ILaunchSettings launchSettings)
            {
                Dictionary <string, Rule> debugRules = new();

                foreach (Rule rule in DebugUtilities.GetDebugChildRules(projectCatalog))
                {
                    if (rule.Metadata.TryGetValue(s_commandNameMetadataName, out object?commandNameObj) &&
                        commandNameObj is string commandName)
                    {
                        debugRules[commandName] = rule;
                    }
                }

                if (launchSettings is IVersionedLaunchSettings versionedLaunchSettings)
                {
                    queryExecutionContext.ReportInputDataVersion(_launchSettingsTracker.VersionKey, versionedLaunchSettings.Version);
                }

                IProjectState projectState = new LaunchProfileProjectState(_project, _launchSettingsProvider, _launchSettingsTracker);

                foreach ((int index, ProjectSystem.Debug.ILaunchProfile profile) in launchSettings.Profiles.WithIndices())
                {
                    if (!Strings.IsNullOrEmpty(profile.Name) &&
                        !Strings.IsNullOrEmpty(profile.CommandName) &&
                        debugRules.TryGetValue(profile.CommandName, out Rule rule))
                    {
                        QueryProjectPropertiesContext propertiesContext = new(
                            isProjectFile : true,
                            file : _project.FullPath,
                            itemType : LaunchProfileProjectItemProvider.ItemType,
                            itemName : profile.Name);

                        EntityIdentity id = CreateLaunchProfileId(parent, profile.Name);
                        IEntityValue   launchProfileValue = CreateLaunchProfileValue(queryExecutionContext, id, propertiesContext, rule, index, projectState, requestedProperties);
                        yield return(launchProfileValue);
                    }
                }
            }
        }
Exemplo n.º 13
0
 protected override Task <IEnumerable <IEntityValue> > CreateValuesAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, UnconfiguredProject providerState)
 {
     return(CreateLaunchProfileTypeValuesAsync(parent, providerState));
 }