SaveUserStatus() публичный статический Метод

public static SaveUserStatus ( UserStatus status ) : void
status UserStatus
Результат void
Пример #1
0
        /// <summary>
        /// Signs in with user email and password and
        /// receives response from DoubanFM server.
        /// </summary>
        /// <param name="email">User email.</param>
        /// <param name="password">User password.</param>
        /// <param name="saveStatus">Indicates if this client should
        /// save user's status when sign-in succeeded.</param>
        /// <returns></returns>
        public LoginResponse Login(string email, string password,
                                   bool saveStatus)
        {
            //Get response via http post.
            var jResp = ConnectionManager.GetPostResponse(
                ConnectionManager.LoginUri,
                new LoginRequestForm(new LoginRequest(email, password)));

            //Create response from json.
            LoginResponse resp = new LoginResponse(jResp);

            if (resp.Result == LoginResult.Success)
            {
                //Update local storage for user status.
                StorageManager.ClearUserStatus();
                _status = new UserStatus()
                {
                    Expire = jResp.expire,
                    Token  = jResp.token,
                    UserID = jResp.user_id
                };

                if (saveStatus)
                {
                    StorageManager.SaveUserStatus(_status);
                }
            }

            return(resp);
        }
Пример #2
0
 /// <summary>
 /// Saves current user sign-in status if exists.
 /// </summary>
 public void SaveStatus()
 {
     if (_status != null)
     {
         StorageManager.SaveUserStatus(_status);
     }
 }