Message when checking for updates and there are none

This commit is contained in:
Théo Marchal 2022-11-08 00:55:10 +01:00
parent 9c8027428c
commit 8451e684db
7 changed files with 37 additions and 10 deletions

View File

@ -61,10 +61,10 @@ namespace unison
} }
catch (Exception err) catch (Exception err)
{ {
MessageBox.Show($"[{unison.Resources.Resources.Snapcast_Popup1}]\n" + MessageBox.Show($"[{Resources.Resources.Snapcast_Popup1}]\n" +
$"{unison.Resources.Resources.Snapcast_Popup2} {err.Message}\n\n" + $"{Resources.Resources.Snapcast_Popup2} {err.Message}\n\n" +
$"{unison.Resources.Resources.Snapcast_Popup3} {Properties.Settings.Default.snapcast_path}\n" + $"{Resources.Resources.Snapcast_Popup3} {Properties.Settings.Default.snapcast_path}\n" +
$"{unison.Resources.Resources.Snapcast_Popup4}", $"{Resources.Resources.Snapcast_Popup4}",
"unison", MessageBoxButton.OK, MessageBoxImage.Error); "unison", MessageBoxButton.OK, MessageBoxImage.Error);
return; return;
} }

View File

@ -1,4 +1,5 @@
using System.Windows; using System.Diagnostics;
using System.Windows;
using AutoUpdaterDotNET; using AutoUpdaterDotNET;
namespace unison.Handlers namespace unison.Handlers
@ -10,14 +11,17 @@ namespace unison.Handlers
private bool _UpdateAvailable = false; private bool _UpdateAvailable = false;
public bool UpdateAvailable() => _UpdateAvailable; public bool UpdateAvailable() => _UpdateAvailable;
private bool _RequestedCheck = false;
public UpdateHandler() public UpdateHandler()
{ {
AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent; AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent;
Start(); Start();
} }
public void Start() public void Start(bool RequestCheck = false)
{ {
_RequestedCheck = RequestCheck;
AutoUpdater.Start(xmlFile); AutoUpdater.Start(xmlFile);
} }
@ -38,11 +42,16 @@ namespace unison.Handlers
MainWindow MainWin = (MainWindow)Application.Current.MainWindow; MainWindow MainWin = (MainWindow)Application.Current.MainWindow;
MainWin.UpdateUpdateStatus(number); MainWin.UpdateUpdateStatus(number);
MessageBoxResult Result = MessageBox.Show($"{unison.Resources.Resources.Update_Message1} {number}.\n{unison.Resources.Resources.Update_Message2}", MessageBoxResult Result = MessageBox.Show($"{Resources.Resources.Update_Message1} {number}.\n{Resources.Resources.Update_Message2}",
"unison", MessageBoxButton.YesNo, MessageBoxImage.Information); "unison", MessageBoxButton.YesNo, MessageBoxImage.Information);
if (Result == MessageBoxResult.Yes) if (Result == MessageBoxResult.Yes)
AutoUpdater.DownloadUpdate(args); AutoUpdater.DownloadUpdate(args);
} }
else
{
if (_RequestedCheck)
MessageBox.Show($"{Resources.Resources.Update_NoUpdate}", "unison", MessageBoxButton.OK, MessageBoxImage.Information);
}
} }
} }
} }

View File

@ -654,6 +654,15 @@ namespace unison.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to No update available..
/// </summary>
public static string Update_NoUpdate {
get {
return ResourceManager.GetString("Update_NoUpdate", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to New version. /// Looks up a localized string similar to New version.
/// </summary> /// </summary>

View File

@ -315,6 +315,9 @@
<data name="Update_Message2" xml:space="preserve"> <data name="Update_Message2" xml:space="preserve">
<value>¿Instalar ahora?</value> <value>¿Instalar ahora?</value>
</data> </data>
<data name="Update_NoUpdate" xml:space="preserve">
<value>No actualización disponible.</value>
</data>
<data name="Update_String1" xml:space="preserve"> <data name="Update_String1" xml:space="preserve">
<value>¡Nueva versión</value> <value>¡Nueva versión</value>
</data> </data>

View File

@ -304,7 +304,7 @@
<value>Stopper Snapcast</value> <value>Stopper Snapcast</value>
</data> </data>
<data name="Update_ButtonCheck" xml:space="preserve"> <data name="Update_ButtonCheck" xml:space="preserve">
<value>Chercher une mise à jour</value> <value>Vérifier les mises à jour</value>
</data> </data>
<data name="Update_ButtonStart" xml:space="preserve"> <data name="Update_ButtonStart" xml:space="preserve">
<value>Mettre à jour</value> <value>Mettre à jour</value>
@ -315,6 +315,9 @@
<data name="Update_Message2" xml:space="preserve"> <data name="Update_Message2" xml:space="preserve">
<value>Installer maintenant ?</value> <value>Installer maintenant ?</value>
</data> </data>
<data name="Update_NoUpdate" xml:space="preserve">
<value>Pas de mise à jour disponible.</value>
</data>
<data name="Update_String1" xml:space="preserve"> <data name="Update_String1" xml:space="preserve">
<value>Nouvelle version</value> <value>Nouvelle version</value>
</data> </data>

View File

@ -315,6 +315,9 @@
<data name="Update_Message2" xml:space="preserve"> <data name="Update_Message2" xml:space="preserve">
<value>Install now?</value> <value>Install now?</value>
</data> </data>
<data name="Update_NoUpdate" xml:space="preserve">
<value>No update available.</value>
</data>
<data name="Update_String1" xml:space="preserve"> <data name="Update_String1" xml:space="preserve">
<value>New version</value> <value>New version</value>
</data> </data>

View File

@ -149,7 +149,7 @@ namespace unison
private void CheckUpdates(object sender, RoutedEventArgs e) private void CheckUpdates(object sender, RoutedEventArgs e)
{ {
UpdateHandler updater = (UpdateHandler)Application.Current.Properties["updater"]; UpdateHandler updater = (UpdateHandler)Application.Current.Properties["updater"];
updater.Start(); updater.Start(true);
} }
public void UpdateUpdateStatus(string version) public void UpdateUpdateStatus(string version)