Esempio n. 1
0
        public void TimerProc(object sender, EventArgs e)
        {
            try
            {
                string tianTiUri = CoreInterface.GetRuntimeVariable(RuntimeVariableNames.TianTiUri, null);
                if (RemoteServiceUri != tianTiUri)
                {
                    RemoteServiceUri = tianTiUri;
                }

                ITianTiService kuaFuService = GetKuaFuService();
                if (null != kuaFuService)
                {
                    if (ClientInfo.ClientId > 0)
                    {
                        List <KuaFuServerInfo> dict = kuaFuService.GetKuaFuServerInfoData(ServerInfoAsyncAge);
                        if (null != dict && dict.Count > 0)
                        {
                            lock (Mutex)
                            {
                                ServerIdServerInfoDict.Clear();
                                bool first = true;
                                foreach (var item in dict)
                                {
                                    ServerIdServerInfoDict[item.ServerId] = item;
                                    if (first)
                                    {
                                        first = false;
                                        ServerInfoAsyncAge = item.Age;
                                    }
                                    if (ClientInfo.ServerId == item.ServerId)
                                    {
                                        LocalServerFlags = item.Flags;
                                    }
                                }
                            }
                        }

                        //同步数据
                        AsyncDataItem[] items = kuaFuService.GetClientCacheItems(ClientInfo.ServerId);
                        if (null != items && items.Length > 0)
                        {
                            //ThreadPool.QueueUserWorkItem(new WaitCallback(ExecuteEventCallBackAsync), items);
                            ExecuteEventCallBackAsync(items);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                ResetKuaFuService();
            }
        }