Browse Source

Merge pull request #1106 in BA/design from ~KERRY/design:release/9.0 to release/9.0

* commit 'ddc38b49553fcc22a67203aad228c4a87ae9cba0':
  REPORT-2354 不从后台自动登录,切换环境进行登录
master
superman 7 years ago
parent
commit
299388daa3
  1. 16
      designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java

16
designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java

@ -18,7 +18,9 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.EnvChangedListener;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -45,6 +47,7 @@ public class UserInfoPane extends BasicPane{
private UserInfoLabel userInfoLabel; private UserInfoLabel userInfoLabel;
public UserInfoLabel getUserInfoLabel() { public UserInfoLabel getUserInfoLabel() {
return userInfoLabel; return userInfoLabel;
} }
@ -64,18 +67,15 @@ public class UserInfoPane extends BasicPane{
this.userInfoLabel = new UserInfoLabel(this); this.userInfoLabel = new UserInfoLabel(this);
this.markUnSignIn(); this.markUnSignIn();
autoLogin(); addEnvChangedListener();
autoPushLoginDialog(); autoPushLoginDialog();
this.add(userInfoLabel, BorderLayout.CENTER); this.add(userInfoLabel, BorderLayout.CENTER);
} }
// 后台自动登录 private void addEnvChangedListener(){
private void autoLogin(){ GeneralContext.addEnvChangedListener(new EnvChangedListener() {
Thread bbsAutoLoginThread = new Thread(new Runnable() { public void envChanged() {
@Override
public void run() {
String username = ConfigManager.getProviderInstance().getBbsUsername(); String username = ConfigManager.getProviderInstance().getBbsUsername();
if (StringUtils.isEmpty(username)){ if (StringUtils.isEmpty(username)){
markUnSignIn(); markUnSignIn();
@ -84,9 +84,9 @@ public class UserInfoPane extends BasicPane{
} }
} }
}); });
bbsAutoLoginThread.start();
} }
// 计算xml保存的上次弹框时间和当前时间的时间差 // 计算xml保存的上次弹框时间和当前时间的时间差
private int getDiffFromLastLogin(){ private int getDiffFromLastLogin(){
String lastBBSTime = DesignerEnvManager.getEnvManager().getLastShowBBSTime(); String lastBBSTime = DesignerEnvManager.getEnvManager().getLastShowBBSTime();

Loading…
Cancel
Save