Add About dialog and app metadata
This commit is contained in:
101
AboutWindow.xaml
Normal file
101
AboutWindow.xaml
Normal file
@@ -0,0 +1,101 @@
|
||||
<Window x:Class="TaskbarLauncher.AboutWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="About Taskbar Launcher"
|
||||
Height="410"
|
||||
Width="560"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
Background="{DynamicResource AppWindowBrush}"
|
||||
Foreground="{DynamicResource AppTextBrush}">
|
||||
<Grid Margin="22">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="96"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Width="76"
|
||||
Height="76"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource AppAccentBrush}"
|
||||
Background="{DynamicResource AppSurfaceBrush}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top">
|
||||
<Grid>
|
||||
<TextBlock Text="MGET"
|
||||
FontSize="22"
|
||||
FontWeight="Bold"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource AppAccentBrush}"/>
|
||||
<Border Height="8"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="{DynamicResource AppAccentBrush}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||
<TextBlock Text="Taskbar Launcher" FontSize="24" FontWeight="SemiBold"/>
|
||||
<TextBlock Text="Portable Windows launcher for folders, apps, and organized menus."
|
||||
Margin="0,6,0,0"
|
||||
Foreground="{DynamicResource AppMutedTextBrush}"
|
||||
TextWrapping="Wrap"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="1"
|
||||
Margin="0,22,0,18"
|
||||
Padding="14"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource AppBorderBrush}"
|
||||
Background="{DynamicResource AppSurfaceBrush}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="Author" FontWeight="SemiBold" Margin="0,0,12,10"/>
|
||||
<TextBlock x:Name="AuthorText" Grid.Column="1" Margin="0,0,0,10"/>
|
||||
|
||||
<TextBlock Text="Version" Grid.Row="1" FontWeight="SemiBold" Margin="0,0,12,10"/>
|
||||
<TextBlock x:Name="VersionText" Grid.Row="1" Grid.Column="1" Margin="0,0,0,10"/>
|
||||
|
||||
<TextBlock Text="Build" Grid.Row="2" FontWeight="SemiBold" Margin="0,0,12,10"/>
|
||||
<TextBlock x:Name="BuildText" Grid.Row="2" Grid.Column="1" Margin="0,0,0,10"/>
|
||||
|
||||
<TextBlock Text="Config" Grid.Row="3" FontWeight="SemiBold" Margin="0,0,12,10"/>
|
||||
<TextBlock x:Name="ConfigPathText"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,0,10"
|
||||
TextWrapping="Wrap"/>
|
||||
|
||||
<TextBlock Text="Project Site" Grid.Row="4" FontWeight="SemiBold" Margin="0,0,12,0"/>
|
||||
<TextBlock x:Name="ProjectSiteText"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="Open Config Folder" Click="OpenConfigFolder_Click" Margin="0,0,8,0"/>
|
||||
<Button Content="Close" Click="Close_Click"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
49
AboutWindow.xaml.cs
Normal file
49
AboutWindow.xaml.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using TaskbarLauncher.Services;
|
||||
|
||||
namespace TaskbarLauncher;
|
||||
|
||||
public partial class AboutWindow : Window
|
||||
{
|
||||
public AboutWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
AuthorText.Text = AppInfo.Author;
|
||||
VersionText.Text = AppInfo.Version;
|
||||
BuildText.Text = AppInfo.Build;
|
||||
ConfigPathText.Text = ConfigService.ConfigPath;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(AppInfo.GiveawaySiteUrl))
|
||||
{
|
||||
ProjectSiteText.Text = "Project giveaway site link will be added after review.";
|
||||
}
|
||||
else
|
||||
{
|
||||
ProjectSiteText.Text = AppInfo.GiveawaySiteUrl;
|
||||
ProjectSiteText.Cursor = System.Windows.Input.Cursors.Hand;
|
||||
ProjectSiteText.MouseLeftButtonUp += (_, _) => OpenUrl(AppInfo.GiveawaySiteUrl);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OpenUrl(string url)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = url,
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
|
||||
private void OpenConfigFolder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ConfigService.OpenConfigFolder();
|
||||
}
|
||||
|
||||
private void Close_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
<Button Content="Restore Config" Click="RestoreConfig_Click" Margin="0,0,8,0"/>
|
||||
<Button Content="Reload Config" Click="ReloadConfig_Click" Margin="0,0,8,0"/>
|
||||
<Button Content="Open Config Folder" Click="OpenConfigFolder_Click" Margin="0,0,8,0"/>
|
||||
<Button Content="About" Click="About_Click" Margin="0,0,8,0"/>
|
||||
<Button Content="Close" Click="Close_Click"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Windows.Forms;
|
||||
using System.Windows.Media;
|
||||
using System.IO;
|
||||
using System.Windows.Input;
|
||||
using System.Reflection;
|
||||
using TaskbarLauncher.Models;
|
||||
using TaskbarLauncher.Services;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
@@ -35,7 +34,7 @@ public partial class MainWindow : Window
|
||||
DisplayModeBox.ItemsSource = Enum.GetValues<LauncherDisplayMode>();
|
||||
ItemDisplayModeBox.ItemsSource = Enum.GetValues<LauncherDisplayMode>();
|
||||
TypeBox.ItemsSource = Enum.GetValues<LauncherItemType>();
|
||||
VersionText.Text = $"Version {GetAppVersion()}";
|
||||
VersionText.Text = $"Version {AppInfo.Version} Build {AppInfo.Build}";
|
||||
RefreshView();
|
||||
}
|
||||
|
||||
@@ -68,13 +67,6 @@ public partial class MainWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetAppVersion()
|
||||
{
|
||||
return Assembly.GetExecutingAssembly()
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
|
||||
.InformationalVersion ?? "development";
|
||||
}
|
||||
|
||||
private static TreeViewItem CreateTreeItem(LauncherItem item)
|
||||
{
|
||||
var treeItem = new TreeViewItem { Header = $"{item.Title} ({item.Type})", Tag = item };
|
||||
@@ -701,6 +693,16 @@ public partial class MainWindow : Window
|
||||
ConfigService.OpenConfigFolder();
|
||||
}
|
||||
|
||||
private void About_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AboutWindow aboutWindow = new()
|
||||
{
|
||||
Owner = this
|
||||
};
|
||||
|
||||
aboutWindow.ShowDialog();
|
||||
}
|
||||
|
||||
private void Close_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Hide();
|
||||
|
||||
18
Services/AppInfo.cs
Normal file
18
Services/AppInfo.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace TaskbarLauncher.Services;
|
||||
|
||||
public static class AppInfo
|
||||
{
|
||||
public const string ProductName = "Taskbar Launcher";
|
||||
public const string Author = "Ray Berezowski";
|
||||
public const string GiveawaySiteUrl = "";
|
||||
|
||||
public static string Version =>
|
||||
Assembly.GetExecutingAssembly()
|
||||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
|
||||
.InformationalVersion ?? "development";
|
||||
|
||||
public static string Build =>
|
||||
Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "development";
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public sealed class LauncherController : IDisposable
|
||||
private NotifyIcon? notifyIcon;
|
||||
private LauncherPopup? popup;
|
||||
private MainWindow? settingsWindow;
|
||||
private AboutWindow? aboutWindow;
|
||||
|
||||
public LauncherConfig Config { get; private set; } = new();
|
||||
|
||||
@@ -38,6 +39,20 @@ public sealed class LauncherController : IDisposable
|
||||
settingsWindow.Activate();
|
||||
}
|
||||
|
||||
public void ShowAbout()
|
||||
{
|
||||
if (aboutWindow?.IsVisible == true)
|
||||
{
|
||||
aboutWindow.Activate();
|
||||
return;
|
||||
}
|
||||
|
||||
aboutWindow = new AboutWindow();
|
||||
aboutWindow.Closed += (_, _) => aboutWindow = null;
|
||||
aboutWindow.Show();
|
||||
aboutWindow.Activate();
|
||||
}
|
||||
|
||||
public void TogglePopup()
|
||||
{
|
||||
if (popup?.IsVisible == true)
|
||||
@@ -83,6 +98,7 @@ public sealed class LauncherController : IDisposable
|
||||
notifyIcon.DoubleClick += (_, _) => TogglePopup();
|
||||
notifyIcon.ContextMenuStrip.Items.Add("Open Launcher", null, (_, _) => TogglePopup());
|
||||
notifyIcon.ContextMenuStrip.Items.Add("Settings", null, (_, _) => ShowSettings());
|
||||
notifyIcon.ContextMenuStrip.Items.Add("About", null, (_, _) => ShowAbout());
|
||||
notifyIcon.ContextMenuStrip.Items.Add("Reload Config", null, (_, _) => ReloadConfig());
|
||||
notifyIcon.ContextMenuStrip.Items.Add("Open Config Folder", null, (_, _) => ConfigService.OpenConfigFolder());
|
||||
notifyIcon.ContextMenuStrip.Items.Add("Exit", null, (_, _) => System.Windows.Application.Current.Shutdown());
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);bin\**;obj\**;builds\**;_*\**;..\TaskbarLauncher-build\**</DefaultItemExcludes>
|
||||
<Authors>Ray Berezowski</Authors>
|
||||
<Version>1.0.0</Version>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<FileVersion>1.0.0.0</FileVersion>
|
||||
|
||||
Reference in New Issue
Block a user