/// <summary> /// 调整 slave pc 时间 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdjustTime_Click(object sender, EventArgs e) { try { if (MessageBox.Show("确定调整Slave PC 时间吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { var tasks = new List <Task>(); this.dtpAdjustTime.CustomFormat = "yyyy-MM-dd HH:mm:ss"; DateTimeInfo dtInfo = new DateTimeInfo(this.dtpAdjustTime.Value); foreach (var iixServer in Global.ListIIXSerevr) { if (iixServer.IsEnable == false) { continue; } tasks.Add(Task.Factory.StartNew(() => { IIXExecute.AdjustPCTime(iixServer, dtInfo); })); } Task.WaitAll(tasks.ToArray()); } } catch (Exception ex) { Log.GetInstance().ErrorWrite("系统错误,请查询日志文件检查。"); Log.WriterExceptionLog(ex.ToString()); } }