Пример #1
0
        public AlFormattingPolicy GetProjectOptions(IProject project)
        {
            if (!initialized)
            {
                return(GlobalOptions);
            }

            var csproject = project as AlProject;

            if (csproject != null)
            {
                string key = project.FileName;
                if (!projectOptions.ContainsKey(key))
                {
                    // Lazily create options container for project
                    var projectFormattingPersistence = new AlFormattingPolicy(
                        csproject.GlobalPreferences,
                        new AlFormattingOptionsContainer((SolutionOptions ?? GlobalOptions).OptionsContainer)
                    {
                        DefaultText = StringParser.Parse("${res:AlBinding.Formatting.ProjectOptionReference}")
                    });
                    projectFormattingPersistence.FormattingPolicyUpdated += OnFormattingPolicyUpdated;
                    projectFormattingPersistence.Load();
                    projectOptions[key] = projectFormattingPersistence;
                }

                return(projectOptions[key]);
            }

            return(SolutionOptions ?? GlobalOptions);
        }
Пример #2
0
 public AlFormattingPolicies()
 {
     // Load global settings
     GlobalOptions = new AlFormattingPolicy(
         SD.PropertyService.MainPropertiesContainer, new AlFormattingOptionsContainer()
     {
         DefaultText = StringParser.Parse("${res:AlBinding.Formatting.GlobalOptionReference}")
     });
     GlobalOptions.FormattingPolicyUpdated += OnFormattingPolicyUpdated;
     GlobalOptions.Load();
 }
Пример #3
0
 void SolutionOpened(object sender, SolutionEventArgs e)
 {
     // Load solution settings
     SolutionOptions = new AlFormattingPolicy(
         e.Solution.SDSettings,
         new AlFormattingOptionsContainer(GlobalOptions.OptionsContainer)
     {
         DefaultText = StringParser.Parse("${res:AlBinding.Formatting.SolutionOptionReference}")
     });
     SolutionOptions.FormattingPolicyUpdated += OnFormattingPolicyUpdated;
     SolutionOptions.Load();
 }
Пример #4
0
 void SolutionClosed(object sender, SolutionEventArgs e)
 {
     SolutionOptions.FormattingPolicyUpdated -= OnFormattingPolicyUpdated;
     SolutionOptions = null;
     projectOptions.Clear();
 }