Exemple #1
0
 void xd_OnReceiveLogin(LoginRet obj)
 {
     if (InvokeRequired)
     {
         this.Invoke(new Action <LoginRet>(xd_OnReceiveLogin), obj);
     }
     else
     {
         float a = 0f;
         a = xd.Convert2Float(obj.ClientType, 3);
         listBox1.Items.Add("xd_OnReceiveLogin ClientName:" + obj.ClientName + ",ClientType:" + obj.ClientType + ",ret:" + obj.ret + System.Environment.NewLine);
     }
 }
Exemple #2
0
        private void OnReceiveData_LOGIN(byte[] data)
        {
            IntPtr pdata = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(LoginRet)));

            Marshal.Copy(data, 0, pdata, Marshal.SizeOf(typeof(LoginRet)));
            LoginRet hb = (LoginRet)Marshal.PtrToStructure(pdata, typeof(LoginRet));

            if (hb.ret == 0)
            {
                m_userName = hb.ClientName;
                m_userType = hb.ClientType;
                m_isLogin  = true;
                new System.Threading.Thread(ThHBSend).Start();
            }
            if (OnReceiveLogin != null)
            {
                OnReceiveLogin(hb);
            }
        }