Add About dialog
This commit is contained in:
parent
4a65d6bbd3
commit
8d73f5cc7e
@ -72,7 +72,9 @@
|
|||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
|
|
||||||
<NativeMenu.Menu>
|
<NativeMenu.Menu>
|
||||||
<NativeMenu />
|
<NativeMenu>
|
||||||
|
<NativeMenuItem Header="About Libation" />
|
||||||
|
</NativeMenu>
|
||||||
</NativeMenu.Menu>
|
</NativeMenu.Menu>
|
||||||
|
|
||||||
</Application>
|
</Application>
|
||||||
@ -64,6 +64,33 @@
|
|||||||
M7.2,0.8 a 0.8,0.8 0 0 1 1.6,0 v8 l0.9929,-0.9929 a 0.8,0.8 0 0 1 1.1314,1.1314 l-2.3586,2.3586
|
M7.2,0.8 a 0.8,0.8 0 0 1 1.6,0 v8 l0.9929,-0.9929 a 0.8,0.8 0 0 1 1.1314,1.1314 l-2.3586,2.3586
|
||||||
a 0.8,0.8 0 0 1 -1.1314,0 l-2.3586,-2.3586 a 0.8,0.8 0 0 1 1.1314,-1.1314 l0.9929,0.9929 v8
|
a 0.8,0.8 0 0 1 -1.1314,0 l-2.3586,-2.3586 a 0.8,0.8 0 0 1 1.1314,-1.1314 l0.9929,0.9929 v8
|
||||||
</StreamGeometry>
|
</StreamGeometry>
|
||||||
|
|
||||||
|
<StreamGeometry x:Key="LibationCheersIcon">
|
||||||
|
M139,2
|
||||||
|
A 192,200 0 0 0 103,84
|
||||||
|
A 222,334 41 0 0 241,320
|
||||||
|
V478
|
||||||
|
H160
|
||||||
|
A 16,16 0 0 0 160,510
|
||||||
|
H352
|
||||||
|
A16 16 0 0 0 352,478
|
||||||
|
H271
|
||||||
|
V320
|
||||||
|
A 222,334 -41 0 0 409,84
|
||||||
|
A 192,200 0 0 0 373,2
|
||||||
|
M355,32
|
||||||
|
A 192,200 0 0 1 381,127
|
||||||
|
A 187.5,334 -35 0 1 256,286
|
||||||
|
A 187.5,334 35 0 1 131,127
|
||||||
|
A 192,200 0 0 1 157,32
|
||||||
|
H355
|
||||||
|
M146,147
|
||||||
|
A 168,300 35 0 0 256,270
|
||||||
|
A 168,300 -35 0 0 366,128
|
||||||
|
S 360,50 280,110
|
||||||
|
S 192,128 147,147
|
||||||
|
</StreamGeometry>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Styles.Resources>
|
</Styles.Resources>
|
||||||
</Styles>
|
</Styles>
|
||||||
|
|||||||
@ -2,12 +2,65 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="550" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="450" d:DesignHeight="600"
|
||||||
MinWidth="550" MinHeight="450"
|
MinWidth="450" MinHeight="550"
|
||||||
Width="650" Height="500"
|
Width="450" Height="600"
|
||||||
x:Class="LibationAvalonia.Dialogs.AboutDialog"
|
x:Class="LibationAvalonia.Dialogs.AboutDialog"
|
||||||
xmlns:controls="clr-namespace:LibationAvalonia.Controls"
|
xmlns:controls="clr-namespace:LibationAvalonia.Controls"
|
||||||
Title="About Libation"
|
Title="About Libation"
|
||||||
Icon="/Assets/libation.ico">
|
Icon="/Assets/libation.ico">
|
||||||
Welcome to Avalonia!
|
|
||||||
|
<Grid Margin="10" ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto,Auto,Auto,*">
|
||||||
|
|
||||||
|
<TextBlock Grid.ColumnSpan="2" FontSize="18" FontWeight="Bold" Text="{Binding Version}" />
|
||||||
|
|
||||||
|
<controls:LinkLabel Grid.Column="1" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right" Text="Release Notes" Tapped="ViewReleaseNotes_Tapped"/>
|
||||||
|
|
||||||
|
<Button Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Margin="0,20,0,0" IsEnabled="{Binding CanCheckForUpgrade}" Content="{Binding UpgradeButtonText}" Click="CheckForUpgrade_Click" />
|
||||||
|
|
||||||
|
<Canvas Grid.Row="2" Grid.ColumnSpan="2" Margin="0,30" Width="345" Height="280">
|
||||||
|
<Path Stretch="None" Fill="{DynamicResource IconFill}" Data="{DynamicResource LibationCheersIcon}">
|
||||||
|
<Path.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<RotateTransform Angle="12" />
|
||||||
|
<ScaleTransform ScaleX="0.5" ScaleY="0.5" />
|
||||||
|
<TranslateTransform X="-150" Y="-120" />
|
||||||
|
</TransformGroup>
|
||||||
|
</Path.RenderTransform>
|
||||||
|
</Path>
|
||||||
|
<Path Stretch="None" Fill="{DynamicResource IconFill}" Data="{DynamicResource LibationCheersIcon}">
|
||||||
|
<Path.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<ScaleTransform ScaleX="-1" ScaleY="1" />
|
||||||
|
<RotateTransform Angle="-12" />
|
||||||
|
<ScaleTransform ScaleX="0.5" ScaleY="0.5" />
|
||||||
|
<TranslateTransform X="78" Y="-120" />
|
||||||
|
</TransformGroup>
|
||||||
|
</Path.RenderTransform>
|
||||||
|
</Path>
|
||||||
|
</Canvas>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="3" VerticalAlignment="Center" FontSize="16" FontWeight="Bold" Text="Loaded Assemblies"/>
|
||||||
|
<Button Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" Padding="10,0" Content="Copy to Clopboard" Command="{Binding CopyAssembliesAsync}"/>
|
||||||
|
|
||||||
|
<ListBox Grid.Row="4" Grid.ColumnSpan="2" Margin="0,10,0,0" ItemsSource="{Binding Assemblies}">
|
||||||
|
<ListBox.Styles>
|
||||||
|
<Style Selector="ListBoxItem" >
|
||||||
|
<Setter Property="Padding" Value="0" />
|
||||||
|
<Style Selector="^ > Grid > TextBlock" >
|
||||||
|
<Setter Property="FontSize" Value="11" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
</ListBox.Styles>
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
|
<TextBlock Text="{Binding Name}" />
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding Version}" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@ -1,12 +1,78 @@
|
|||||||
|
using Avalonia.Collections;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using LibationAvalonia.ViewModels;
|
||||||
|
using LibationFileManager;
|
||||||
|
using LibationUiBase;
|
||||||
|
using ReactiveUI;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace LibationAvalonia.Dialogs
|
namespace LibationAvalonia.Dialogs
|
||||||
{
|
{
|
||||||
public partial class AboutDialog : DialogWindow
|
public partial class AboutDialog : DialogWindow
|
||||||
{
|
{
|
||||||
public AboutDialog()
|
private readonly AboutVM _viewModel;
|
||||||
|
public AboutDialog() : base(saveAndRestorePosition:false)
|
||||||
{
|
{
|
||||||
|
if (Design.IsDesignMode)
|
||||||
|
_ = Configuration.Instance.LibationFiles;
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
DataContext = _viewModel = new AboutVM();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void CheckForUpgrade_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var mainWindow = Owner as Views.MainWindow;
|
||||||
|
|
||||||
|
var upgrader = new Upgrader();
|
||||||
|
upgrader.DownloadProgress += async (_, e) => await Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() => mainWindow.ViewModel.DownloadProgress = e.ProgressPercentage);
|
||||||
|
upgrader.DownloadCompleted += async (_, _) => await Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() => mainWindow.ViewModel.DownloadProgress = null);
|
||||||
|
|
||||||
|
_viewModel.CanCheckForUpgrade = false;
|
||||||
|
Version latestVersion = null;
|
||||||
|
await upgrader.CheckForUpgradeAsync(OnUpgradeAvailable);
|
||||||
|
|
||||||
|
_viewModel.CanCheckForUpgrade = latestVersion is null;
|
||||||
|
|
||||||
|
_viewModel.UpgradeButtonText = latestVersion is null ? "Libation is up to date. Check Again." : $"Version {latestVersion:3} is available";
|
||||||
|
|
||||||
|
async Task OnUpgradeAvailable(UpgradeEventArgs e)
|
||||||
|
{
|
||||||
|
var notificationResult = await new UpgradeNotificationDialog(e.UpgradeProperties, e.CapUpgrade).ShowDialogAsync(this);
|
||||||
|
|
||||||
|
e.Ignore = notificationResult == DialogResult.Ignore;
|
||||||
|
e.InstallUpgrade = notificationResult == DialogResult.OK;
|
||||||
|
latestVersion = e.UpgradeProperties.LatestRelease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ViewReleaseNotes_Tapped(object sender, Avalonia.Input.TappedEventArgs e)
|
||||||
|
{
|
||||||
|
Dinah.Core.Go.To.Url($"{AppScaffolding.LibationScaffolding.RepositoryUrl}/releases/tag/v{AppScaffolding.LibationScaffolding.BuildVersion.ToString(3)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AboutVM : ViewModelBase
|
||||||
|
{
|
||||||
|
public string Version { get; }
|
||||||
|
public AvaloniaList<AssemblyName> Assemblies { get; } = new();
|
||||||
|
public bool CanCheckForUpgrade { get => canCheckForUpgrade; set => this.RaiseAndSetIfChanged(ref canCheckForUpgrade, value); }
|
||||||
|
public string UpgradeButtonText { get => upgradeButtonText; set => this.RaiseAndSetIfChanged(ref upgradeButtonText, value); }
|
||||||
|
|
||||||
|
|
||||||
|
private bool canCheckForUpgrade = true;
|
||||||
|
private string upgradeButtonText = "Check for Upgrade";
|
||||||
|
|
||||||
|
public AboutVM()
|
||||||
|
{
|
||||||
|
Version = $"Libation {AppScaffolding.LibationScaffolding.Variety} v{AppScaffolding.LibationScaffolding.BuildVersion}";
|
||||||
|
Assemblies.AddRange(AppDomain.CurrentDomain.GetAssemblies().Select(a => new AssemblyName(a.FullName)).Where(a => a.Version.Major + a.Version.Minor + a.Version.Build + a.Version.Revision > 0).OrderBy(a => a.Name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task CopyAssembliesAsync() => await App.Current.Clipboard.SetTextAsync(string.Join(Environment.NewLine, Assemblies.Select(a => $"{a.Name}\t{a.Version}")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using LibationFileManager;
|
using Avalonia.Controls;
|
||||||
|
using LibationFileManager;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -9,9 +10,12 @@ namespace LibationAvalonia.ViewModels
|
|||||||
{
|
{
|
||||||
private bool _menuBarVisible = !Configuration.IsMacOs;
|
private bool _menuBarVisible = !Configuration.IsMacOs;
|
||||||
public bool MenuBarVisible { get => _menuBarVisible; set => this.RaiseAndSetIfChanged(ref _menuBarVisible, value); }
|
public bool MenuBarVisible { get => _menuBarVisible; set => this.RaiseAndSetIfChanged(ref _menuBarVisible, value); }
|
||||||
private void Configure_Settings() { }
|
private void Configure_Settings()
|
||||||
|
{
|
||||||
|
((NativeMenuItem)NativeMenu.GetMenu(App.Current).Items[0]).Command = ReactiveCommand.Create(ShowAboutAsync);
|
||||||
|
}
|
||||||
|
|
||||||
public Task ShowAboutAsync() => MessageBox.Show(MainWindow, $"Libation {AppScaffolding.LibationScaffolding.Variety}{Environment.NewLine}Version {AppScaffolding.LibationScaffolding.BuildVersion}", $"Libation v{AppScaffolding.LibationScaffolding.BuildVersion}");
|
public Task ShowAboutAsync() => new LibationAvalonia.Dialogs.AboutDialog().ShowDialog(MainWindow);
|
||||||
public Task ShowAccountsAsync() => new LibationAvalonia.Dialogs.AccountsDialog().ShowDialog(MainWindow);
|
public Task ShowAccountsAsync() => new LibationAvalonia.Dialogs.AccountsDialog().ShowDialog(MainWindow);
|
||||||
public Task ShowSettingsAsync() => new LibationAvalonia.Dialogs.SettingsDialog().ShowDialog(MainWindow);
|
public Task ShowSettingsAsync() => new LibationAvalonia.Dialogs.SettingsDialog().ShowDialog(MainWindow);
|
||||||
public Task ShowTrashBinAsync() => new LibationAvalonia.Dialogs.TrashBinDialog().ShowDialog(MainWindow);
|
public Task ShowTrashBinAsync() => new LibationAvalonia.Dialogs.TrashBinDialog().ShowDialog(MainWindow);
|
||||||
|
|||||||
@ -87,10 +87,10 @@ namespace LibationAvalonia.Views
|
|||||||
private void Configure_Upgrade()
|
private void Configure_Upgrade()
|
||||||
{
|
{
|
||||||
setProgressVisible(false);
|
setProgressVisible(false);
|
||||||
#if DEBUG
|
#if !DEBUG
|
||||||
async System.Threading.Tasks.Task upgradeAvailable(LibationUiBase.UpgradeEventArgs e)
|
async System.Threading.Tasks.Task upgradeAvailable(LibationUiBase.UpgradeEventArgs e)
|
||||||
{
|
{
|
||||||
var notificationResult = await new LibationAvalonia.Dialogs.UpgradeNotificationDialog(e.UpgradeProperties, e.CapUpgrade).ShowDialogAsync(this);
|
var notificationResult = await new Dialogs.UpgradeNotificationDialog(e.UpgradeProperties, e.CapUpgrade).ShowDialogAsync(this);
|
||||||
|
|
||||||
e.Ignore = notificationResult == DialogResult.Ignore;
|
e.Ignore = notificationResult == DialogResult.Ignore;
|
||||||
e.InstallUpgrade = notificationResult == DialogResult.OK;
|
e.InstallUpgrade = notificationResult == DialogResult.OK;
|
||||||
|
|||||||
161
Source/LibationWinForms/Dialogs/AboutDialog.Designer.cs
generated
Normal file
161
Source/LibationWinForms/Dialogs/AboutDialog.Designer.cs
generated
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
namespace LibationWinForms.Dialogs
|
||||||
|
{
|
||||||
|
partial class AboutDialog
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||||
|
versionLbl = new System.Windows.Forms.Label();
|
||||||
|
releaseNotesLbl = new System.Windows.Forms.LinkLabel();
|
||||||
|
checkForUpgradeBtn = new System.Windows.Forms.Button();
|
||||||
|
listView1 = new System.Windows.Forms.ListView();
|
||||||
|
columnHeader1 = new System.Windows.Forms.ColumnHeader();
|
||||||
|
columnHeader2 = new System.Windows.Forms.ColumnHeader();
|
||||||
|
copyBtn = new System.Windows.Forms.Button();
|
||||||
|
label2 = new System.Windows.Forms.Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBox1
|
||||||
|
//
|
||||||
|
pictureBox1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
pictureBox1.Image = Properties.Resources.cheers;
|
||||||
|
pictureBox1.Location = new System.Drawing.Point(12, 105);
|
||||||
|
pictureBox1.Name = "pictureBox1";
|
||||||
|
pictureBox1.Size = new System.Drawing.Size(410, 283);
|
||||||
|
pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
|
||||||
|
pictureBox1.TabIndex = 0;
|
||||||
|
pictureBox1.TabStop = false;
|
||||||
|
//
|
||||||
|
// versionLbl
|
||||||
|
//
|
||||||
|
versionLbl.AutoSize = true;
|
||||||
|
versionLbl.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||||
|
versionLbl.Location = new System.Drawing.Point(12, 9);
|
||||||
|
versionLbl.Name = "versionLbl";
|
||||||
|
versionLbl.Size = new System.Drawing.Size(198, 21);
|
||||||
|
versionLbl.TabIndex = 1;
|
||||||
|
versionLbl.Text = "Libation Classic v11.0.0.0";
|
||||||
|
//
|
||||||
|
// releaseNotesLbl
|
||||||
|
//
|
||||||
|
releaseNotesLbl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
releaseNotesLbl.AutoSize = true;
|
||||||
|
releaseNotesLbl.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
releaseNotesLbl.Location = new System.Drawing.Point(319, 10);
|
||||||
|
releaseNotesLbl.Name = "releaseNotesLbl";
|
||||||
|
releaseNotesLbl.Size = new System.Drawing.Size(103, 20);
|
||||||
|
releaseNotesLbl.TabIndex = 2;
|
||||||
|
releaseNotesLbl.TabStop = true;
|
||||||
|
releaseNotesLbl.Text = "Release Notes";
|
||||||
|
releaseNotesLbl.LinkClicked += releaseNotesLbl_LinkClicked;
|
||||||
|
//
|
||||||
|
// 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.Location = new System.Drawing.Point(12, 54);
|
||||||
|
checkForUpgradeBtn.Name = "checkForUpgradeBtn";
|
||||||
|
checkForUpgradeBtn.Size = new System.Drawing.Size(410, 31);
|
||||||
|
checkForUpgradeBtn.TabIndex = 3;
|
||||||
|
checkForUpgradeBtn.Text = "Check for Upgrade";
|
||||||
|
checkForUpgradeBtn.UseVisualStyleBackColor = true;
|
||||||
|
checkForUpgradeBtn.Click += checkForUpgradeBtn_Click;
|
||||||
|
//
|
||||||
|
// listView1
|
||||||
|
//
|
||||||
|
listView1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { columnHeader1, columnHeader2 });
|
||||||
|
listView1.Location = new System.Drawing.Point(12, 444);
|
||||||
|
listView1.Name = "listView1";
|
||||||
|
listView1.Size = new System.Drawing.Size(410, 105);
|
||||||
|
listView1.TabIndex = 4;
|
||||||
|
listView1.UseCompatibleStateImageBehavior = false;
|
||||||
|
listView1.View = System.Windows.Forms.View.Details;
|
||||||
|
//
|
||||||
|
// columnHeader1
|
||||||
|
//
|
||||||
|
columnHeader1.Text = "Assembly";
|
||||||
|
//
|
||||||
|
// columnHeader2
|
||||||
|
//
|
||||||
|
columnHeader2.Text = "Version";
|
||||||
|
//
|
||||||
|
// copyBtn
|
||||||
|
//
|
||||||
|
copyBtn.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
copyBtn.Location = new System.Drawing.Point(304, 415);
|
||||||
|
copyBtn.Name = "copyBtn";
|
||||||
|
copyBtn.Size = new System.Drawing.Size(118, 23);
|
||||||
|
copyBtn.TabIndex = 5;
|
||||||
|
copyBtn.Text = "Copy to Clipboard";
|
||||||
|
copyBtn.UseVisualStyleBackColor = true;
|
||||||
|
copyBtn.Click += copyBtn_Click;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new System.Drawing.Point(12, 419);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new System.Drawing.Size(108, 15);
|
||||||
|
label2.TabIndex = 6;
|
||||||
|
label2.Text = "Loaded Assemblies";
|
||||||
|
//
|
||||||
|
// AboutDialog
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
ClientSize = new System.Drawing.Size(434, 561);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(copyBtn);
|
||||||
|
Controls.Add(listView1);
|
||||||
|
Controls.Add(checkForUpgradeBtn);
|
||||||
|
Controls.Add(releaseNotesLbl);
|
||||||
|
Controls.Add(versionLbl);
|
||||||
|
Controls.Add(pictureBox1);
|
||||||
|
MinimumSize = new System.Drawing.Size(450, 600);
|
||||||
|
Name = "AboutDialog";
|
||||||
|
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
|
Text = "About Libation";
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.PictureBox pictureBox1;
|
||||||
|
private System.Windows.Forms.Label versionLbl;
|
||||||
|
private System.Windows.Forms.LinkLabel releaseNotesLbl;
|
||||||
|
private System.Windows.Forms.Button checkForUpgradeBtn;
|
||||||
|
private System.Windows.Forms.ListView listView1;
|
||||||
|
private System.Windows.Forms.Button copyBtn;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private System.Windows.Forms.ColumnHeader columnHeader1;
|
||||||
|
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||||
|
}
|
||||||
|
}
|
||||||
66
Source/LibationWinForms/Dialogs/AboutDialog.cs
Normal file
66
Source/LibationWinForms/Dialogs/AboutDialog.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
using LibationUiBase;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace LibationWinForms.Dialogs
|
||||||
|
{
|
||||||
|
public partial class AboutDialog : Form
|
||||||
|
{
|
||||||
|
public AboutDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.SetLibationIcon();
|
||||||
|
versionLbl.Text = $"Libation {AppScaffolding.LibationScaffolding.Variety} v{AppScaffolding.LibationScaffolding.BuildVersion}";
|
||||||
|
var asmNames = AppDomain.CurrentDomain.GetAssemblies().Select(a => new AssemblyName(a.FullName)).Where(a => a.Version.Major + a.Version.Minor + a.Version.Build + a.Version.Revision > 0).OrderBy(a => a.Name).ToList();
|
||||||
|
|
||||||
|
listView1.Items.AddRange(asmNames.Select(a => new ListViewItem(new string[] { a.Name, a.Version.ToString() })).ToArray());
|
||||||
|
listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
|
||||||
|
Resize += (_, _) => listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void releaseNotesLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||||
|
=> Dinah.Core.Go.To.Url($"{AppScaffolding.LibationScaffolding.RepositoryUrl}/releases/tag/v{AppScaffolding.LibationScaffolding.BuildVersion.ToString(3)}");
|
||||||
|
|
||||||
|
private async void checkForUpgradeBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var form1 = Owner as Form1;
|
||||||
|
var upgrader = new Upgrader();
|
||||||
|
upgrader.DownloadBegin += (_, _) => form1.Invoke(() => form1.upgradeLbl.Visible = form1.upgradePb.Visible = true);
|
||||||
|
upgrader.DownloadProgress += (_, e) => form1.Invoke(() => form1.upgradePb.Value = int.Max(0, int.Min(100, (int)(e.ProgressPercentage ?? 0))));
|
||||||
|
upgrader.DownloadCompleted += (_, _) => form1.Invoke(() => form1.upgradeLbl.Visible = form1.upgradePb.Visible = false);
|
||||||
|
|
||||||
|
checkForUpgradeBtn.Enabled = false;
|
||||||
|
Version latestVersion = null;
|
||||||
|
await upgrader.CheckForUpgradeAsync(OnUpgradeAvailable);
|
||||||
|
|
||||||
|
checkForUpgradeBtn.Enabled = latestVersion is null;
|
||||||
|
|
||||||
|
checkForUpgradeBtn.Text = latestVersion is null ? "Libation is up to date. Check Again." : $"Version {latestVersion:3} is available";
|
||||||
|
|
||||||
|
Task OnUpgradeAvailable(UpgradeEventArgs e)
|
||||||
|
{
|
||||||
|
var notificationResult = new UpgradeNotificationDialog(e.UpgradeProperties).ShowDialog(this);
|
||||||
|
|
||||||
|
e.Ignore = notificationResult == DialogResult.Ignore;
|
||||||
|
e.InstallUpgrade = notificationResult == DialogResult.Yes;
|
||||||
|
latestVersion = e.UpgradeProperties.LatestRelease;
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copyBtn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var text = string.Join(Environment.NewLine, listView1.Items.OfType<ListViewItem>().Select(i => $"{i.SubItems[0].Text}\t{i.SubItems[1].Text}"));
|
||||||
|
Clipboard.SetDataObject(text, false, 5, 150);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
60
Source/LibationWinForms/Dialogs/AboutDialog.resx
Normal file
60
Source/LibationWinForms/Dialogs/AboutDialog.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
4
Source/LibationWinForms/Form1.Designer.cs
generated
4
Source/LibationWinForms/Form1.Designer.cs
generated
@ -697,7 +697,7 @@
|
|||||||
private System.Windows.Forms.Button removeBooksBtn;
|
private System.Windows.Forms.Button removeBooksBtn;
|
||||||
private System.Windows.Forms.Button doneRemovingBtn;
|
private System.Windows.Forms.Button doneRemovingBtn;
|
||||||
private System.Windows.Forms.ToolStripMenuItem setPdfDownloadedManualToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem setPdfDownloadedManualToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripProgressBar upgradePb;
|
public System.Windows.Forms.ToolStripProgressBar upgradePb;
|
||||||
private System.Windows.Forms.ToolStripStatusLabel upgradeLbl;
|
public System.Windows.Forms.ToolStripStatusLabel upgradeLbl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,9 +12,7 @@ namespace LibationWinForms
|
|||||||
|
|
||||||
private void basicSettingsToolStripMenuItem_Click(object sender, EventArgs e) => new SettingsDialog().ShowDialog();
|
private void basicSettingsToolStripMenuItem_Click(object sender, EventArgs e) => new SettingsDialog().ShowDialog();
|
||||||
|
|
||||||
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
|
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) => new AboutDialog().ShowDialog(this);
|
||||||
=> MessageBox.Show($"Libation {AppScaffolding.LibationScaffolding.Variety}{Environment.NewLine}Version {AppScaffolding.LibationScaffolding.BuildVersion}", $"Libation v{AppScaffolding.LibationScaffolding.BuildVersion}");
|
|
||||||
|
|
||||||
private async void tourToolStripMenuItem_Click(object sender, EventArgs e)
|
private async void tourToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
=> await new Walkthrough(this).RunAsync();
|
=> await new Walkthrough(this).RunAsync();
|
||||||
|
|
||||||
|
|||||||
@ -60,6 +60,16 @@ namespace LibationWinForms.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap cheers {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("cheers", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -118,6 +118,9 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="cheers" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\cheers.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="default_cover_300x300" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="default_cover_300x300" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\img-coverart-prod-unavailable_300x300.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\img-coverart-prod-unavailable_300x300.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
BIN
Source/LibationWinForms/Resources/cheers.png
Normal file
BIN
Source/LibationWinForms/Resources/cheers.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Loading…
x
Reference in New Issue
Block a user