public MainUI() { BonusSkins.Register(); SkinManager.EnableFormSkins(); //UserLookAndFeel.Default.SetSkinStyle("DevExpress Style"); InitializeLocalCache(); #region 用户尝试登录系统 SharedFunc.TryLogin(); sys_User = Provider.SysUser; sw.Restart(); #endregion #region 加载系统主界面 try { #region InitializeComponent Provider.StartupPath = ConfigurationHelper.ReadSetting("StartupPath"); SplashScreenManager.ShowForm(this, typeof(MyWait), false, false, false); InitializeAppearance(); SendSpalsh(10, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_GlobalLocalizer)); //InitializeGlobalConfiguration(); InitializeGlobalLocalizer(); SendSpalsh(20, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_Component)); InitializeComponent(); SkinHelper.InitSkinGalleryDropDown(mySkin); barUserNick.Caption = sys_User.User_Nick; SendSpalsh(50, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_CommonLocalizer)); InitializeCommonLocalizer(); SendSpalsh(60, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_Image)); InitializeImage(); SendSpalsh(80, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_Menu)); InitializeMenu(); SendSpalsh(90, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_Configuration)); InitializeConfiguration(); SendSpalsh(95, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_AutoUpdate)); //InitializeAutoUpdate(); SendSpalsh(100, myCommonLocalizer.GetLocalizedString(MyCommonStringId.Initialize_Finish)); //写日志 SharedFunc.TipError(myCommonLocalizer.GetLocalizedString(MyCommonStringId.Login_Succeed), myCommonLocalizer.GetLocalizedString(MyCommonStringId.Login_SucceedDetail)); //GC.Collect(); #endregion } catch (Exception ex) { SharedFunc.RaiseError(ex); Process.GetCurrentProcess().Kill(); //Application.Exit(); //Environment.Exit(0); } #endregion }
/// <summary> /// 刷新当前登录用户 /// </summary> private void MainUI_Activated(object sender, EventArgs e) { if (BaseService.IsFaulted) { Provider.SysUser = null; } sys_User = Provider.SysUser; if (sys_User != null) { barUserNick.Caption = Provider.SysUser.User_Nick; } else { SharedFunc.TryLogin(); } if (Provider.SysUser == null) { Process.GetCurrentProcess().Kill(); } sys_User = (Sys_User)Provider.SysUser; }