コード例 #1
0
        private void GetOnlineManageList()
        {
            var manageList = (from item in manageInfoPool
                              select item.Value).ToList();

            mJsonResult json = new mJsonResult()
            {
                success        = true,
                rows           = manageList,
                clientPostType = "retGetOnlineManageList"
            };

            //推送给所有连接的管理页面
            Dictionary <Socket, ClientInfo> sendto = (
                from a in manageInfoPool
                select new KeyValuePair <Socket, ClientInfo>(a.Key, null)
                ).ToDictionary(key => key.Key, value => value.Value);

            SocketMessage sm = new SocketMessage()
            {
                Message       = json.ToJson(),
                SendToClients = sendto
            };

            msgPool.Add(sm);
        }
コード例 #2
0
        private void DeviceGoOnLine()
        {
            string     deviceSN   = socketContext.GetJsonValue("DeviceSN");
            DeviceInfo clientInfo = new DeviceInfo()
            {
                deviceSN   = deviceSN,
                onLineTime = DateTime.Now
            };


            devicePool.Add(curClientSocket, clientInfo);

            mJsonResult json = new mJsonResult()
            {
                success        = true,
                msg            = string.Format("上线成功,上线时间:{0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                clientPostType = "retDeviceGoOnLine"
            };

            SocketMessage sm = new SocketMessage()
            {
                Message       = json.ToJson(),
                SendToClients = new Dictionary <Socket, ClientInfo>()
                {
                    { curClientSocket, null }
                }
            };

            msgPool.Add(sm);

            //设备上线 推送给所有管理页面
            GetOnlineDeviceList();
        }
コード例 #3
0
        private void ManageGoOnLine()
        {
            string     userName   = socketContext.GetJsonValue("userName");
            ManageInfo clientInfo = new ManageInfo()
            {
                userName   = userName,
                onLineTime = DateTime.Now
            };


            manageInfoPool.Add(curClientSocket, clientInfo);

            mJsonResult json = new mJsonResult()
            {
                success        = true,
                msg            = string.Format("上线成功,上线时间:{0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                clientPostType = "retManageGoOnLine"
            };

            SocketMessage sm = new SocketMessage()
            {
                Message       = json.ToJson(),
                SendToClients = new Dictionary <Socket, ClientInfo>()
                {
                    { curClientSocket, null }
                }
            };

            msgPool.Add(sm);
        }