public object GenerateSettingsObjectForInspector(ISolutionProjectModel solutionProject = null, params object[] objectsToMerge)
        {
            var propertiesForInspector = new CustomClass("Properties", objectsToMerge);

            var settingsProviderClasses = CheckoutAndBuild2Package.GetExportedValues <ISettingsProviderClass>();

            foreach (ISettingsProviderClass settingsProviderClass in settingsProviderClasses)
            {
                var res = GetSettingsFromProvider(settingsProviderClass.GetType(), solutionProject);
                IEnumerable <PropertyInfo> settableProperties;
                if (solutionProject != null)
                {
                    settableProperties = res.GetSettableProperties(SettingsAvailability.ProjectSpecific, SettingsAvailability.GlobalWithProjectSpecificOverride);
                }
                else
                {
                    settableProperties = res.GetSettableProperties(SettingsAvailability.Global, SettingsAvailability.GlobalWithProjectSpecificOverride);
                }

                foreach (var propertyInfo in settableProperties)
                {
                    SettingsKey settingsKey = SettingsExtensions.GetSettingsKey(propertyInfo, res, solutionProject);
                    var         value       = Get(settingsKey, propertyInfo.PropertyType, propertyInfo.GetValue(res));
                    propertiesForInspector.AddProperty(propertyInfo, value, o => Set(o.GetType(), settingsKey, o));
                }
            }

            return(propertiesForInspector);
        }
Exemple #2
0
        public async Task RunExternalPostActions(ISolutionProjectModel model, IOperationService service, object result, IServiceSettings settings = null,
                                                 CancellationToken cancellationToken = default(CancellationToken))
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            if (settings == null)
            {
                settings = settingsService.GetMainServiceSettings();
            }

            await Task.WhenAll(
                RunPostServiceScriptFileForProjectAsync(service, model, result, settings, cancellationToken),
                Task.Run(() =>
            {
                foreach (ICustomAction externalAction in CheckoutAndBuild2Package.GetExportedValues <ICustomAction>())
                {
                    if (cancellationToken.IsCancellationRequested)
                    {
                        break;
                    }
                    externalAction.RunPostAction(service, model, result, settings);
                }
            }, cancellationToken));
        }
 private bool GetIsProjectDefaultIncluded()
 {
     foreach (var defaultBehavior in CheckoutAndBuild2Package.GetExportedValues <IDefaultBehavior>())
     {
         var isIncluded = defaultBehavior.ShouldIncludedByDefault(this);
         if (isIncluded != null)
         {
             return(isIncluded.Value);
         }
     }
     return(!IsDelphiProject);
 }
Exemple #4
0
 private void LoadExternalSettings()
 {
     ExternalSettings = new ObservableCollection <UIElement>(CheckoutAndBuild2Package.GetExportedValues <ISettingsProviderClass>()
                                                             .SelectMany(sp => sp.GetUIElements(SelectedService, SettingsAvailability.Global, SettingsAvailability.GlobalWithProjectSpecificOverride)).OrderBy(element => element.GetType().ToString()));
 }
Exemple #5
0
 public ServiceSettingsSelectorViewModel(IServiceProvider serviceProvider)
     : base(serviceProvider)
 {
     AvailableServices                    = new ObservableCollection <IOperationService>(CheckoutAndBuild2Package.GetExportedValues <IOperationService>().OrderBy(service => service.Order));
     SelectedService                      = AvailableServices.FirstOrDefault();
     settingsService                      = serviceProvider.Get <SettingsService>();
     OpenPopupCommand                     = new DelegateCommand <Popup>("Options", OnExecuteOpenPopup, CanTogglePopup);
     ShowBuildPropertiesCommand           = new DelegateCommand <Popup>("Build properties", OnExecuteShowBuildProperties);
     ShowBuildTargetsCommand              = new DelegateCommand <Popup>("Build Targets", OnExecuteShowBuildTargets);
     SelectDelphiCommand                  = new DelegateCommand <Visual>(SelectDelphi);
     TfsContext.SelectedWorkspaceChanged += (sender, args) => RaiseAllPropertiesChanged();
     VersionSpecSelectorViewModel         = new VersionSpecSelectorViewModel(serviceProvider);
 }
Exemple #6
0
        public IDictionary <string, string> GetDefaultBuildProperties(ISolutionProjectModel project, IServiceSettings settings)
        {
            IDictionary <string, string> res = new Dictionary <string, string>();

            return(CheckoutAndBuild2Package.GetExportedValues <IProjectBuildPropertiesProvider>().Select(provider => provider.GetDefaultBuildProperties(project, settings)).Where(props => props != null).Aggregate(res, (current, props) => current.MergeWith(props)));
        }