Esempio n. 1
0
 /// <summary>
 /// 同步方法
 /// </summary>
 /// <param name="clientId"></param>
 /// <returns></returns>
 private static List <UserData> GetUsers()
 {
     try {
         DataRequest <Guid?> request = new DataRequest <Guid?> {
             Data = NTMinerRegistry.GetClientId()
         };
         using (HttpClient client = RpcRoot.Create()) {
             client.Timeout = TimeSpan.FromSeconds(2);
             Task <HttpResponseMessage>      getHttpResponse = client.PostAsJsonAsync($"http://{NTMinerRegistry.GetControlCenterHost()}:{NTKeyword.ControlCenterPort.ToString()}/api/ControlCenter/Users", request);
             DataResponse <List <UserData> > response        = getHttpResponse.Result.Content.ReadAsAsync <DataResponse <List <UserData> > >().Result;
             if (response != null && response.Data != null)
             {
                 return(response.Data);
             }
         }
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
     }
     return(new List <UserData>());
 }