void massRebootToolStripMenuItem_Click(object sender, EventArgs e) { var result = new ConfirmDialog { ConfirmSubject = "Mass Restart", ConfirmMessage = "Are you sure you want to restart all miners?" }.ShowDialog(); if (!result.Equals(DialogResult.OK)) { return; } var errors = new List <string>(); _antminers = AntminerService.GetAntminers(); foreach (var ant in _antminers.Antminer) { try { AntminerConnector.Restart(IPAddress.Parse(ant.IpAddress)); } catch (Exception ex) { errors.Add(string.Format("{0}: {1}", ant.IpAddress, ex.Message)); } } if (errors.Count > 0) { new ErrorDialog { ErrorSubject = "Error restarting miner(s)", ErrorMessage = "Some miners error when trying to restart. Hover to see error messages.", LongErrorMessage = errors.Aggregate((w, j) => string.Format("{0}\r\n{1}", w, j)) }.ShowDialog(); } }