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.UserPages { public partial class MealSegmentSetPage : UserControl { public MealSegmentSetPage() { InitializeComponent(); this.SizeChanged += MealSegmentSetPage_SizeChanged; } private void MealSegmentSetPage_SizeChanged(object? sender, EventArgs e) { panel1.Left = (this.Width - panel1.Width) / 2; panel1.Top = (this.Height - panel1.Height) / 2; } 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)) { MessageLogNotify.GetInstance.Show("设置餐段时间成功"); } else { MessageLogNotify.GetInstance.Show("设置时间段失败,请重试!"); } }); } } }