private void btnSetTime_Click(object sender, EventArgs e) { Controller ctrl = GetSelectedController(); if (ctrl == null) { return; } IAccessCore access = new WGAccess(); bool ret = access.SetControllerTime(ctrl, dateTimePicker1.Value); MessageBox.Show("设置" + (ret ? "成功!" : "失败")); }
private void btnSetTime_Click(object sender, EventArgs e) { Controller ctrl = GetSelectedController(); if (ctrl == null) { return; } if (dtpTime.ValueObject == null) { WinInfoHelper.ShowInfoWindow(this, "请选择时间!"); return; } using (IAccessCore access = new WGAccess()) { bool ret = access.SetControllerTime(ctrl, dtpTime.Value); WinInfoHelper.ShowInfoWindow(this, "设置时间" + (ret ? "成功!" : "失败")); } }