Add update button to about

This commit is contained in:
2021-12-20 13:14:00 -05:00
parent e609bebbbc
commit fbb797968d
6 changed files with 47 additions and 7 deletions

View File

@@ -76,7 +76,7 @@ namespace WorkIndicator
if (status == UpdateCheck.UpdateStatus.None) if (status == UpdateCheck.UpdateStatus.None)
message = WorkIndicator.Properties.Resources.Loading; message = WorkIndicator.Properties.Resources.Loading;
_dispatcher.Invoke(() => TrayIcon.SetText(message)); // _dispatcher.Invoke(() => TrayIcon.SetText(message));
} }
protected override void OnExit(ExitEventArgs e) protected override void OnExit(ExitEventArgs e)

View File

@@ -4,21 +4,43 @@
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"
xmlns:windows="clr-namespace:Common.Wpf.Windows;assembly=Common.Wpf" xmlns:windows="clr-namespace:Common.Wpf.Windows;assembly=Common.Wpf"
xmlns:properties="clr-namespace:WorkIndicator.Properties"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignHeight="300"
d:DesignWidth="300"> d:DesignWidth="300">
<Grid> <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="[Application Name]" <TextBlock Text="[Application Name]"
Name="ApplicationNameLabel" Name="ApplicationNameLabel"
VerticalAlignment="Top" VerticalAlignment="Top"
FontWeight="Bold" /> FontWeight="Bold"
Grid.Row="0" />
<TextBlock Text="[Application Version]" <TextBlock Text="[Application Version]"
Margin="0,22,0,0" Margin="0,6,0,0"
Name="VersionLabel" Name="VersionLabel"
VerticalAlignment="Top" /> VerticalAlignment="Top"
Grid.Row="1" />
<TextBlock Text="[Company]" <TextBlock Text="[Company]"
Margin="0,44,0,0" Margin="0,6,0,0"
Name="CompanyLabel" Name="CompanyLabel"
VerticalAlignment="Top" /> VerticalAlignment="Top"
Grid.Row="2" />
<StackPanel Grid.Row="3"
Grid.Column="0"
Margin="0,20,0,0"
Orientation="Horizontal">
<Button Content="{x:Static properties:Resources.CheckUpdate}"
HorizontalAlignment="Left"
Padding="6,2"
Click="HandleCheckForUpdateButtonClick"
VerticalContentAlignment="Center" />
<Label Name="UpdateMessage" Content="" VerticalContentAlignment="Center" Padding="6,0" />
</StackPanel>
</Grid> </Grid>
</windows:CategoryPanel> </windows:CategoryPanel>

View File

@@ -1,5 +1,6 @@
using Common.Update; using Common.Update;
using System.Reflection; using System.Reflection;
using System.Windows;
namespace WorkIndicator.Options namespace WorkIndicator.Options
{ {
@@ -32,5 +33,10 @@ namespace WorkIndicator.Options
} }
public override string CategoryName => Properties.Resources.OptionCategory_About; public override string CategoryName => Properties.Resources.OptionCategory_About;
private async void HandleCheckForUpdateButtonClick(object sender, RoutedEventArgs e)
{
await UpdateCheck.CheckUpdate((status, message) => UpdateMessage.Content = message);
}
} }
} }

View File

@@ -133,6 +133,15 @@ namespace WorkIndicator.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to _Check for Update.
/// </summary>
public static string CheckUpdate {
get {
return ResourceManager.GetString("CheckUpdate", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Enabled. /// Looks up a localized string similar to Enabled.
/// </summary> /// </summary>

View File

@@ -241,4 +241,7 @@
<data name="Loading" xml:space="preserve"> <data name="Loading" xml:space="preserve">
<value>Loading...</value> <value>Loading...</value>
</data> </data>
<data name="CheckUpdate" xml:space="preserve">
<value>_Check for Update</value>
</data>
</root> </root>

View File

@@ -136,7 +136,7 @@ namespace WorkIndicator
if (dialogResult.HasValue && dialogResult.Value) if (dialogResult.HasValue && dialogResult.Value)
{ {
Properties.Settings.Default.Save(); Settings.Default.Save();
} }
} }
} }