Exemplo n.º 1
0
        private async void button_Refresh_Click(object sender, EventArgs e)
        {
            PowerControl vPowerControl = new PowerControl();
            int          vTime         = await vPowerControl.SendCMD_GetTime(DianYuanID);

            DateTime vDateTime = CommHelper.TimestampToDateTime(vTime);

            label_Time.Text = vDateTime.ToString("yyyy-MM-dd HH:mm:ss");
            if (vTime == 0)
            {
                MessageBox.Show("获取时间失败", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("获取时间成功", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }