public void GetLatestSnapshots(
     int limit,
     List <string> coinCodes,
     Action <GetCoinSnapshotsResponse> callback)
 {
     Task.Factory.StartNew(() => {
         Guid messageId = Guid.NewGuid();
         try {
             using (var service = CreateService()) {
                 GetCoinSnapshotsRequest request = new GetCoinSnapshotsRequest {
                     MessageId = messageId,
                     LoginName = LoginName,
                     Limit     = limit,
                     CoinCodes = coinCodes,
                     Timestamp = DateTime.Now
                 };
                 request.SignIt(Password);
                 GetCoinSnapshotsResponse response = service.GetLatestSnapshots(request);
                 callback?.Invoke(response);
             }
         }
         catch (CommunicationException e) {
             Global.DebugLine(e.Message, ConsoleColor.Red);
             callback?.Invoke(GetCoinSnapshotsResponse.ClientError(messageId, e.Message));
         }
         catch (Exception e) {
             Global.Logger.Error(e.Message, e);
             callback?.Invoke(GetCoinSnapshotsResponse.ClientError(messageId, e.Message));
         }
     });
 }
Esempio n. 2
0
            public void GetLatestSnapshotsAsync(
                int limit,
                Action <GetCoinSnapshotsResponse, Exception> callback)
            {
                GetCoinSnapshotsRequest request = new GetCoinSnapshotsRequest {
                    LoginName = SingleUser.LoginName,
                    Limit     = limit
                };

                request.SignIt(SingleUser.PasswordSha1);
                PostAsync(SControllerName, nameof(IControlCenterController.LatestSnapshots), null, request, callback);
            }