本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}