示例#1
0
        /// <summary>
        /// 插入Call Back信息
        /// </summary>
        public void InsertCallBack(CallBackInfo backInfo)
        {
            // 申請互斥鎖
            WriteMutex.WaitOne();
            bool isExists = false;

            //删除已经存在的客户ID
            for (int i = calls.Count - 1; i >= 0; i--)
            {
                if (ComparisonByte(calls[i].clientID, backInfo.clientID))
                {
                    isExists              = true;
                    calls[i].callIP       = backInfo.callIP;
                    calls[i].runTime      = backInfo.runTime;
                    calls[i].callPort     = backInfo.callPort;
                    calls[i].isExec       = false;
                    calls[i].isConnection = true;
                }
            }
            //添加Call Back
            if (!isExists)
            {
                calls.Add(backInfo);
            }
            // 释放互斥鎖
            WriteMutex.ReleaseMutex();
        }
示例#2
0
        /// <summary>
        /// 移除Call Back信息
        /// </summary>
        public void RemoveCallBack(CallBackInfo backInfo)
        {
            // 申請互斥鎖
            WriteMutex.WaitOne();

            //移除Call Back
            calls.Remove(backInfo);

            // 释放互斥鎖
            WriteMutex.ReleaseMutex();
        }