diff --git a/Source/LibationAvalonia/Dialogs/AboutDialog.axaml b/Source/LibationAvalonia/Dialogs/AboutDialog.axaml index a6ef19ab..faaa5da2 100644 --- a/Source/LibationAvalonia/Dialogs/AboutDialog.axaml +++ b/Source/LibationAvalonia/Dialogs/AboutDialog.axaml @@ -2,9 +2,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d" d:DesignWidth="450" d:DesignHeight="520" - MinWidth="450" MinHeight="520" - Width="450" Height="520" + mc:Ignorable="d" d:DesignWidth="450" d:DesignHeight="540" + MinWidth="450" MinHeight="540" + Width="450" Height="540" x:Class="LibationAvalonia.Dialogs.AboutDialog" xmlns:controls="clr-namespace:LibationAvalonia.Controls" Title="About Libation"> @@ -41,39 +41,38 @@ + + + - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/Source/LibationAvalonia/Dialogs/AboutDialog.axaml.cs b/Source/LibationAvalonia/Dialogs/AboutDialog.axaml.cs index cbcd7d99..cbb6de11 100644 --- a/Source/LibationAvalonia/Dialogs/AboutDialog.axaml.cs +++ b/Source/LibationAvalonia/Dialogs/AboutDialog.axaml.cs @@ -5,6 +5,7 @@ using LibationFileManager; using LibationUiBase; using ReactiveUI; using System; +using System.Collections.Generic; using System.Threading.Tasks; namespace LibationAvalonia.Dialogs @@ -48,11 +49,11 @@ namespace LibationAvalonia.Dialogs } } - private void Link_GithubUser(object sender, Avalonia.Input.TappedEventArgs e) + private void ContributorLink_Tapped(object sender, Avalonia.Input.TappedEventArgs e) { - if (sender is LinkLabel lbl) + if (sender is LinkLabel lbl && lbl.DataContext is LibationContributor contributor) { - Dinah.Core.Go.To.Url($"ht" + $"tps://github.com/{lbl.Text.Replace('.','-')}"); + Dinah.Core.Go.To.Url(contributor.Link.AbsoluteUri); } } @@ -72,6 +73,9 @@ namespace LibationAvalonia.Dialogs private bool canCheckForUpgrade = true; private string upgradeButtonText = "Check for Upgrade"; + public IEnumerable PrimaryContributors => LibationContributor.PrimaryContributors; + public IEnumerable AdditionalContributors => LibationContributor.AdditionalContributors; + public AboutVM() { Version = $"Libation {AppScaffolding.LibationScaffolding.Variety} v{AppScaffolding.LibationScaffolding.BuildVersion}"; diff --git a/Source/LibationUiBase/LibationContributor.cs b/Source/LibationUiBase/LibationContributor.cs new file mode 100644 index 00000000..3ddf77b0 --- /dev/null +++ b/Source/LibationUiBase/LibationContributor.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; + +namespace LibationUiBase; + +public enum LibationContributorType +{ + Contributor, + Collaborator, + Creator +} + +public class LibationContributor +{ + public string Name { get; } + public LibationContributorType Type { get; } + public Uri Link { get; } + + public static IEnumerable PrimaryContributors + => Contributors.Where(c => c.Type is LibationContributorType.Creator or LibationContributorType.Collaborator); + public static IEnumerable AdditionalContributors + => Contributors.Where(c => c.Type is LibationContributorType.Contributor); + + public static IReadOnlyList Contributors { get; } + = new ReadOnlyCollection([ + GitHubUser("rmcrackan", LibationContributorType.Creator), + GitHubUser("Mbucari", LibationContributorType.Collaborator), + GitHubUser("pixil98"), + GitHubUser("hutattedonmyarm"), + GitHubUser("seanke"), + GitHubUser("wtanksleyjr"), + GitHubUser("Dr.Blank"), + GitHubUser("CharlieRussel"), + GitHubUser("cbordeman"), + GitHubUser("jwillikers"), + GitHubUser("Shuvashish76"), + GitHubUser("RokeJulianLockhart"), + GitHubUser("maaximal"), + GitHubUser("muchtall"), + GitHubUser("ScubyG"), + GitHubUser("patienttruth"), + GitHubUser("stickystyle") + ]); + + private LibationContributor(string name, LibationContributorType type,Uri link) + { + Name = name; + Type = type; + Link = link; + } + + private static LibationContributor GitHubUser(string name, LibationContributorType type = LibationContributorType.Contributor) + => new LibationContributor(name, type, new Uri($"ht" + $"tps://github.com/{name.Replace('.', '-')}")); +} diff --git a/Source/LibationWinForms/Dialogs/AboutDialog.Designer.cs b/Source/LibationWinForms/Dialogs/AboutDialog.Designer.cs index 7647b822..cc934781 100644 --- a/Source/LibationWinForms/Dialogs/AboutDialog.Designer.cs +++ b/Source/LibationWinForms/Dialogs/AboutDialog.Designer.cs @@ -40,15 +40,8 @@ label2 = new System.Windows.Forms.Label(); label1 = new System.Windows.Forms.Label(); flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - linkLabel4 = new System.Windows.Forms.LinkLabel(); - linkLabel2 = new System.Windows.Forms.LinkLabel(); - linkLabel3 = new System.Windows.Forms.LinkLabel(); - linkLabel1 = new System.Windows.Forms.LinkLabel(); - linkLabel5 = new System.Windows.Forms.LinkLabel(); - linkLabel6 = new System.Windows.Forms.LinkLabel(); ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); groupBox1.SuspendLayout(); - flowLayoutPanel1.SuspendLayout(); SuspendLayout(); // // pictureBox1 @@ -65,7 +58,7 @@ // releaseNotesLbl // releaseNotesLbl.AutoSize = true; - releaseNotesLbl.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + releaseNotesLbl.Font = new System.Drawing.Font("Segoe UI", 11F); releaseNotesLbl.Location = new System.Drawing.Point(12, 12); releaseNotesLbl.Name = "releaseNotesLbl"; releaseNotesLbl.Size = new System.Drawing.Size(171, 20); @@ -77,7 +70,7 @@ // checkForUpgradeBtn // checkForUpgradeBtn.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - checkForUpgradeBtn.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + checkForUpgradeBtn.Font = new System.Drawing.Font("Segoe UI", 10F); checkForUpgradeBtn.Location = new System.Drawing.Point(12, 54); checkForUpgradeBtn.Name = "checkForUpgradeBtn"; checkForUpgradeBtn.Size = new System.Drawing.Size(410, 31); @@ -90,7 +83,7 @@ // getLibationLbl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; getLibationLbl.AutoSize = true; - getLibationLbl.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + getLibationLbl.Font = new System.Drawing.Font("Segoe UI", 11F); getLibationLbl.Location = new System.Drawing.Point(245, 12); getLibationLbl.Name = "getLibationLbl"; getLibationLbl.Size = new System.Drawing.Size(162, 20); @@ -103,7 +96,7 @@ // rmcrackanLbl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; rmcrackanLbl.AutoSize = true; - rmcrackanLbl.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + rmcrackanLbl.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold); rmcrackanLbl.Location = new System.Drawing.Point(6, 19); rmcrackanLbl.Name = "rmcrackanLbl"; rmcrackanLbl.Padding = new System.Windows.Forms.Padding(0, 3, 0, 3); @@ -111,13 +104,13 @@ rmcrackanLbl.TabIndex = 8; rmcrackanLbl.TabStop = true; rmcrackanLbl.Text = "rmcrackan"; - rmcrackanLbl.LinkClicked += Link_GithubUser; + rmcrackanLbl.LinkClicked += ContributorLabel_LinkClicked; // // MBucariLbl // MBucariLbl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; MBucariLbl.AutoSize = true; - MBucariLbl.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point); + MBucariLbl.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold); MBucariLbl.Location = new System.Drawing.Point(6, 40); MBucariLbl.Name = "MBucariLbl"; MBucariLbl.Padding = new System.Windows.Forms.Padding(0, 3, 0, 3); @@ -125,7 +118,7 @@ MBucariLbl.TabIndex = 9; MBucariLbl.TabStop = true; MBucariLbl.Text = "Mbucari"; - MBucariLbl.LinkClicked += Link_GithubUser; + MBucariLbl.LinkClicked += ContributorLabel_LinkClicked; // // groupBox1 // @@ -147,7 +140,7 @@ // label3 // label3.AutoSize = true; - label3.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + label3.Font = new System.Drawing.Font("Segoe UI", 10F); label3.Location = new System.Drawing.Point(92, 43); label3.Name = "label3"; label3.Padding = new System.Windows.Forms.Padding(0, 0, 0, 3); @@ -158,7 +151,7 @@ // label4 // label4.AutoSize = true; - label4.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + label4.Font = new System.Drawing.Font("Segoe UI", 10F); label4.Location = new System.Drawing.Point(92, 22); label4.Name = "label4"; label4.Padding = new System.Windows.Forms.Padding(0, 0, 0, 3); @@ -169,7 +162,7 @@ // label2 // label2.AutoSize = true; - label2.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + label2.Font = new System.Drawing.Font("Segoe UI", 10F); label2.Location = new System.Drawing.Point(92, 22); label2.Name = "label2"; label2.Padding = new System.Windows.Forms.Padding(0, 0, 0, 3); @@ -189,101 +182,11 @@ // flowLayoutPanel1 // flowLayoutPanel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - flowLayoutPanel1.Controls.Add(linkLabel4); - flowLayoutPanel1.Controls.Add(linkLabel2); - flowLayoutPanel1.Controls.Add(linkLabel3); - flowLayoutPanel1.Controls.Add(linkLabel1); - flowLayoutPanel1.Controls.Add(linkLabel5); - flowLayoutPanel1.Controls.Add(linkLabel6); flowLayoutPanel1.Location = new System.Drawing.Point(6, 100); flowLayoutPanel1.Name = "flowLayoutPanel1"; flowLayoutPanel1.Size = new System.Drawing.Size(398, 66); flowLayoutPanel1.TabIndex = 10; // - // linkLabel4 - // - linkLabel4.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - linkLabel4.AutoSize = true; - linkLabel4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - linkLabel4.Location = new System.Drawing.Point(3, 0); - linkLabel4.Name = "linkLabel4"; - linkLabel4.Padding = new System.Windows.Forms.Padding(0, 3, 0, 3); - linkLabel4.Size = new System.Drawing.Size(41, 21); - linkLabel4.TabIndex = 9; - linkLabel4.TabStop = true; - linkLabel4.Text = "pixil98"; - linkLabel4.LinkClicked += Link_GithubUser; - // - // linkLabel2 - // - linkLabel2.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - linkLabel2.AutoSize = true; - linkLabel2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - linkLabel2.Location = new System.Drawing.Point(50, 0); - linkLabel2.Name = "linkLabel2"; - linkLabel2.Padding = new System.Windows.Forms.Padding(0, 3, 0, 3); - linkLabel2.Size = new System.Drawing.Size(104, 21); - linkLabel2.TabIndex = 9; - linkLabel2.TabStop = true; - linkLabel2.Text = "hutattedonmyarm"; - linkLabel2.LinkClicked += Link_GithubUser; - // - // linkLabel3 - // - linkLabel3.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - linkLabel3.AutoSize = true; - linkLabel3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - linkLabel3.Location = new System.Drawing.Point(160, 0); - linkLabel3.Name = "linkLabel3"; - linkLabel3.Padding = new System.Windows.Forms.Padding(0, 3, 0, 3); - linkLabel3.Size = new System.Drawing.Size(43, 21); - linkLabel3.TabIndex = 9; - linkLabel3.TabStop = true; - linkLabel3.Text = "seanke"; - linkLabel3.LinkClicked += Link_GithubUser; - // - // linkLabel1 - // - linkLabel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - linkLabel1.AutoSize = true; - linkLabel1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - linkLabel1.Location = new System.Drawing.Point(209, 0); - linkLabel1.Name = "linkLabel1"; - linkLabel1.Padding = new System.Windows.Forms.Padding(0, 3, 0, 3); - linkLabel1.Size = new System.Drawing.Size(66, 21); - linkLabel1.TabIndex = 9; - linkLabel1.TabStop = true; - linkLabel1.Text = "wtanksleyjr"; - linkLabel1.LinkClicked += Link_GithubUser; - // - // linkLabel5 - // - linkLabel5.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - linkLabel5.AutoSize = true; - linkLabel5.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - linkLabel5.Location = new System.Drawing.Point(281, 0); - linkLabel5.Name = "linkLabel5"; - linkLabel5.Padding = new System.Windows.Forms.Padding(0, 3, 0, 3); - linkLabel5.Size = new System.Drawing.Size(51, 21); - linkLabel5.TabIndex = 9; - linkLabel5.TabStop = true; - linkLabel5.Text = "Dr.Blank"; - linkLabel5.LinkClicked += Link_GithubUser; - // - // linkLabel6 - // - linkLabel6.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; - linkLabel6.AutoSize = true; - linkLabel6.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - linkLabel6.Location = new System.Drawing.Point(3, 21); - linkLabel6.Name = "linkLabel6"; - linkLabel6.Padding = new System.Windows.Forms.Padding(0, 3, 0, 3); - linkLabel6.Size = new System.Drawing.Size(77, 21); - linkLabel6.TabIndex = 9; - linkLabel6.TabStop = true; - linkLabel6.Text = "CharlieRussel"; - linkLabel6.LinkClicked += Link_GithubUser; - // // AboutDialog // AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -301,8 +204,6 @@ ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); groupBox1.ResumeLayout(false); groupBox1.PerformLayout(); - flowLayoutPanel1.ResumeLayout(false); - flowLayoutPanel1.PerformLayout(); ResumeLayout(false); PerformLayout(); } @@ -317,15 +218,9 @@ private System.Windows.Forms.LinkLabel MBucariLbl; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Label label1; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - private System.Windows.Forms.LinkLabel linkLabel1; - private System.Windows.Forms.LinkLabel linkLabel4; - private System.Windows.Forms.LinkLabel linkLabel2; - private System.Windows.Forms.LinkLabel linkLabel3; - private System.Windows.Forms.LinkLabel linkLabel5; - private System.Windows.Forms.LinkLabel linkLabel6; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.Label label2; } } \ No newline at end of file diff --git a/Source/LibationWinForms/Dialogs/AboutDialog.cs b/Source/LibationWinForms/Dialogs/AboutDialog.cs index 85ba4746..e1dbe072 100644 --- a/Source/LibationWinForms/Dialogs/AboutDialog.cs +++ b/Source/LibationWinForms/Dialogs/AboutDialog.cs @@ -1,5 +1,6 @@ using LibationUiBase; using System; +using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; @@ -13,10 +14,29 @@ namespace LibationWinForms.Dialogs this.SetLibationIcon(); releaseNotesLbl.Text = $"Libation {AppScaffolding.LibationScaffolding.Variety} v{AppScaffolding.LibationScaffolding.BuildVersion}"; + rmcrackanLbl.Tag = LibationContributor.PrimaryContributors.Single(c => c.Name == rmcrackanLbl.Text); + MBucariLbl.Tag = LibationContributor.PrimaryContributors.Single(c => c.Name == MBucariLbl.Text); + + foreach (var contributor in LibationContributor.AdditionalContributors) + { + var label = new LinkLabel { Tag = contributor, Text = contributor.Name, AutoSize = true }; + label.LinkClicked += ContributorLabel_LinkClicked; + flowLayoutPanel1.Controls.Add(label); + } + var toolTip = new ToolTip(); toolTip.SetToolTip(releaseNotesLbl, "View Release Notes"); } + private void ContributorLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + if (sender is LinkLabel lbl && lbl.Tag is LibationContributor contributor) + { + Dinah.Core.Go.To.Url(contributor.Link.AbsoluteUri); + e.Link.Visited = true; + } + } + private void releaseNotesLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) => Dinah.Core.Go.To.Url($"{AppScaffolding.LibationScaffolding.RepositoryUrl}/releases/tag/v{AppScaffolding.LibationScaffolding.BuildVersion.ToString(3)}"); @@ -50,13 +70,5 @@ namespace LibationWinForms.Dialogs private void getLibationLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) => Dinah.Core.Go.To.Url(AppScaffolding.LibationScaffolding.WebsiteUrl); - - private void Link_GithubUser(object sender, LinkLabelLinkClickedEventArgs e) - { - if (sender is LinkLabel lbl) - { - Dinah.Core.Go.To.Url($"ht" + $"tps://github.com/{lbl.Text.Replace('.', '-')}"); - } - } } }