Exemplo n.º 1
0
        /// <summary>
        /// 登录成功,加载数据
        /// </summary>
        /// <param name="phone"></param>
        public void LoginSuccess(string phone)
        {
            this.Invoke(new Action(() => {
                timerControlLoading.Start();
                if (!ClassStatic.IsPhone(phone))
                {
                    LabelTipShow("登录失败,登录账号格式有误", true);
                    return;
                }
                ClassStatic.account = phone;

                string name = Dns.GetHostName();
                string mac  = ClassStatic.GetMacByNetworkInterface();
                Action <bool, byte[]> action      = new Action <bool, byte[]>(SendMyOnline_Callback);
                ClassStatic.ClientData clientData = new ClassStatic.ClientData(name, mac, ClassStatic.portraitPid.ToString());
                ClassStatic.tcpClient.Send(201, ClassStatic.SetClientDataByte(clientData), action);
            }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 刷新设备列表
        /// </summary>
        public void InitializeDeviceList()
        {
            DeviceOnlineCount = 1;
            flowLayoutPanelList.Controls.Clear();
            controlDeviceOnline.Clear();
            controlDeviceOffline.Clear();

            controlDeviceMyself.Title    = System.Net.Dns.GetHostName();
            controlDeviceMyself.Mac      = ClassStatic.GetMacByNetworkInterface();
            controlDeviceMyself.Status   = ClassStatic.onlineStatus;
            controlDeviceMyself.Oneself  = true;
            controlDeviceMyself.Portrait = ClassStatic.portraitPid;

            flowLayoutPanelList.Controls.Add(controlDeviceMyself);

            // 获取设备列表
            Action <bool, byte[]> action = new Action <bool, byte[]>(GetDeviceList_Callback);

            ClassStatic.tcpClient.Send(200, ClassStatic.GetBytes("获取设备列表"), action);
        }