Exemple #1
0
        private void GenerateChangelog(Changelog change)
        {
            pnlChangelog.Controls.Clear();

            int count = 0;
            int left  = 10;
            int top   = 4;

            string[] options = { "added", "changed", "deprecated", "removed", "fixed", "security", "misc" };
            foreach (string option in options)
            {
                bool first = true;
                foreach (ChangelogChange part in change.Changes.FindAll(c => c.Type.ToLower() == option.ToLower()))
                {
                    if (first)
                    {
                        top += 10;

                        Label title = new Label();
                        title.Name      = "lblSectionTitle" + count;
                        title.Text      = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(option);
                        title.ForeColor = Color.FromArgb(69, 69, 69);
                        title.BackColor = Color.Transparent;
                        title.TextAlign = ContentAlignment.TopLeft;
                        title.Location  = new Point(left, top);
                        title.Size      = new Size(550, 25);
                        title.Font      = new Font("Segoe UI", 14F, FontStyle.Regular);
                        pnlChangelog.Controls.Add(title);

                        top  += 25;
                        first = false;
                    }

                    Label desc = new Label();
                    desc.Name      = "lblChangeTitle" + count;
                    desc.Text      = "  ● " + part.Title;
                    desc.ForeColor = Color.FromArgb(69, 69, 69);
                    desc.BackColor = Color.Transparent;
                    desc.TextAlign = ContentAlignment.TopLeft;
                    desc.Location  = new Point(left, top);
                    desc.Size      = new Size(560, 26);
                    desc.Font      = new Font("Segoe UI", 10F, FontStyle.Regular);
                    pnlChangelog.Controls.Add(desc);

                    top += 26;

                    count++;
                }
            }
        }
Exemple #2
0
        private void GenerateVersionInfo(string version)
        {
            int r = 100;
            int g = 100;
            int b = 100;

            pnlVersion.Controls.Clear();

            Changelog change = changelog.Find(c => c.Version == version);

            Label title = new Label();

            title.Name      = "lblVersionTitle";
            title.Text      = "v" + change.Version + " - " + change.Title;
            title.ForeColor = Color.FromArgb(r, g, b);
            title.BackColor = Color.Transparent;
            title.TextAlign = ContentAlignment.TopLeft;
            title.Location  = new Point(10, 1);
            title.Size      = new Size(570, 29);
            title.Font      = new Font("Segoe UI", 16F, FontStyle.Regular);
            pnlVersion.Controls.Add(title);

            Label desc = new Label();

            desc.Name      = "lblVersionDesc";
            desc.Text      = change.Description;
            desc.ForeColor = Color.FromArgb(r, g, b);
            desc.BackColor = Color.Transparent;
            desc.TextAlign = ContentAlignment.TopLeft;
            desc.Location  = new Point(10, 31);
            desc.Size      = new Size(568, 26);
            desc.Font      = new Font("Segoe UI", 8.25F, FontStyle.Regular);
            pnlVersion.Controls.Add(desc);

            Label author = new Label();

            author.Name      = "lblVersionAuthor";
            author.Text      = "Author: " + change.Author;
            author.ForeColor = Color.FromArgb(r, g, b);
            author.BackColor = Color.Transparent;
            author.TextAlign = ContentAlignment.TopLeft;
            author.Location  = new Point(10, 75);
            author.Size      = new Size(181, 13);
            author.Font      = new Font("Segoe UI", 8.25F, FontStyle.Regular);
            pnlVersion.Controls.Add(author);

            Label date = new Label();

            date.Name      = "lblVersionDate";
            date.Text      = "Version Date: " + change.VersionDate;
            date.ForeColor = Color.FromArgb(r, g, b);
            date.BackColor = Color.Transparent;
            date.TextAlign = ContentAlignment.TopLeft;
            date.Location  = new Point(300, 75);
            date.Size      = new Size(181, 13);
            date.Font      = new Font("Segoe UI", 8.25F, FontStyle.Regular);
            pnlVersion.Controls.Add(date);

            Point prevLoc = new Point(10, 62);
            int   count   = 0;

            foreach (string tag in change.Tags.Split(','))
            {
                Label lbl = new Label();
                lbl.Name      = "lblTag" + count;
                lbl.Text      = tag;
                lbl.ForeColor = Color.White;
                lbl.BackColor = FindTagColour(tag.Replace(" ", "").ToLower());
                lbl.TextAlign = ContentAlignment.TopLeft;
                lbl.Location  = prevLoc;
                lbl.AutoSize  = true;
                lbl.Font      = new Font("Segoe UI", 7F, FontStyle.Bold);
                pnlVersion.Controls.Add(lbl);

                prevLoc = new Point(lbl.Location.X + lbl.Size.Width + 5, lbl.Location.Y);

                count++;
            }

            GenerateChangelog(change);
        }