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


C# Lifetime.AddAction方法代码示例

本文整理汇总了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));
    }
开发者ID:derigel23,项目名称:Nitra,代码行数:26,代码来源:Solution.cs

示例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
            });
        }
开发者ID:CSharpAnalyzers,项目名称:ExceptionalReSharper,代码行数:45,代码来源:SettingsView.xaml.cs


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