コード例 #1
0
        private void ExecuteLoginCommand()
        {
            Message = null;
            IsBusy  = true;

            Action act = () =>
            {
                if (RememberPassword || AutoLogin)
                {
                    IsolatedStorageHelper.Save(LocalData.Transfer(this));
                }
                else if (!RememberPassword)
                {
                    IsolatedStorageHelper.Delete <LocalData>();
                }

                CommunicateManager.Invoke <ILoginService>(p =>
                {
                    var token           = p.Login(Num, LoginName, LoginPwd);
                    LoginInfo.Token     = token;
                    LoginInfo.Code      = Num.Trim();
                    LoginInfo.Account   = LoginName.Trim();
                    LoginInfo.Guid      = Guid.NewGuid();
                    LoginInfo.IsLogined = true;
                    //登录成功
                    IsLogined = true;
                }, ShowErr);
            };

            Task.Factory.StartNew(act).ContinueWith(task =>
            {
                CommunicateManager.StartPushMessage();
                InvokeSetBusy(false);
            });
        }