Refactor update check

This commit is contained in:
2018-02-23 12:05:13 -05:00
parent 8f550463b7
commit d9d0f33788
8 changed files with 191 additions and 48 deletions

View File

@@ -4,21 +4,43 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:windows="clr-namespace:Common.Wpf.Windows;assembly=Common.Wpf"
xmlns:properties="clr-namespace:ProcessCpuUsageStatusWindow.Properties"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<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]"
Name="ApplicationNameLabel"
VerticalAlignment="Top"
FontWeight="Bold" />
FontWeight="Bold"
Grid.Row="0" />
<TextBlock Text="[Application Version]"
Margin="0,22,0,0"
Margin="0,6,0,0"
Name="VersionLabel"
VerticalAlignment="Top" />
VerticalAlignment="Top"
Grid.Row="1" />
<TextBlock Text="[Company]"
Margin="0,44,0,0"
Margin="0,6,0,0"
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>
</windows:CategoryPanel>

View File

@@ -1,5 +1,5 @@
using Common.Update;
using System.Reflection;
using System.Reflection;
using System.Windows;
namespace ProcessCpuUsageStatusWindow.Options
{
@@ -32,5 +32,10 @@ namespace ProcessCpuUsageStatusWindow.Options
}
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

@@ -27,14 +27,16 @@
<Label Grid.Column="0"
Grid.Row="1"
Content="{x:Static properties:Resources.NumberOfProcesses}"
Margin="0,6,6,6"
Padding="0"
VerticalContentAlignment="Center" VerticalAlignment="Center" />
Margin="0,4,6,0"
Padding="0"
VerticalContentAlignment="Center" VerticalAlignment="Center" Target="{x:Reference NumberOfProcesses}" />
<xctk:IntegerUpDown Grid.Column="1"
Grid.Row="1" x:Name="NumberOfProcesses"
Minimum="1" Maximum="20"
TextAlignment="Left" Margin="6"
TextAlignment="Left" Margin="0,12,6,6"
Width="50"
VerticalContentAlignment="Center"
VerticalAlignment="Center"
HorizontalAlignment="Left" />
</Grid>
</windows:CategoryPanel>