static bool InitializeApp() { Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); //SplashForm splash = null; if (!IsMono) { SplashForm.Start(); } SplashForm.SetProgress("Loading core...", 0); //if (splash != null) splash.SetCurWork("Loading core..."); Core.IsGUI = true; Core.Instance.CreateWantedDirs(); HSplash.AddModuleInfo += SplashForm.AddModuleInfo; DeletedFileRegistrer.Initialize(); Core.ConfigureLogging(); AsyncTool.MainThread = Thread.CurrentThread; //NodeFactory.RegisterRootCreator(RootTreeNode.CreateRoot); FileTextProvider.LoadStdTexts(); LicenseTool.ReloadLicenses(); UICache.Load(); PluginTools.AddMasterAssembly(Assembly.GetAssembly(typeof(Program))); PluginTools.LoadPlugins(SplashForm.LoadPluginCallback); SplashForm.SetProgress(Texts.Get("s_loading_configuration"), 80); //AddonLibrary.ReloadLibs(); GlobalSettings.Initialize(); InternetSettings.Initialize(); Texts.Language = GlobalSettings.Pages.General().Language; HSettings.CallLoaded(); if (CheckAutoUpdate.Run(SplashForm.EnsureNoSplash)) { Environment.Exit(0); return(true); } Core.RunAutoInstall(); Core.CopyDefaultData(); UsageStats.OnStart(); Favorites.OnStart(); //SendUsageForm.UploadIfNeeded(SplashForm.EnsureNoSplash); SplashForm.SetProgress(Texts.Get("s_creating_main_window"), 100); Logging.Info("Starting DatAdmin GUI"); return(false); }
static void FinalizeApp() { UICache.Save(); UsageStats.OnFinish(); Favorites.OnFinish(); Logging.Info("Ending DatAdmin GUI"); Logging.QuitLogging(); Core.FinalizeApp(); if (Core.ExecuteAfterFinalize != null) { System.Diagnostics.Process.Start(Core.ExecuteAfterFinalize); } }
public static void Load() { try { Instance = (UICache)XmlTool.DeserializeObject(Filename); if (Instance.ItemsForLoading.Count > 0 && Instance.Items.Count == 0) { Instance.ItemsForXml = Instance.ItemsForLoading; Instance.ItemsForLoading.Clear(); } } catch (Exception) { Instance = new UICache(); } }