public void ConnectAsync(Action<IWebserviceResult> callback)
 {
     var requestInfo = new AsyncRequestInfo("ConnectAsnyc", callback);
     WebserviceState = WebserviceWrapperState.Connecting;
     Webservice.LoginAsync(UserName, Password, requestInfo);
 }
 private void InvokeAsyncRequestCallback(AsyncRequestInfo asyncRequestInfo, string result, Exception exception)
 {
     InvokeAsyncRequestCallback(asyncRequestInfo, new object[] {true, result}, exception);
 }
 public void WritePriceAsync(PriceWebsiteDescription description, Action<IWebserviceResult> callback)
 {
     var asyncRequestInfo = new AsyncRequestInfo("WritePriceAsync", callback);
     Webservice.writePriceAsync(description.Valor, description.LastUpdated, description.Bid, description.Ask,
                                asyncRequestInfo);
 }
        private static void InvokeAsyncRequestCallback(AsyncRequestInfo asyncRequestInfo, object[] objects,
                                                       Exception exception)
        {
            if (exception != null)
            {
                throw new NotImplementedException("Unknown exception occurred.", exception);
            }

            if (asyncRequestInfo == null)
            {
                throw new NullReferenceException("asyncRequestInfo was null.");
            }

            asyncRequestInfo.Callback(new WebserviceResult(asyncRequestInfo, objects));
        }
 public void DisconnectAsync(Action<IWebserviceResult> callback)
 {
     var requestInfo = new AsyncRequestInfo("DisconnectAsync", callback);
     WebserviceState = WebserviceWrapperState.Disconnecting;
     Webservice.LogoutAsync(requestInfo);
     WebserviceState = WebserviceWrapperState.Disconnected;
 }