本文整理汇总了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));
}
示例2: NancyReferenceProviderFactory
public NancyReferenceProviderFactory(Lifetime lifetime, ISolution solution, ISettingsStore settingsStore, MvcReferenceProviderValidator providerValidator)
{
this.solution = solution;
lifetime.AddBracket(() => providerValidator.OnChanged += FireOnChanged,
() => providerValidator.OnChanged -= FireOnChanged);
}
示例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));
}
示例4: ReflectedReferenceProviderFactory
public ReflectedReferenceProviderFactory(Lifetime lifetime, ISolution solution, ISettingsStore settingsStore, ReflectedReferenceProviderValidator validator)
{
lifetime.AddBracket(() => validator.OnChanged += FireOnChanged, () => validator.OnChanged -= FireOnChanged);
}
示例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);
}