本文整理汇总了C#中Lifetime.AddAction方法的典型用法代码示例。如果您正苦于以下问题:C# Lifetime.AddAction方法的具体用法?C# Lifetime.AddAction怎么用?C# Lifetime.AddAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lifetime
的用法示例。
在下文中一共展示了Lifetime.AddAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SettingsView
public SettingsView(Lifetime lifetime, OptionsSettingsSmartContext settings)
{
InitializeComponent();
_lifetime = lifetime;
_settings = settings;
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.DelegateInvocationsMayThrowExceptions,
DelegateInvocationsMayThrowExceptions, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.IsDocumentationOfExceptionSubtypeSufficientForThrowStatements,
IsDocumentationOfExceptionSubtypeSufficientForThrowStatements, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.IsDocumentationOfExceptionSubtypeSufficientForReferenceExpressions,
IsDocumentationOfExceptionSubtypeSufficientForReferenceExpressions, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectPublicMethods,
InspectPublicMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectInternalMethods,
InspectInternalMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectProtectedMethods,
InspectProtectedMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.InspectPrivateMethods,
InspectPrivateMethods, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.OptionalExceptions2,
OptionalExceptions, TextBox.TextProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultOptionalExceptions2,
UseOptionalExceptionsDefaults, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.OptionalMethodExceptions2,
OptionalMethodExceptions, TextBox.TextProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultOptionalMethodExceptions2,
UseOptionalMethodExceptionsDefaults, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.AccessorOverrides2,
AccessorOverrides, TextBox.TextProperty);
settings.SetBinding(lifetime, (ExceptionalSettings x) => x.UseDefaultAccessorOverrides2,
UseDefaultAccessorOverrides, CheckBoxDisabledNoCheck2.IsCheckedLogicallyDependencyProperty);
//settings.Changed.Advise(lifetime, delegate { Dispatcher.BeginInvoke((Action)(UpdateTextFields)); });
lifetime.AddAction(delegate
{
// TODO: Force rescan of all documents if settings have changed
});
}