Esempio n. 1
0
        private void Initialize()
        {
            // No status at first
            SetStatusText(string.Empty);

            // Initialize the version text to the executing assembly's
            _version.Text   = String.Format(SplashScreenSettings.Default.VersionTextFormat, ProductInformation.GetVersion(true, true, true));
            _copyright.Text = ProductInformation.Copyright;
            _license.Text   = ProductInformation.License;

            // Make the window completely transparent
            Opacity = 0;

            // Set the manifest warning.
            _manifest.Visible = !ManifestVerification.Valid;

            // Apply any splash screen settings, if requested
            if (SplashScreenSettings.Default.UseSplashScreenSettings)
            {
                this.SuspendLayout();

                try
                {
                    var stream = SplashScreen.OpenSplashImageResourceStream();
                    if (stream != null)
                    {
                        // GDI+ resource management quirk: don't dispose the source stream (or create an independent copy of the bitmap)
                        BackgroundImage = new Bitmap(stream);
                        ClientSize      = BackgroundImage.Size;
                    }
                }
                catch (Exception ex)
                {
                    Platform.Log(LogLevel.Warn, ex, "Failed to resolve splash screen resources.");
                }

                this._status.Visible   = SplashScreenSettings.Default.StatusVisible;
                this._status.Location  = SplashScreenSettings.Default.StatusLocation;
                this._status.Size      = SplashScreenSettings.Default.StatusSize;
                this._status.AutoSize  = SplashScreenSettings.Default.StatusAutoSize;
                this._status.ForeColor = SplashScreenSettings.Default.StatusForeColor;
                this._status.Font      = SplashScreenSettings.Default.StatusFontBold ? new Font(this._status.Font, FontStyle.Bold) : this._status.Font;
                this._status.TextAlign = SplashScreenSettings.Default.StatusTextAlign;

                this._copyright.Visible   = SplashScreenSettings.Default.CopyrightVisible;
                this._copyright.Location  = SplashScreenSettings.Default.CopyrightLocation;
                this._copyright.Size      = SplashScreenSettings.Default.CopyrightSize;
                this._copyright.AutoSize  = SplashScreenSettings.Default.CopyrightAutoSize;
                this._copyright.ForeColor = SplashScreenSettings.Default.CopyrightForeColor;
                this._copyright.Font      = SplashScreenSettings.Default.CopyrightFontBold ? new Font(this._copyright.Font, FontStyle.Bold) : this._copyright.Font;
                this._copyright.TextAlign = SplashScreenSettings.Default.CopyrightTextAlign;

                this._version.Visible   = SplashScreenSettings.Default.VersionVisible;
                this._version.Location  = SplashScreenSettings.Default.VersionLocation;
                this._version.Size      = SplashScreenSettings.Default.VersionSize;
                this._version.AutoSize  = SplashScreenSettings.Default.VersionAutoSize;
                this._version.ForeColor = SplashScreenSettings.Default.VersionForeColor;
                this._version.Font      = SplashScreenSettings.Default.VersionFontBold ? new Font(this._version.Font, FontStyle.Bold) : this._version.Font;
                this._version.TextAlign = SplashScreenSettings.Default.VersionTextAlign;

                this._license.Visible   = SplashScreenSettings.Default.LicenseVisible;
                this._license.Location  = SplashScreenSettings.Default.LicenseLocation;
                this._license.Size      = SplashScreenSettings.Default.LicenseSize;
                this._license.AutoSize  = SplashScreenSettings.Default.LicenseAutoSize;
                this._license.ForeColor = SplashScreenSettings.Default.LicenseForeColor;
                this._license.Font      = SplashScreenSettings.Default.LicenseFontBold ? new Font(this._license.Font, FontStyle.Bold) : this._license.Font;
                this._license.TextAlign = SplashScreenSettings.Default.LicenseTextAlign;

                this._manifest.Location  = SplashScreenSettings.Default.ManifestLocation;
                this._manifest.Size      = SplashScreenSettings.Default.ManifestSize;
                this._manifest.AutoSize  = SplashScreenSettings.Default.ManifestAutoSize;
                this._manifest.ForeColor = SplashScreenSettings.Default.ManifestForeColor;
                this._manifest.Font      = SplashScreenSettings.Default.ManifestFontBold ? new Font(this._manifest.Font, FontStyle.Bold) : this._manifest.Font;
                this._manifest.TextAlign = SplashScreenSettings.Default.ManifestTextAlign;

                this._pluginIconsRectangle = SplashScreenSettings.Default.PluginIconsRectangle;
                this._nextIconPositionX    = _pluginIconsRectangle.Left + IconPaddingX / 2;
                this._nextIconPositionY    = _pluginIconsRectangle.Top;

                this.ResumeLayout();
            }
        }