private static SplashScreen CreateSplashScreen() { SplashScreen result = new SplashScreen { ScaleToFullscreen = true, FadeInDuration = TimeSpan.FromMilliseconds(300), FadeOutDuration = TimeSpan.FromMilliseconds(200), SplashBackgroundImage = Image.FromFile(Path.Combine( Path.GetDirectoryName(Application.ExecutablePath), "MP2 Client Splashscreen.jpg")) }; return result; }
private static SplashScreen CreateSplashScreen() { StartupSettings startupSettings = ServiceRegistration.Get<ISettingsManager>().Load<StartupSettings>(); string startupPath = Path.GetDirectoryName(Application.ExecutablePath); List<string> testFileNames = new List<string>(); if (!string.IsNullOrEmpty(startupSettings.AlternativeSplashScreen)) testFileNames.Add(startupSettings.AlternativeSplashScreen); testFileNames.Add("MP2 Client Splashscreen.jpg"); Image image = null; foreach (string testFileName in testFileNames) { try { string fileName = Path.Combine(startupPath, testFileName); image = Image.FromFile(fileName); break; } catch (Exception ex) { ServiceRegistration.Get<ILogger>().Error("SplashScreen: Error loading startup image '{0}'", ex, testFileName); } } SplashScreen result = new SplashScreen { StartupScreen = startupSettings.StartupScreenNum, ScaleToFullscreen = true, FadeInDuration = TimeSpan.FromMilliseconds(300), FadeOutDuration = TimeSpan.FromMilliseconds(200), SplashBackgroundImage = image }; return result; }