Skip to content

Commit

Permalink
About box with license info
Browse files Browse the repository at this point in the history
  • Loading branch information
electroly committed Nov 7, 2024
1 parent af4425f commit 72a751c
Show file tree
Hide file tree
Showing 3 changed files with 1,457 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/J.App/J.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyName>Jackpot.App</AssemblyName>
<ApplicationIcon>Resources\App.ico</ApplicationIcon>
<Version>1.0.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -75,6 +76,9 @@
<None Update="Resources\Key.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\License.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\Menu.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
37 changes: 37 additions & 0 deletions src/J.App/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Web;
using J.Core.Data;
Expand All @@ -24,6 +25,7 @@ public sealed partial class MainForm : Form
private readonly ToolStripDropDownButton _menuButton,
_filterButton;
private readonly ToolStripMenuItem _logOutButton,
_aboutButton,
_addToLibraryButton,
_editTagsButton,
_manageMoviesButton,
Expand Down Expand Up @@ -270,6 +272,11 @@ SingleInstanceManager singleInstanceManager
{
_logOutButton.Click += DisconnectButton_Click;
}

_menuButton.DropDownItems.Add(_aboutButton = ui.NewToolStripMenuItem("About Jackpot"));
{
_aboutButton.Click += AboutButton_Click;
}
}

_toolStrip.Items.Add(_browseBackButton = ui.NewToolStripButton("Back"));
Expand Down Expand Up @@ -387,6 +394,36 @@ void MouseHandler()
KeyPreview = true;
}

private void AboutButton_Click(object? sender, EventArgs e)
{
var assembly = typeof(MainForm).Assembly;
var version = assembly.GetName().Version;

TaskDialogPage taskDialogPage =
new()
{
Heading = "Jackpot Media Library",
Caption = "About Jackpot",
Icon = TaskDialogIcon.Information,
Text = $"Version {version}",
};
taskDialogPage.Buttons.Add("License info");
taskDialogPage.Buttons.Add(TaskDialogButton.OK);
taskDialogPage.DefaultButton = taskDialogPage.Buttons[1];
var clicked = TaskDialog.ShowDialog(this, taskDialogPage);
if (clicked == taskDialogPage.Buttons[0])
{
Process
.Start(
new ProcessStartInfo(Path.Combine(AppContext.BaseDirectory, "Resources", "License.html"))
{
UseShellExecute = true,
}
)!
.Dispose();
}
}

protected override void OnShown(EventArgs e)
{
base.OnShown(e);
Expand Down
Loading

0 comments on commit 72a751c

Please sign in to comment.