コード例 #1
0
        public LoadingScreen(
            Point loadingScreenLocation,
            Size loadingScreenSize,
            string barType,
            bool isFullScreenButtonVisible)
        {
            Logger.Info("LoadingScreen({0})", (object)loadingScreenSize);
            this.SetImageDir();
            this.LoadImages();
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
            this.Location  = loadingScreenLocation;
            this.Size      = loadingScreenSize;
            this.BackColor = Color.FromArgb(35, 147, 213);
            this.appLogo   = new Label();
            Logger.Info("Using splash logo");
            this.appLogo.BackgroundImage = this.splashLogoImage;
            this.appLogo.Width           = this.appLogo.BackgroundImage.Width;
            this.appLogo.Height          = this.appLogo.BackgroundImage.Height;
            this.appLogo.BackColor       = Color.Transparent;
            this.installDir = RegistryStrings.InstallDir;
            string str = "LoadingScreenAppTitle";

            if (str.StartsWith("DynamicText"))
            {
                this.mLstDynamicString = new List <string>((IEnumerable <string>)str.Split(new char[1]
                {
                    ';'
                }, StringSplitOptions.RemoveEmptyEntries));
                if (this.mLstDynamicString.Count > 0)
                {
                    this.mLstDynamicString.Remove("DynamicText");
                    System.Timers.Timer timer = new System.Timers.Timer(5000.0);
                    timer.Elapsed += new ElapsedEventHandler(this.TimerElapsed);
                    str            = this.mLstDynamicString[0];
                    timer.Start();
                }
            }
            this.appNameText.Text        = str;
            this.appNameText.TextAlign   = ContentAlignment.MiddleCenter;
            this.appNameText.Width       = loadingScreenSize.Width;
            this.appNameText.Height      = 50;
            this.appNameText.UseMnemonic = false;
            this.appNameText.ForeColor   = Color.White;
            this.appNameText.BackColor   = Color.Transparent;
            LoadingScreen.StatusText statusText = new LoadingScreen.StatusText();
            statusText.TextAlign   = ContentAlignment.MiddleCenter;
            statusText.Width       = loadingScreenSize.Width;
            statusText.Height      = 40;
            statusText.UseMnemonic = false;
            statusText.ForeColor   = Color.White;
            statusText.BackColor   = Color.Transparent;
            this.statusText        = (Label)statusText;
            LoadingScreen.NewProgressBar newProgressBar = new LoadingScreen.NewProgressBar(barType);
            newProgressBar.Width  = 336;
            newProgressBar.Height = 10;
            newProgressBar.Value  = 0;
            this.progressBar      = newProgressBar;
            if (barType == "Marquee")
            {
                this.progressTimer = new System.Windows.Forms.Timer()
                {
                    Interval = 50
                };
                this.progressTimer.Tick += (EventHandler)((obj, evt) => this.progressBar.Invalidate());
                this.progressTimer.Start();
            }
            Label label1 = new Label();

            label1.BackgroundImage       = this.whiteLogoImage;
            label1.BackgroundImageLayout = ImageLayout.Stretch;
            label1.Width     = 48;
            label1.Height    = 44;
            label1.BackColor = Color.Transparent;
            this.whiteLogo   = label1;
            Label label2 = new Label();

            label2.BackgroundImage       = this.closeButtonImage;
            label2.BackgroundImageLayout = ImageLayout.Stretch;
            label2.Width             = 24;
            label2.Height            = 24;
            label2.BackColor         = Color.Transparent;
            this.closeButton         = label2;
            this.closeButton.Click  += (EventHandler)((obj, evt) => VMWindow.Instance.Close());
            this.closeButton.Visible = false;
            Label label3 = new Label();

            label3.BackgroundImage       = this.fullScreenButtonImage;
            label3.BackgroundImageLayout = ImageLayout.Stretch;
            label3.Width                 = 24;
            label3.Height                = 24;
            label3.BackColor             = Color.Transparent;
            this.fullScreenButton        = label3;
            this.fullScreenButton.Click += (EventHandler)((obj, evt) =>
            {
                LayoutManager.ToggleFullScreen();
                this.FullScreenToggled();
            });
            if (!isFullScreenButtonVisible)
            {
                this.fullScreenButton.Visible = false;
            }
            this.SetLocations();
            this.Controls.Add((Control)this.appLogo);
            this.Controls.Add((Control)this.appNameText);
            this.Controls.Add((Control)this.progressBar);
            this.Controls.Add((Control)this.statusText);
            this.Controls.Add((Control)this.whiteLogo);
            this.Controls.Add((Control)this.closeButton);
            this.Controls.Add((Control)this.fullScreenButton);
            this.whiteLogo.Visible = false;
        }