Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* 1161 feature request a proper about box #1186

Merged
merged 4 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documents/Help/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## 2024-11-xx - Build 2411 - November 2024
* Resolved [#1176](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1176), KryptonProgressBar: small values escape drawing area
* Resolved [#1169](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1169), Button Spec Krypton Context Menu (Canary)
* Implemented [#1161](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1161), A proper about box
* New adjusting the size of a `KryptonComboBox` also changes the `DropDownWidth`
- Note: The `DropDownWidth` can still be set independently from the `Size` property
* Resolved [#1091](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1091), Krypton File Dialogs Missing Buttons
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#region BSD License
/*
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2023 - 2023. All rights reserved.
*
*/
#endregion

namespace Krypton.Toolkit
{
/// <summary>The public interface to the <see cref="VisualKryptonAboutBoxForm"/> class.</summary>
[ToolboxItem(false)]
[DesignerCategory(@"code")]
public static class KryptonAboutBox
{
#region Implementation

/// <summary>Shows a new <see cref="VisualKryptonAboutBoxForm"/>.</summary>
/// <param name="aboutBoxData">The data to pass through.</param>
/// <returns>A new <see cref="VisualKryptonAboutBoxForm"/> with the specified data.</returns>
public static DialogResult Show(KryptonAboutBoxData aboutBoxData)
=> ShowCore(aboutBoxData);

#endregion

#region Implementation

private static DialogResult ShowCore(KryptonAboutBoxData aboutBoxData)
{
using var kab = new VisualKryptonAboutBoxForm(aboutBoxData);

return kab.ShowDialog();
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,9 @@ public static class KryptonAboutToolkit
{
#region Implementation

//// <summary>Shows a new <see cref="KryptonAboutToolkitForm"/>.</summary>
//// <param name="data">The data to pass through.</param>
//// <returns>A new <see cref="KryptonAboutToolkitForm"/> with the specified data.</returns>
//public static DialogResult Show(KryptonAboutToolkitData data)
// => ShowCore(data.HeaderText, data.GeneralInformationWelcomeText, data.GeneralInformationLicenseText,
// data.GeneralInformationLearnMoreText, data.CurrentThemeText, data.DiscordText,
// data.RepositoryInformationText, data.DownloadDocumentationText, data.DownloadDemosText,
// data.FileNameColumnHeaderText, data.VersionColumnHeaderText, data.ToolBarGeneralInformationText,
// data.ToolBarDiscordText, data.ToolBarDeveloperInformationText, data.ToolBarVersionInformationText,
// data.LearnMoreLinkArea, data.DiscordLinkArea, data.RepositoryInformationLinkArea,
// data.DownloadDemosLinkArea, data.DocumentationLinkArea, data.ToolkitType,
// data.ShowDiscordButton, data.ShowDeveloperInformationButton,
// data.ShowVersionInformationButton,
// data.ShowThemeOptions, data.ShowSystemInformationButton);

/// <summary>Shows a new <see cref="KryptonAboutToolkitForm"/>.</summary>
/// <summary>Shows a new <see cref="VisualKryptonAboutToolkitForm"/>.</summary>
/// <param name="aboutToolkitData">The data to pass through.</param>
/// <returns>A new <see cref="KryptonAboutToolkitForm"/> with the specified data.</returns>
/// <returns>A new <see cref="VisualKryptonAboutToolkitForm"/> with the specified data.</returns>
public static DialogResult Show(KryptonAboutToolkitData aboutToolkitData)
=> ShowCore(aboutToolkitData);

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
#region BSD License
/*
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2023 - 2023. All rights reserved.
*
*/
#endregion

namespace Krypton.Toolkit
{
internal partial class VisualKryptonAboutBoxForm : KryptonForm
{
#region Instance Fields

private readonly KryptonAboutBoxData _aboutBoxData;

#endregion

#region Identity

public VisualKryptonAboutBoxForm(KryptonAboutBoxData aboutBoxData)
{
InitializeComponent();

_aboutBoxData = aboutBoxData;

Startup(_aboutBoxData);

kbtnOk.Text = KryptonManager.Strings.GeneralStrings.OK;

kbtnSystemInformation.Text = KryptonManager.Strings.CustomStrings.SystemInformation;
}

#endregion

#region Implementation

private void Startup(KryptonAboutBoxData aboutBoxData)
{
khgMain.ValuesPrimary.Image =
aboutBoxData.HeaderImage ?? GenericImageResources.InformationSmall;

khgMain.ValuesPrimary.Heading =
$@"{KryptonManager.Strings.AboutBoxStrings.About} {aboutBoxData.ApplicationName}";

pbxImage.Image = aboutBoxData.MainImage ?? GenericImageResources.InformationMedium;

kwlCurrentTheme.Text = $@"{KryptonManager.Strings.CustomStrings.CurrentTheme}:";

// ToDo: Review
UpdateVersionLabel($"{KryptonManager.Strings.AboutBoxStrings.Version}: {KryptonAboutBoxUtilities.GetFileVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion}");

if (aboutBoxData.UseFullBuiltOnDate != null || aboutBoxData.UseFullBuiltOnDate == false)
{
UpdateBuiltOnLabel($"{KryptonManager.Strings.AboutBoxStrings.BuildDate}: {KryptonAboutBoxUtilities.AssemblyBuildDate(Assembly.GetExecutingAssembly(), true).ToString("F")}");
}
else
{
UpdateBuiltOnLabel($"{KryptonManager.Strings.AboutBoxStrings.BuildDate}: {KryptonAboutBoxUtilities.AssemblyBuildDate(Assembly.GetExecutingAssembly(), true)}");
}

UpdateCopyrightLabel($"{KryptonManager.Strings.AboutBoxStrings.Copyright}: {KryptonAboutBoxUtilities.GetFileVersionInfo(Assembly.GetExecutingAssembly().Location).LegalCopyright}");

UpdateDescription(KryptonAboutBoxUtilities.GetFileVersionInfo(Assembly.GetEntryAssembly()!.Location).FileDescription);

kryptonWrapLabel5.Text = null;
}

private void UpdateDescription(string fileDescription) => krtbDescription.Text = fileDescription;

private void UpdateCopyrightLabel(string value) => kwlCopyright.Text = value;

private void UpdateBuiltOnLabel(string value) => kwlBuiltOn.Text = value;

private void UpdateVersionLabel(string value) => kwlVersionLabel.Text = value;

private void kbtnOk_Click(object sender, EventArgs e) => Hide();

private void kbtnSystemInformation_Click(object sender, EventArgs e) => KryptonAboutBoxUtilities.LaunchSystemInformation();

private void tsbtnGeneralInformation_Click(object sender, EventArgs e) => SwitchAboutBoxPage(AboutBoxPage.GeneralInformation);

private void tsbtnDescription_Click(object sender, EventArgs e) => SwitchAboutBoxPage(AboutBoxPage.Description);

private void tsbtnFileInformation_Click(object sender, EventArgs e) => SwitchAboutBoxPage(AboutBoxPage.FileInformation);

private void tsbtnTheme_Click(object sender, EventArgs e) => SwitchAboutBoxPage(AboutBoxPage.Theme);

private void tsbtnApplicationDetails_Click(object sender, EventArgs e) => SwitchFileInformationPage(AboutBoxFileInformationPage.Application);

private void tsbtnAssembliesDetails_Click(object sender, EventArgs e) => SwitchFileInformationPage(AboutBoxFileInformationPage.Assemblies);

private void tsbtnAssemblyDetails_Click(object sender, EventArgs e) => SwitchFileInformationPage(AboutBoxFileInformationPage.AssemblyDetails);

private void SwitchFileInformationPage(AboutBoxFileInformationPage page)
{
switch (page)
{
case AboutBoxFileInformationPage.Application:
tsbtnFileInformation.Checked = true;

kpnlApplication.Visible = true;

tsbtnAssembliesDetails.Checked = false;

kpnlAssemblies.Visible = false;

tsbtnAssemblyDetails.Checked = false;

kpnlAssemblyDetails.Visible = false;
break;
case AboutBoxFileInformationPage.Assemblies:
tsbtnFileInformation.Checked = false;

kpnlApplication.Visible = false;

tsbtnAssembliesDetails.Checked = true;

kpnlAssemblies.Visible = true;

tsbtnAssemblyDetails.Checked = false;

kpnlAssemblyDetails.Visible = false;
break;
case AboutBoxFileInformationPage.AssemblyDetails:
tsbtnFileInformation.Checked = false;

kpnlApplication.Visible = false;

tsbtnAssembliesDetails.Checked = false;

kpnlAssemblies.Visible = false;

tsbtnAssemblyDetails.Checked = true;

kpnlAssemblyDetails.Visible = true;
break;
default:
throw new ArgumentOutOfRangeException(nameof(page), page, null);
}
}

private void SwitchAboutBoxPage(AboutBoxPage page)
{
switch (page)
{
case AboutBoxPage.GeneralInformation:
tsbtnGeneralInformation.Checked = true;

kpnlGeneralInformation.Visible = true;

tsbtnDescription.Checked = false;

kpnlDescription.Visible = false;

tsbtnFileInformation.Checked = false;

kpnlFileInformation.Visible = false;

tsbtnTheme.Checked = false;

kpnlTheme.Visible = false;
break;
case AboutBoxPage.Description:
tsbtnGeneralInformation.Checked = false;

kpnlGeneralInformation.Visible = false;

tsbtnDescription.Checked = true;

kpnlDescription.Visible = true;

tsbtnFileInformation.Checked = false;

kpnlFileInformation.Visible = false;

tsbtnTheme.Checked = false;

kpnlTheme.Visible = false;
break;
case AboutBoxPage.FileInformation:
tsbtnGeneralInformation.Checked = false;

kpnlGeneralInformation.Visible = false;

tsbtnDescription.Checked = false;

kpnlDescription.Visible = false;

tsbtnFileInformation.Checked = true;

kpnlFileInformation.Visible = true;

tsbtnTheme.Checked = false;

kpnlTheme.Visible = false;
break;
case AboutBoxPage.Theme:
tsbtnGeneralInformation.Checked = false;

kpnlGeneralInformation.Visible = false;

tsbtnDescription.Checked = false;

kpnlDescription.Visible = false;

tsbtnFileInformation.Checked = false;

kpnlFileInformation.Visible = false;

tsbtnTheme.Checked = true;

kpnlTheme.Visible = true;
break;
default:
throw new ArgumentOutOfRangeException(nameof(page), page, null);
}
}

#endregion
}
}
Loading