Example #1
0
        private async void Login(object para)
        {
            ServerInfo serverinfo = para as ServerInfo;

            if (serverinfo == null)
            {
                return;
            }

            try
            {
                if (new LoginManage().Login(_loginUserService.InitLoginServer(serverinfo)))
                {
                    Status = ViewModelStatus.Querying;
                    //把登录配置保存到本地
                    _localConfiguration.WriteServerInfo(ServerInfo);
                    await _loginUserService.SetUserLogin();

                    _eventAggregator.GetEvent <LoginEvent>().Publish(_loginUserService.LoginInfo);

                    //加载数据
                }
            }
            catch (Exception ex)
            {
                _eventAggregator.GetEvent <ThrowExceptionEvent>().Publish(Tuple.Create <string, Exception>("登录异常", ex));
            }
            finally
            {
                Status = ViewModelStatus.None;
            }
        }