/// <summary> /// Pings the reply event handler. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="PingReplyEventArgs"/> instance containing the event data.</param> /// <autogeneratedoc /> private void PingReplyEventHandler(object sender, PingReplyEventArgs args) { sender.Should().BeAssignableTo <IPingTask>(); if (args != null) { TestOutputHelper.WriteLine( $"Job: {args.PingJob.JobGuid}, TaskId: {args.PingJob.TaskId}, IPAddressSubnet: {args.PingJob.IPAddressSubnet}, Status: {args.PingReply.Status}"); } }
static void onReply(PingReplyEventArgs args) { System.Diagnostics.Debug.WriteLine("onReply: " + args.message); ReplyEventHandler handler = onReplyEvent; if (handler != null) { handler("pingReply", args); } }
private void PingReplyLoggingEventHandler(object sender, PingReplyEventArgs args) { if (args == null || !EnableLogging) { return; } using (Logger?.BeginScope("[{Timestamp}:{JobId}:{TaskId}]", args.PingJob.Timestamp, args.PingJob.JobGuid, args.PingJob.TaskId)) { var pingReply = args.PingReply; if (pingReply.Status == IPStatus.Success) { using (Logger?.PushLogProperties( pingReply.GetLogPropertyListLevel(LogLevel.Information, LoggableFormat.ToLog))) { Logger?.LogInformation("Ping {Status} to {IPAddressSubnet}", args.PingReply.Status, args.PingJob.IPAddressSubnet); } } else if (pingReply.Status == IPStatus.TimedOut) { using (Logger?.PushLogProperties( pingReply.GetLogPropertyListLevel(LogLevel.Trace, LoggableFormat.ToLog))) { Logger?.LogTrace("Ping {Status} for {IPAddressSubnet}", args.PingReply.Status, args.PingJob.IPAddressSubnet); } } else { using (Logger?.PushLogProperties( pingReply.GetLogPropertyListLevel(LogLevel.Debug, LoggableFormat.ToLog))) { Logger?.LogDebug("Ping {Status} for {IPAddressSubnet}", args.PingReply.Status, args.PingJob.IPAddressSubnet); } } } }
private void PingTaskReplyEventHandler(object sender, PingReplyEventArgs pingReplyEventArgs) { OnPingReplyService?.Invoke(this, pingReplyEventArgs); }
private static void OnPingReply(object sender, PingReplyEventArgs pingReplyEventArgs) { var information = MethodBase.GetCurrentMethod().Name; try { var serverUser = GetServerUser(sender); Trace.WriteLine(information, serverUser.ToString()); } catch (Exception ex) { Console.WriteLine("{0} exception {1}", information, ex.Message); } }
protected void RaiseGotPingReply(PingReplyEventArgs e) { Dispatch(GotPingReply, e); }
protected virtual void OnGotPingReply(PingReplyEventArgs e) { RaiseGotPingReply(e); }