private void Cpu_Disconnected(object sender, PviEventArgs e) { String ipAddress = String.Empty; if (sender is Cpu cpu) { if (_service.Cpus.ContainsKey(cpu.Name)) { ipAddress = cpu.Connection.TcpIp.DestinationIpAddress; cpu.Dispose(); } } var pviEventMsg = Utils.FormatPviEventMessage($"ServiceWrapper.Cpu_Disconnected. IpAddress={ipAddress}", e); _eventNotifier.OnCpuDisconnected(sender, new PviApplicationEventArgs() { Message = pviEventMsg }); }