Пример #1
0
    /// <summary>
    /// Copy properties from "Tools|Options" page objects to <paramref
    /// name="globalSettings"/>.
    /// </summary>
    private void CopyOptionsPagesToGlobalSettings(GlobalSettings globalSettings) {
      CheckOnWriteThread();

      var page = _visualStudioPackageProvider.GetToolsOptionsPage<GeneralOptions>();
      ReflectionUtils.CopyDeclaredPublicProperties(page, "", globalSettings, "", throwOnExtraProperty: true);

      var page2 = _visualStudioPackageProvider.GetToolsOptionsPage<CodingStyleOptions>();
      ReflectionUtils.CopyDeclaredPublicProperties(page2, "", globalSettings, "CodingStyle", throwOnExtraProperty: true);
    }
Пример #2
0
    private GlobalSettings CreateGlobalSettings() {
      var result = new GlobalSettings();
      CopyOptionsPagesToGlobalSettings(result);

      // Ensure changes to the GlobalSettings object are save to the VS Settings.
      result.PropertyChanged += GlobalSettingsPropertyChangedHandler;

      // Ensure changes to the VS Settings are reflected to the GlobalSettings object.
      _eventBus.RegisterHandler("ToolsOptionsPageApply", ToolsOptionsPageApplyHandler);

      return result;
    }