コード例 #1
0
        public UserEntity Login(string account, string password)
        {
            UserEntity user = default(UserEntity);

            //TODO:这里的逻辑要重写
            if (account.Trim().ToUpper() == "SAGO" && password.Trim().ToUpper() == "123")
            {
                user = new UserEntity()
                {
                    HeadPortrait = new Uri("ms-appx:///Assets/Images/Sago.png"),
                    NickName = "Sago",
                    Signature = "中学为体,西学为用。",
                    IsVIP = true,
                    VIPStatus = 2
                };
            }

            return user;
        }
コード例 #2
0
        public void SaveUserSession(UserEntity user)
        {
            var serializationUtility = new SerializationUtility();

            var userJson = serializationUtility.Serialize<UserEntity>(user);

            //如果已经存在用户信息,那么就更新
            if (ApplicationData.Current.LocalSettings.Values.ContainsKey(LoginService.USERKEY))
            {
                ApplicationData.Current.LocalSettings.Values[LoginService.USERKEY] = userJson;
            }
            else
            {
                ApplicationData.Current.LocalSettings.Values.Add(LoginService.USERKEY, userJson);
            }

            //调用登录状态委托
            if (LoginService.LoginIn != default(LoginInEventHandler))
            {
                LoginService.LoginIn(null, new LoginEventArgs() { IsLoginIn = true, User = user });
            }
        }
コード例 #3
0
 private void LoginSuccess(UserEntity userEntity)
 {
     NavigationUtility.Navigate(typeof(HotNewsPage));
     NavigationUtility.RemoveBackStackEntry(typeof(LoginPage));
     _LoginService.SaveUserSession(userEntity);
 }