示例#1
0
 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
 }
示例#2
0
        private void MainUI_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (Provider.SysUser == null)
            {
                return;
            }
            string exitDetail = myCommonLocalizer.GetLocalizedString(MyCommonStringId.MainUI_Exit);
            string exitText   = myCommonLocalizer.GetLocalizedString(MyCommonStringId.MainUI_ExitDetail);

            if (XtraMessageBox.Show(exitText, exitDetail, MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                e.Cancel = true;
                return;
            }
            try
            {
                //SaveSkin to Database
                SharedFunc.TipError(myCommonLocalizer.GetLocalizedString(MyCommonStringId.MainUI_Exit_Succeed), myCommonLocalizer.GetLocalizedString(MyCommonStringId.MainUI_Exit_SucceedDetail));
                sys_User.User_Skin = UserLookAndFeel.Default.ActiveSkinName;
                BaseService.ExecuteAsync("SystemUser_Skin", sys_User);
            }
            catch //(Exception ex)
            {
                //SharedFunc.RaiseError(ex);
            }
            try
            {
                //SaveSkin to Cache
                List <Sys_Login> LoginInfos = CacheHelper.Get <List <Sys_Login> >("SysLogin");
                Sys_Login        loginInfo  = LoginInfos.Find(l => l.UserName.Equals(sys_User.User_Name));
                if (loginInfo != null)
                {
                    loginInfo.SkinName = UserLookAndFeel.Default.ActiveSkinName;
                    CacheHelper.SetAsync(LoginInfos, "SysLogin");
                }
            }
            catch //(Exception ex)
            {
                //SharedFunc.RaiseError(ex);
            }
        }