Esempio n. 1
0
        private async void button_Synch_Click(object sender, EventArgs e)
        {
            PowerControl vPowerControl = new PowerControl();
            int          vTime         = CommHelper.DateTimeToTimestamp(DateTime.Now);
            bool         vResult       = await vPowerControl.SendCMD_SetTime(DianYuanID, vTime);

            if (vResult)
            {
                MessageBox.Show("时间同步成功", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                label_Time.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            else
            {
                MessageBox.Show("时间同步失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }