diff options
author | sr55 <[email protected]> | 2019-12-29 21:32:16 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2020-01-01 16:32:35 +0000 |
commit | 5978ed460b3c99ac222e30a00c998ea545f04c95 (patch) | |
tree | 8384435c6cc98511c25c66e319f785267773c0cd | |
parent | 3f4b59109d206ae65efe16f62cd6ef61634c0ce9 (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.
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 ccf4a541d..6177f660e 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -5072,6 +5072,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'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 eb271f567..eaf732982 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -2172,4 +2172,7 @@ Where supported, any user presets will have been imported.</value> <data name="UpdateCheck_Weekly" xml:space="preserve">
<value>Weekly</value>
</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;
}
}
|