private void CloseSplashScreen() { using (ResidentInstance instance = new ResidentInstance()) { if (!instance.IsFirstInstance) { IServerCommand serverCommand = (IServerCommand)Activator.GetObject(typeof(IServerCommand), "ipc://OpenSAGELauncherChannel/ServerCommand"); serverCommand.CloseSplash(); } } }
public App() : base() { Exit += new ExitEventHandler(ExecuteExit); GlobalData current = GlobalData.Current; #if DEBUG current.NoUpdate = true; #endif CommandLineOptionProcessor processor = new CommandLineOptionProcessor(current); try { processor.ProcessOptions(Environment.GetCommandLineArgs()); } catch (OpenSAGEException ex) { System.Windows.MessageBox.Show(ex.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit((int)ErrorCode.CommandLineVerification); } _instance = new ResidentInstance(); if (_instance.IsFirstInstance) { _instance.Initialize(); } else { System.Windows.MessageBox.Show("Only one instance can run at the same time.", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit((int)ErrorCode.MultiInstance); } RegistryKey regKey = Registry.CurrentUser.OpenSubKey(GlobalData.RegPathBase, true); if (regKey == null) { regKey = Registry.CurrentUser.CreateSubKey(GlobalData.RegPathBase); } object result = regKey.GetValue(GlobalData.RegValueInstallPath); if (result == null) { string installPath = Assembly.GetExecutingAssembly().Location; installPath = Path.GetDirectoryName(installPath); regKey.SetValue(GlobalData.RegValueInstallPath, installPath); current.InstallPath = installPath; } else { current.InstallPath = result as string; } result = regKey.GetValue(GlobalData.RegValueUserDataLeafName); if (result == null) { regKey.SetValue(GlobalData.RegValueUserDataLeafName, GlobalData.DefaultUserDataLeafName); current.UserDataLeafName = GlobalData.DefaultUserDataLeafName; } else { current.UserDataLeafName = result as string; } LanguageLoader.LoadLanguage(); if (current.UI) { StartupUri = new Uri("pack://application:,,,/UIScreen.xaml"); } else { StartupUri = new Uri("pack://application:,,,/SplashScreen.xaml"); } }