internal void SendRequest(RestRequestArgs args, Action<XElement> success, Failed failed)
        {
            if (args == null)
                throw new ArgumentNullException("args");
            if (success == null)
                throw new ArgumentNullException("success");
            if (failed == null)
                throw new ArgumentNullException("failed");

            // create a request state...
            RequestState state = new RequestState()
            {
                Owner = this,
                Args = args,
                Success = success,
                Failed = failed
            };

            // are we authenticated?  if we're not, we need to call that first...
            if (!(IsAuthenticated))
            {
                // call the authenticate routine, and ask it to call the state we just setup
                // if authentication works...
                ApiService.Authenticate(new Action(state.DoRequest), failed);
            }
            else
            {
                // call the method directly...
                state.DoRequest();
            }
        }
Ejemplo n.º 2
0
        internal void SendRequest(RestRequestArgs args, Action <XElement> success, Failed failed)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            if (success == null)
            {
                throw new ArgumentNullException("success");
            }
            if (failed == null)
            {
                throw new ArgumentNullException("failed");
            }

            // create a request state...
            RequestState state = new RequestState()
            {
                Owner   = this,
                Args    = args,
                Success = success,
                Failed  = failed
            };

            // are we authenticated?  if we're not, we need to call that first...
            if (!(IsAuthenticated))
            {
                // call the authenticate routine, and ask it to call the state we just setup
                // if authentication works...
                ApiService.Authenticate(new Action(state.DoRequest), failed);
            }
            else
            {
                // call the method directly...
                state.DoRequest();
            }
        }