private async void OnUploadNode_Callback(object sate)
        {
            mUploadNodeTimer.Change(-1, -1);
            try
            {
                var info = await NodeSourceHandler.Load();

                if (info.Version != mLastClusterInfo.Version)
                {
                    mLastClusterInfo = info;
                    UpdateNodeInfo(info);
                }
                UpdateSuccess = true;
                UpdateExption = null;
            }
            catch (Exception e_)
            {
                UpdateSuccess = false;
                UpdateExption = e_;
            }
            finally
            {
                mUploadNodeTimer.Change(NodeSourceHandler.UpdateTime * 1000, NodeSourceHandler.UpdateTime * 1000);
            }
        }
Esempio n. 2
0
 public async Task<HttpClusterApi> LoadNodeSource()
 {
     if (NodeSourceHandler != null)
     {
         var info = await NodeSourceHandler.Load();
         UpdateNodeInfo(info);
         mLastClusterInfo = info;
         mUploadNodeTimer = new System.Threading.Timer(OnUploadNode_Callback, null, NodeSourceHandler.UpdateTime * 1000, NodeSourceHandler.UpdateTime * 1000);
     }
     return this;
 }