Пример #1
0
        private void OnReceiveData_GetDevVersion(byte[] body)
        {
            IntPtr pdata = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GetDevVersionRet)));

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

            if (OnReceiveGetDevVersion != null)
            {
                OnReceiveGetDevVersion(msg);
            }
        }
Пример #2
0
 void xd_OnReceiveGetDevVersion(GetDevVersionRet obj)
 {
     if (InvokeRequired)
     {
         this.Invoke(new Action <GetDevVersionRet>(xd_OnReceiveGetDevVersion), obj);
     }
     else
     {
         string msg = string.Format("xd_OnReceiveGetDevVersion devID:{0}"
                                    + ",FactoryID:{1}"
                                    + ",DevSoftVersion:{2}"
                                    + ",CRC:{3}"
                                    , obj.DevID
                                    , obj.FactoryID
                                    , obj.DevSoftVersion
                                    , obj.CRC
                                    );
         listBox1.Items.Add(msg + System.Environment.NewLine);
     }
 }