コード例 #1
0
 void xd_OnReceiveNoteDevChargeStatus(DevChargeStatusNote obj)
 {
     if (InvokeRequired)
     {
         this.Invoke(new Action <DevChargeStatusNote>(xd_OnReceiveNoteDevChargeStatus), obj);
     }
     else
     {
         string msg = string.Format("xd_OnReceiveNoteDevChargeStatus devID:{0}"
                                    + ",ChongDianShuChuDianLiu:{1}"
                                    + ",ChongDianShuChuDianYa:{2}"
                                    + ",LianJieQueRenKaiGuanZhuangTai:{3}"
                                    + ",ShiFouLianJieDianChi:{4}"
                                    + ",ShuChuJiDianQiZhuangTai:{5}"
                                    + ",WorkStat:{6}"
                                    + ",YouGongZongDianDu:{7}"
                                    , obj.DevID
                                    , obj.ChongDianShuChuDianLiu
                                    , obj.ChongDianShuChuDianYa
                                    , obj.LianJieQueRenKaiGuanZhuangTai
                                    , obj.ShiFouLianJieDianChi
                                    , obj.ShuChuJiDianQiZhuangTai
                                    , obj.WorkStat
                                    , obj.YouGongZongDianDu
                                    );
         listBox1.Items.Add(msg + System.Environment.NewLine);
     }
 }
コード例 #2
0
        private void OnReceiveData_NoteDevChargeStatus(byte[] body)
        {
            IntPtr pdata = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(DevChargeStatusNote)));

            Marshal.Copy(body, 0, pdata, Marshal.SizeOf(typeof(DevChargeStatusNote)));
            DevChargeStatusNote msg = (DevChargeStatusNote)Marshal.PtrToStructure(pdata, typeof(DevChargeStatusNote));

            if (OnReceiveNoteDevChargeStatus != null)
            {
                OnReceiveNoteDevChargeStatus(msg);
            }
        }