示例#1
0
        private void OnReceiveData_NoteDevStatus(byte[] body)
        {
            IntPtr pdata = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(DevStatusNote)));

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

            if (OnReceiveNoteDevStatus != null)
            {
                OnReceiveNoteDevStatus(msg);
            }
        }
示例#2
0
 void xd_OnReceiveNoteDevStatus(DevStatusNote obj)
 {
     if (InvokeRequired)
     {
         this.Invoke(new Action <DevStatusNote>(xd_OnReceiveNoteDevStatus), obj);
     }
     else
     {
         string msg = string.Format("xd_OnReceiveNoteDevStatus devID:{0}"
                                    + ",IsOnline:{1}"
                                    + ",ServiceStat:{2}"
                                    + ",UserID:{3}"
                                    , obj.DevID
                                    , obj.IsOnline
                                    , obj.ServiceStat
                                    , obj.UserID
                                    );
         listBox1.Items.Add(msg + System.Environment.NewLine);
     }
 }