public void RunRefreshMachine(ref bool CanPing) { try { if (Machine == null) { return; } RunnerState = RunnerState.Connecting; var pingreply = new Ping().Send(Machine.IP, 2000); if (pingreply.Status == IPStatus.Success) { CanPing = true; } else { CanPing = false; RunnerState = RunnerState.Failed; return; } string ip = null; if (api.GetDeviceIP(Machine.MachineNumber, ref ip)) { RunnerState = RunnerState.Success; } else { RunnerState = RunnerState.Failed; AppDomain.Unload(domain); RunStartMachine(ref CanPing); } } catch (Exception ex) { Logger.Writer.Write(ex); } }