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)
{
MessageBox.Show($"[{unison.Resources.Resources.Snapcast_Popup1}]\n" +
$"{unison.Resources.Resources.Snapcast_Popup2} {err.Message}\n\n" +
$"{unison.Resources.Resources.Snapcast_Popup3} {Properties.Settings.Default.snapcast_path}\n" +
$"{unison.Resources.Resources.Snapcast_Popup4}",
MessageBox.Show($"[{Resources.Resources.Snapcast_Popup1}]\n" +
$"{Resources.Resources.Snapcast_Popup2} {err.Message}\n\n" +
$"{Resources.Resources.Snapcast_Popup3} {Properties.Settings.Default.snapcast_path}\n" +
$"{Resources.Resources.Snapcast_Popup4}",
"unison", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}

View File

@ -1,4 +1,5 @@
using System.Windows;
using System.Diagnostics;
using System.Windows;
using AutoUpdaterDotNET;
namespace unison.Handlers
@ -10,14 +11,17 @@ namespace unison.Handlers
private bool _UpdateAvailable = false;
public bool UpdateAvailable() => _UpdateAvailable;
private bool _RequestedCheck = false;
public UpdateHandler()
{
AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent;
Start();
}
public void Start()
public void Start(bool RequestCheck = false)
{
_RequestedCheck = RequestCheck;
AutoUpdater.Start(xmlFile);
}
@ -38,11 +42,16 @@ namespace unison.Handlers
MainWindow MainWin = (MainWindow)Application.Current.MainWindow;
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);
if (Result == MessageBoxResult.Yes)
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>
/// Looks up a localized string similar to New version.
/// </summary>

View File

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

View File

@ -298,13 +298,13 @@
<value>Temps d'écoute écoulé :</value>
</data>
<data name="Stats_Uptime" xml:space="preserve">
<value>MPD lancé depuis : </value>
<value>MPD lancé depuis :</value>
</data>
<data name="StopSnapcast" xml:space="preserve">
<value>Stopper Snapcast</value>
</data>
<data name="Update_ButtonCheck" xml:space="preserve">
<value>Chercher une mise à jour</value>
<value>Vérifier les mises à jour</value>
</data>
<data name="Update_ButtonStart" xml:space="preserve">
<value>Mettre à jour</value>
@ -315,6 +315,9 @@
<data name="Update_Message2" xml:space="preserve">
<value>Installer maintenant ?</value>
</data>
<data name="Update_NoUpdate" xml:space="preserve">
<value>Pas de mise à jour disponible.</value>
</data>
<data name="Update_String1" xml:space="preserve">
<value>Nouvelle version</value>
</data>

View File

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

View File

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