public CustomSplashScreenNew(Pref pref) { InitializeComponent(); // set new values here this.TextBlockAuthors.Text = pref.Authors; this.TextBlockLicenses.Text = pref.LicenseShort; this.TextBlockVersion.Text = pref.Version; this.TextBlockBuildDate.Text = ""; // try to include plug-ins as well var lic = Plugins.CompileAllLicenses(); if (lic != null && lic.shortLicense != null && lic.shortLicense.Length > 0) { this.TextBlockLicenses.Text += "\n" + lic.shortLicense; } // Timer var timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromMilliseconds(Options.Curr.SplashTime < 0 ? 8000 : Options.Curr.SplashTime); timer.IsEnabled = true; timer.Tick += (object sender, EventArgs e) => { this.Close(); }; }
private void Application_Startup(object sender, StartupEventArgs e) { // allow long term logging (for report box) Log.Singleton.EnableLongTermStore(); // catch unhandled exceptions SetupExceptionHandling(); // Build up of options Log.Singleton.Info("Application startup."); var exePath = System.Reflection.Assembly.GetEntryAssembly()?.Location; Options.ReplaceCurr(InferOptions(exePath, e.Args)); // search for plugins? if (Options.Curr.PluginDir != null) { var searchDir = System.IO.Path.Combine( System.IO.Path.GetDirectoryName(exePath), Options.Curr.PluginDir); Log.Singleton.Info( "Searching for the plugins in the plugin directory: {0}", searchDir); var pluginDllInfos = Plugins.TrySearchPlugins(searchDir); Log.Singleton.Info( $"Found {pluginDllInfos.Count} plugin(s) in the plugin directory: {searchDir}"); Options.Curr.PluginDll.AddRange(pluginDllInfos); } Log.Singleton.Info( $"Loading and activating {Options.Curr.PluginDll.Count} plugin(s)..."); Plugins.LoadedPlugins = LoadAndActivatePlugins(Options.Curr.PluginDll); // at end, write all default options to JSON? if (Options.Curr.WriteDefaultOptionsFN != null) { // info var fullFilename = System.IO.Path.GetFullPath(Options.Curr.WriteDefaultOptionsFN); Log.Singleton.Info($"Writing resulting options to a JSON file: {fullFilename}"); // retrieve Plugins.TryGetDefaultOptionsForPlugins(Options.Curr.PluginDll, Plugins.LoadedPlugins); OptionsInformation.WriteJson(Options.Curr, fullFilename); } // colors if (true) { var resNames = new[] { "LightAccentColor", "DarkAccentColor", "DarkestAccentColor", "FocusErrorBrush" }; for (int i = 0; i < resNames.Length; i++) { var x = this.FindResource(resNames[i]); if (x != null && x is System.Windows.Media.SolidColorBrush && Options.Curr.AccentColors.ContainsKey((OptionsInformation.ColorNames)i)) { this.Resources[resNames[i]] = AnyUiDisplayContextWpf.GetWpfBrush( Options.Curr.GetColor((OptionsInformation.ColorNames)i)); } } resNames = new[] { "FocusErrorColor" }; for (int i = 0; i < resNames.Length; i++) { var x = this.FindResource(resNames[i]); if (x != null && x is System.Windows.Media.Color && Options.Curr.AccentColors.ContainsKey((OptionsInformation.ColorNames)(3 + i))) { this.Resources[resNames[i]] = AnyUiDisplayContextWpf.GetWpfColor( Options.Curr.GetColor((OptionsInformation.ColorNames)(3 + i))); } } } Pref pref = Pref.Read(); // show splash (required for licenses of open source) if (Options.Curr.SplashTime != 0) { var splash = new CustomSplashScreenNew(pref); splash.Show(); } // show main window MainWindow wnd = new MainWindow(pref); wnd.Show(); }
public AboutBox(Pref pref) { _pref = pref; InitializeComponent(); }