private string GetBrowseObjectValueAtEnd(Func <ConfigurationGeneralBrowseObject, IEvaluatedProperty> func)
 {
     return(_threadingService.ExecuteSynchronously(async() =>
     {
         ConfigurationGeneralBrowseObject browseObject = await _projectProperties.Value.GetConfigurationGeneralBrowseObjectPropertiesAsync();
         IEvaluatedProperty evaluatedProperty = func(browseObject);
         return await evaluatedProperty.GetEvaluatedValueAtEndAsync();
     }));
 }
 private void SetBrowseObjectValue(Func <ConfigurationGeneralBrowseObject, IEvaluatedProperty> func, object value)
 {
     _threadingService.ExecuteSynchronously(async() =>
     {
         ConfigurationGeneralBrowseObject browseObject = await _projectProperties.Value.GetConfigurationGeneralBrowseObjectPropertiesAsync();
         IEvaluatedProperty evaluatedProperty          = func(browseObject);
         await evaluatedProperty.SetValueAsync(value);
     });
 }
        private T GetBrowseObjectValue <T>(Func <ConfigurationGeneralBrowseObject, IEvaluatedProperty> func)
        {
            return(_threadingService.ExecuteSynchronously(async() =>
            {
                ConfigurationGeneralBrowseObject browseObject = await _projectProperties.Value.GetConfigurationGeneralBrowseObjectPropertiesAsync();
                IEvaluatedProperty evaluatedProperty = func(browseObject);
                object?value = await evaluatedProperty.GetValueAsync();

                // IEvaluatedProperty.GetValueAsync always returns a non-null value, though
                // it inherits this method from IProperty which can return null.
                return (T)value !;
            }));
        }
Exemple #4
0
        protected override async Task <IProjectTree> FindFileAsync(string specialFileName)
        {
            // If the ApplicationManifest property is defined then we should just use that - otherwise fall back to the default logic to find app.manifest.
            ConfigurationGeneralBrowseObject configurationGeneral = await _projectProperties.GetConfigurationGeneralBrowseObjectPropertiesAsync().ConfigureAwait(false);

            string appManifestProperty = await configurationGeneral.ApplicationManifest.GetEvaluatedValueAtEndAsync().ConfigureAwait(false) as string;

            if (!string.IsNullOrEmpty(appManifestProperty) &&
                !appManifestProperty.Equals(DefaultManifestValue, StringComparison.InvariantCultureIgnoreCase) &&
                !appManifestProperty.Equals(NoManifestValue, StringComparison.InvariantCultureIgnoreCase))
            {
                return(_projectTree.TreeProvider.FindByPath(_projectTree.CurrentTree, appManifestProperty));
            }

            return(await base.FindFileAsync(specialFileName).ConfigureAwait(false));
        }
        private async Task <string?> GetAppManifestPathFromPropertiesAsync()
        {
            ConfigurationGeneralBrowseObject configurationGeneral = await _properties.GetConfigurationGeneralBrowseObjectPropertiesAsync();

            string?value = (string?)await configurationGeneral.ApplicationManifest.GetValueAsync();

            if (Strings.IsNullOrEmpty(value))
            {
                return(null);
            }

            if (StringComparers.PropertyLiteralValues.Equals(value, "DefaultManifest"))
            {
                return(null);
            }

            if (StringComparers.PropertyLiteralValues.Equals(value, "NoManifest"))
            {
                return(null);
            }

            return(value);
        }