コード例 #1
0
        public DrupalSessionObject UserLogin(string username, string password)
        {
            this.InitRequest();
            DrupalSessionObject res = default(DrupalSessionObject);

            try {
                res = drupalServiceSystem.UserLogin(username, password);
            } catch (Exception ex) {
                this.HandleException(ex, "UserLogin");
            }
            return(res);
        }
コード例 #2
0
        // public event DrupalAsyncCompletedEventHandler<...> SystemSetVariableCompleted;
        // public event DrupalAsyncCompletedEventHandler<...> SystemDelVariableCompleted;

        /// <summary>
        /// Returns the details of currently logged in user.
        /// </summary>
        /// <returns>Object with session id, session name and a user object.</returns>
        public DrupalSessionObject SystemConnect()
        {
            this.InitRequest();
            DrupalSessionObject res = default(DrupalSessionObject);

            try {
                res = drupalServiceSystem.SystemConnect();
            } catch (Exception ex) {
                this.HandleException(ex, "SystemConnect");
            }
            return(res);
        }
コード例 #3
0
 public bool Logout()
 {
     _isLoggedIn = _isLoggedIn && !this.UserLogout();
     if (_isLoggedIn)
     {
         this.HandleException(new Exception("Unable to logout."), "Logout");
     }
     else
     {
         _sessionData = default(DrupalSessionObject);
     }
     return(!_isLoggedIn);
 }
コード例 #4
0
        public bool Login(string username, string password)
        {
            _username = username;
            _password = password;

            _sessionData = this.UserLogin(_username, _password);
            _isLoggedIn  = (_sessionData.user.name == _username);
            if (!_isLoggedIn)
            {
                this.HandleException(new Exception("Unable to login."), "Login");
            }
            return(_isLoggedIn);
        }
コード例 #5
0
 void OnUserLoginCompleted(IAsyncResult asyncResult)
 {
     if (this.UserLoginCompleted != null)
     {
         var clientResult           = (XmlRpcAsyncResult)asyncResult;
         DrupalSessionObject result = default(DrupalSessionObject);
         try {
             result = ((IServiceSystem)clientResult.ClientProtocol).EndUserLogin(asyncResult);
             this.UserLoginCompleted(this, new DrupalAsyncCompletedEventArgs <DrupalSessionObject>(result, null, asyncResult.AsyncState));
         } catch (Exception ex) {
             this.UserLoginCompleted(this, new DrupalAsyncCompletedEventArgs <DrupalSessionObject>(result, ex, asyncResult.AsyncState));
         }
     }
 }