summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2019-12-29 21:32:16 +0000
committersr55 <[email protected]>2019-12-29 21:32:16 +0000
commit0b089e9d1e20ad2240b20efff74eb3fd581ae235 (patch)
tree2d4870f1b4aa043b57d217c845a7dd740c454107 /win/CS/HandBrakeWPF
parent3ebc8137733d0e211b82bc0c0067f1f04a6c2390 (diff)
WinGui: Improve the way updates are notified. The status label isn't visible when the application starts and will be reset during scan thus wasn't appropiate. The Source Selection Pane which shows on startup will now show a link that opens the Options Update tab.
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Controls/SourceSelection.xaml18
-rw-r--r--win/CS/HandBrakeWPF/Controls/SourceSelection.xaml.cs6
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.Designer.cs9
-rw-r--r--win/CS/HandBrakeWPF/Properties/Resources.resx3
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs13
5 files changed, 45 insertions, 4 deletions
diff --git a/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml b/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml
index 7069fde07..91528e23c 100644
--- a/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml
+++ b/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml
@@ -5,8 +5,7 @@
xmlns:controls="clr-namespace:HandBrakeWPF.Controls"
xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
xmlns:converters="clr-namespace:HandBrakeWPF.Converters"
- x:Name="sourcePanel"
- >
+ x:Name="sourcePanel">
<UserControl.Resources>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
@@ -31,6 +30,7 @@
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@@ -109,12 +109,22 @@
</ListBox.ItemTemplate>
</ListBox>
+ <StackPanel Grid.Row="7" Margin="20,10,0,10" Orientation="Horizontal" HorizontalAlignment="Stretch" Visibility="{Binding UpdateAvailable, Converter={StaticResource BooleanToVisibilityConverter}}">
+
+ <Image Source="../Views/Images/information.png" Width="24" />
+ <TextBlock HorizontalAlignment="Center" FontWeight="Bold" Margin="5,0,0,0">
+ <Hyperlink x:Name="UpdateAvailable" NavigateUri="/" RequestNavigate="UpdateAvailable_OnRequestNavigate">
+ <TextBlock Text="{x:Static Properties:Resources.SourceSelection_UpdateAvailable}" TextTrimming="CharacterEllipsis" />
+ </Hyperlink>
+ </TextBlock>
+ </StackPanel>
+
<!-- Cancel Window -->
- <StackPanel Grid.Row="7" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,2,10">
+ <StackPanel Grid.Row="8" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,2,10">
<Button cal:Message.Attach="[Event Click] = [Action CloseSourceSelection]" Content="Cancel" IsCancel="True" Padding="8,2" />
</StackPanel>
- <StackPanel Grid.Row="8" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,2,10">
+ <StackPanel Grid.Row="9" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,2,10">
<TextBlock>
<Hyperlink x:Name="Preferences" NavigateUri="/" RequestNavigate="OpenOptions_OnRequestNavigate" ><TextBlock Text="{x:Static Properties:Resources.Preferences}"/></Hyperlink>
</TextBlock>
diff --git a/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml.cs b/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml.cs
index a6e07e7d1..21308d6ab 100644
--- a/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml.cs
+++ b/win/CS/HandBrakeWPF/Controls/SourceSelection.xaml.cs
@@ -71,5 +71,11 @@ namespace HandBrakeWPF.Controls
{
Process.Start("https://handbrake.fr/docs");
}
+
+ private void UpdateAvailable_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
+ {
+ MainViewModel vm = this.DataContext as MainViewModel;
+ vm.CheckForUpdates();
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
index ad1c26bdb..d4fd59875 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
+++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs
@@ -5108,6 +5108,15 @@ namespace HandBrakeWPF.Properties {
}
/// <summary>
+ /// Looks up a localized string similar to A new version of HandBrake is available!.
+ /// </summary>
+ public static string SourceSelection_UpdateAvailable {
+ get {
+ return ResourceManager.GetString("SourceSelection_UpdateAvailable", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to HandBrake&apos;s engine failed to initialise. This is often caused by out of date GPU drivers.\n Please update the GPU drivers for any onboard and discrete graphics your system has..
/// </summary>
public static string Startup_InitFailed {
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx
index a23927894..4aa8b20ab 100644
--- a/win/CS/HandBrakeWPF/Properties/Resources.resx
+++ b/win/CS/HandBrakeWPF/Properties/Resources.resx
@@ -2185,4 +2185,7 @@ Where supported, any user presets will have been imported.</value>
<value>Replacement Placeholders: {source} {destination}</value>
<comment>Note: {source} and {destination} are not translatable. </comment>
</data>
+ <data name="SourceSelection_UpdateAvailable" xml:space="preserve">
+ <value>A new version of HandBrake is available!</value>
+ </data>
</root> \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 912f8857d..da77e5502 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -102,6 +102,7 @@ namespace HandBrakeWPF.ViewModels
private bool isSettingPreset;
private IPresetObject selectedPresetCategory;
private bool isModifiedPreset;
+ private bool updateAvailable;
#endregion
@@ -1096,6 +1097,17 @@ namespace HandBrakeWPF.ViewModels
public string ShowAddSelectionMenuName =>
string.Format("{0} {1}", (!this.ShowAddSelectionToQueue ? Resources.MainView_Show : Resources.MainView_Hide), Resources.MainView_ShowAddSelectionToQueue);
+ public bool UpdateAvailable
+ {
+ get => this.updateAvailable;
+ set
+ {
+ if (value == this.updateAvailable) return;
+ this.updateAvailable = value;
+ this.NotifyOfPropertyChange(() => this.UpdateAvailable);
+ }
+ }
+
#endregion
#region Commands
@@ -2341,6 +2353,7 @@ namespace HandBrakeWPF.ViewModels
{
if (information.NewVersionAvailable)
{
+ this.UpdateAvailable = true;
this.ProgramStatusLabel = Resources.Main_NewUpdate;
}
}