private void EVSdkWrapper_EventLoginSucceed(ManagedEVSdk.Structs.EVUserInfoCli userInfo) { log.InfoFormat("EventLoginSucceed, username:{0}, token:{1}", userInfo.username, userInfo.token); LoginToken = userInfo.token; DisplayName = userInfo.displayName; Username = userInfo.username; UserId = userInfo.userId; LoginUserInfo = userInfo; if (LoginStatus.LoggingIn == CurrentLoginStatus) { log.InfoFormat("Login succeed and current login status is LoggingIn. It should download avatar."); // update avatar string avatarPath = Utils.GetCurrentAvatarPath(); try { if (File.Exists(avatarPath)) { log.Info("Current avatar file is existed and delete it for the new one."); UpdateAvatarBmp(null); File.Delete(avatarPath); } } catch (Exception e) { log.InfoFormat("Failed to delete avatar, exception:{0}", e); } DownloadLoginUserAvatar(); } CurrentLoginStatus = (LoginStatus.AnonymousLoggingIn == CurrentLoginStatus || LoginStatus.AnonymousLoggedIn == CurrentLoginStatus) ? LoginStatus.AnonymousLoggedIn : LoginStatus.LoggedIn; log.InfoFormat("Login successfully. Set login status to {0}.Domain address={1}, username={2}, token={3}", CurrentLoginStatus, _serverDomainAddress, Username, LoginToken); Utils.SetIsConfRunning(false); Utils.SetRunningConfId(""); if (!IsUrlLoginMode) { LoginSuccessToSaveData(_serverDomainAddress); if (LoginStatus.AnonymousLoggedIn == CurrentLoginStatus) { Utils.SetServerPort((int)_domainPort); Utils.SetUseHttps(_useHttps); } else { Utils.SetPassword(ServiceType, LoginPassword); Utils.SetUserName(ServiceType, userInfo.username); } } _loginResetEvent.Set(); Application.Current.Dispatcher.InvokeAsync(() => { ProgressDialogLogin.Instance.Hide(); LoginWindow.Activate(); }); log.Info("EventLoginSucceed end"); }
public void GetUserInfo(ref ManagedEVSdk.Structs.EVUserInfoCli userinfo) { _log.Info("GetUserInfo"); int rst = this.EVSdkWrapper.EVEngineGetUserInfo(ref userinfo); if ((int)ManagedEVSdk.ErrorInfo.EV_ERROR_CLI.EV_OK != rst) { _log.InfoFormat("Failed to GetUserInfo, result:{0}", rst); userinfo = null; } _log.Info("GetUserInfo done"); }