Ejemplo n.º 1
0
 public static void Show(NotifyType t, int screen, Settings.ScreenAnchor anchor, Tools.BackgroundPatcher.PatchEventArgs pe)
 {
     Show(new formNotify(t, screen, anchor, pe));
 }
Ejemplo n.º 2
0
        private formNotify(NotifyType t, int screen, Settings.ScreenAnchor anchor, Tools.BackgroundPatcher.PatchEventArgs pe)
            : this(t, screen, anchor)
        {
            labelBuild.Text = string.Format(labelBuild.Text, pe.Build);

            switch (t)
            {
            case NotifyType.PatchReady:

                var    elapsed = pe.Elapsed;
                string _elapsed;
                if (elapsed.TotalMinutes >= 1)
                {
                    int m = (int)elapsed.TotalMinutes;
                    _elapsed = m + "m";
                    if (elapsed.Seconds > 0)
                    {
                        _elapsed += " " + elapsed.Seconds + "s";
                    }
                }
                else
                {
                    _elapsed = elapsed.Seconds + "s";
                }

                labelTitle.Text   = "Patch ready";
                labelSize.Text    = string.Format(labelSize.Text, pe.Files, Util.Text.FormatBytes(pe.Size), pe.Files != 1 ? "files" : "file");
                labelElapsed.Text = string.Format(labelElapsed.Text, _elapsed);

                labelBuild.Visible          = true;
                labelBuildCaption.Visible   = true;
                labelElapsed.Visible        = true;
                labelElapsedCaption.Visible = true;
                labelSize.Visible           = true;
                labelSizeCaption.Visible    = true;
                labelTitle.Visible          = true;

                break;

            case NotifyType.DownloadingFiles:

                labelTitle.Text        = "Downloading";
                labelElapsed.Text      = "(estimated)";
                labelElapsed.ForeColor = Color.DimGray;
                labelSize.Text         = string.Format(labelSize.Text, pe.Files, Util.Text.FormatBytes(pe.Size), pe.Files != 1 ? "files" : "file");

                labelBuild.Visible        = true;
                labelBuildCaption.Visible = true;
                labelElapsed.Visible      = true;
                labelSize.Visible         = true;
                labelSizeCaption.Visible  = true;
                labelTitle.Visible        = true;

                break;

            case NotifyType.DownloadingManifests:

                labelTitle.Text    = "Downloading build " + labelBuild.Text;
                labelTitle.Visible = true;

                this.Height       = labelTitle.Location.Y * 2 + labelTitle.Height;
                this.SizeChanged += formNotify_SizeChanged;

                break;

            case NotifyType.Error:

                labelTitle.Text    = "Failed to download update";
                labelTitle.Visible = true;

                this.Height       = labelTitle.Location.Y * 2 + labelTitle.Height;
                this.SizeChanged += formNotify_SizeChanged;

                break;
            }

            Initialize(t);
        }