当前位置: 首页>>代码示例>>C#>>正文


C# Lifetime.AddBracket方法代码示例

本文整理汇总了C#中Lifetime.AddBracket方法的典型用法代码示例。如果您正苦于以下问题:C# Lifetime.AddBracket方法的具体用法?C# Lifetime.AddBracket怎么用?C# Lifetime.AddBracket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lifetime的用法示例。


在下文中一共展示了Lifetime.AddBracket方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Open

    public void Open(Lifetime lifetime, IShellLocks shellLocks, ChangeManager changeManager, ISolution solution, DocumentManager documentManager, IActionManager actionManager, ICommandProcessor commandProcessor, TextControlChangeUnitFactory changeUnitFactory, JetPopupMenus jetPopupMenus)
    {
      Debug.Assert(!IsOpened);

      _solution = solution;
      DocumentManager = documentManager;
      _jetPopupMenus = jetPopupMenus;
      changeManager.Changed2.Advise(lifetime, Handler);
      lifetime.AddAction(Close);
      var expandAction = actionManager.Defs.TryGetActionDefById(GotoDeclarationAction.ACTION_ID);
      if (expandAction != null)
      {
        var postfixHandler = new GotoDeclarationHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this);

        lifetime.AddBracket(
          FOpening: () => actionManager.Handlers.AddHandler(expandAction, postfixHandler),
          FClosing: () => actionManager.Handlers.RemoveHandler(expandAction, postfixHandler));
      }
      
      var findUsagesAction = actionManager.Defs.GetActionDef<FindUsagesAction>();
      var findUsagesHandler = new FindUsagesHandler(lifetime, shellLocks, commandProcessor, changeUnitFactory, this);

      lifetime.AddBracket(
        FOpening: () => actionManager.Handlers.AddHandler(findUsagesAction, findUsagesHandler),
        FClosing: () => actionManager.Handlers.RemoveHandler(findUsagesAction, findUsagesHandler));
    }
开发者ID:derigel23,项目名称:Nitra,代码行数:26,代码来源:Solution.cs

示例2: NancyReferenceProviderFactory

 public NancyReferenceProviderFactory(Lifetime lifetime, ISolution solution, ISettingsStore settingsStore, MvcReferenceProviderValidator providerValidator)
 {
     this.solution = solution;
     
     lifetime.AddBracket(() => providerValidator.OnChanged += FireOnChanged,
                         () => providerValidator.OnChanged -= FireOnChanged);
 }
开发者ID:jimmason,项目名称:Nancy.ReSharper,代码行数:7,代码来源:NancyReferenceProviderFactory.cs

示例3: PatternManagerCache

        public PatternManagerCache(Lifetime lifetime, CacheManagerEx cacheManager, PsiProjectFileTypeCoordinator projectFileTypeCoordinator, SolutionAnalyzer solutionAnalyzer)
        {
            this.projectFileTypeCoordinator = projectFileTypeCoordinator;
            this.solutionAnalyzer = solutionAnalyzer;

            lifetime.AddBracket(() => cacheManager.RegisterCache(this), () => cacheManager.UnregisterCache(this));
        }
开发者ID:dpvreony-forks,项目名称:AgentMulder,代码行数:7,代码来源:PatternManagerCache.cs

示例4: ReflectedReferenceProviderFactory

 public ReflectedReferenceProviderFactory(Lifetime lifetime, ISolution solution, ISettingsStore settingsStore, ReflectedReferenceProviderValidator validator)
 {
     lifetime.AddBracket(() => validator.OnChanged += FireOnChanged, () => validator.OnChanged -= FireOnChanged);
 }
开发者ID:hazzik,项目名称:ReSharper.Reflection,代码行数:4,代码来源:ReflectedReferenceProviderFactory.cs

示例5: package

        private ILookup<string, FileSystemPath> installedPackages; // there can be several versions of one package (different versions)

        #endregion Fields

        #region Constructors

        public NuGetApi(ISolution solution, Lifetime lifetime, IComponentModel componentModel, IThreading threading, ProjectModelSynchronizer projectModelSynchronizer)
        {
            this.solution = solution;
            this.threading = threading;
            this.projectModelSynchronizer = projectModelSynchronizer;
            try
            {
                vsPackageInstallerServices = componentModel.GetExtensions<IVsPackageInstallerServices>().SingleOrDefault();
                vsPackageInstaller = componentModel.GetExtensions<IVsPackageInstaller>().SingleOrDefault();
                vsPackageInstallerEvents = componentModel.GetExtensions<IVsPackageInstallerEvents>().SingleOrDefault();
            }
            catch (Exception e)
            {
                Logger.LogException("Unable to get NuGet interfaces.", e);
            }

            if (!IsNuGetAvailable)
            {
                Logger.LogMessage(LoggingLevel.VERBOSE, "[NUGET PLUGIN] Unable to get NuGet interfaces. No exception thrown");
                return;
            }

            lifetime.AddBracket(
              () => vsPackageInstallerEvents.PackageInstalled += RecalcInstalledPackages,
              () => vsPackageInstallerEvents.PackageInstalled -= RecalcInstalledPackages);

              lifetime.AddBracket(
              () => vsPackageInstallerEvents.PackageUninstalled += RecalcInstalledPackages,
              () => vsPackageInstallerEvents.PackageUninstalled -= RecalcInstalledPackages);

              RecalcInstalledPackages(null);
        }
开发者ID:netProgrammer,项目名称:resharper-nuget,代码行数:38,代码来源:NuGetApi.cs


注:本文中的Lifetime.AddBracket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。