using HKLib.Dto; using HKLib.Interfaces; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HKCardManager { public partial class MealSegmentSet : Form { public MealSegmentSet() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { this.Close(); } private void button1_Click(object sender, EventArgs e) { var data = new TimeSpilte() { AMStartTime = dateTimePicker1.Value, AMEndTime = dateTimePicker4.Value, PMStartTime = dateTimePicker2.Value, PMEndTime = dateTimePicker5.Value, ATStartTime = dateTimePicker3.Value, ATEndTime = dateTimePicker6.Value }; Task.Factory.StartNew(() => { if (HKLibHelper.SetTime(data)) { this.Invoke(() => { this.Close(); }); } else { this.label7.Text = "设置时间段失败,请重试!"; } }); } } }