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


C# EventSource.SendCommand方法代码示例

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


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

示例1: SendCommand

        /// <summary>
        /// Send a command to a particular EventSource identified by 'eventSource'
        /// 
        /// Calling this routine simply forwards the command to the EventSource.OnEventCommand
        /// callback.  What the EventSource does with the command and its arguments are from that point
        /// EventSource-specific.  
        /// 
        /// The eventSource is passed the EventListener that issued the command along with the command and
        /// arguments.  The contract is that to the extent possible the eventSource should not affect other
        /// EventListeners (eg filtering events), however sometimes this simply is not possible (if the
        /// command was to provoke a GC, or a System flush etc).   
        /// </summary>
        public static void SendCommand(EventSource eventSource, EventCommand command, IDictionary<string, string> commandArguments)
        {
            if (eventSource == null)
                throw new ArgumentNullException(nameof(eventSource));

            // User-defined EventCommands should not conflict with the reserved commands.
            if ((int)command <= (int)EventCommand.Update && (int)command != (int)EventCommand.SendManifest)
                throw new ArgumentException(SR.ArgumentOutOfRange_NeedPosNum, nameof(command));

            eventSource.SendCommand(null, command, true, EventLevel.LogAlways, EventKeywords.None, commandArguments);
        }
开发者ID:AndreGleichner,项目名称:corefx,代码行数:23,代码来源:EventProviderBase.cs

示例2: EnableEvents

        /// <summary>
        /// Enable all events from the eventSource identified by 'eventSource' to the current dispatcher that have a
        /// verbosity level of 'level' or lower and have a event keyword matching any of the bits in
        /// 'machAnyKeyword' as well as any (curEventSource specific) effect passing addingional 'key-value' arguments
        /// 'arguments' might have.  
        /// 
        /// This call can have the effect of REDUCING the number of events sent to the dispatcher if 'level'
        /// indicates a less verbose level than was previously enabled or if 'machAnyKeyword' has fewer
        /// keywords set than where previously set.
        /// 
        /// This call never has an effect on other EventListeners.
        /// </summary>       
        public void EnableEvents(EventSource eventSource, EventLevel level, EventKeywords matchAnyKeyword, IDictionary<string, string> arguments)
        {
            if (eventSource == null)
            {
                throw new ArgumentNullException(nameof(eventSource));
            }

            Contract.EndContractBlock();

            eventSource.SendCommand(this, EventCommand.Update, true, level, matchAnyKeyword, arguments);
        }
开发者ID:AndreGleichner,项目名称:corefx,代码行数:23,代码来源:EventProviderBase.cs

示例3: DisableEvents

        /// <summary>
        /// Disables all events coming from eventSource identified by 'eventSource'.  
        /// 
        /// If eventSourceGuid is Guid.Empty, then the affects all eventSources in the appdomain
        /// 
        /// This call never has an effect on other EventListeners.      
        /// </summary>
        public void DisableEvents(EventSource eventSource)
        {
            if (eventSource == null)
            {
                throw new ArgumentNullException(nameof(eventSource));
            }

            Contract.EndContractBlock();

            eventSource.SendCommand(this, EventCommand.Update, false, EventLevel.LogAlways, EventKeywords.None, null);
        }
开发者ID:AndreGleichner,项目名称:corefx,代码行数:18,代码来源:EventProviderBase.cs

示例4: SendCommand

        /// <summary>
        /// Send a command to a particular EventSource identified by 'eventSource'
        /// 
        /// Calling this routine simply forwards the command to the EventSource.OnEventCommand
        /// callback.  What the EventSource does with the command and its arguments are from that point
        /// EventSource-specific.  
        /// 
        /// The eventSource is passed the EventListener that issued the command along with the command and
        /// arguments.  The contract is that to the extent possible the eventSource should not affect other
        /// EventListeners (eg filtering events), however sometimes this simply is not possible (if the
        /// command was to provoke a GC, or a System flush etc).   
        /// </summary>
        public static void SendCommand(EventSource eventSource, EventCommand command, IDictionary<string, string> commandArguments)
        {
            if (eventSource == null)
                throw new ArgumentNullException("eventSource");

            // User-defined EventCommands should not conflict with the reserved commands.
            if ((int)command <= (int)EventCommand.Update && (int)command != (int)EventCommand.SendManifest)
                throw new ArgumentException("Invalid command value.", "command");

            eventSource.SendCommand(null, 0, 0, command, true, EventLevel.LogAlways, EventKeywords.None, commandArguments);
        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:23,代码来源:eventproviderbase.cs


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