Disambiguate updatemanager restart overloads

This commit is contained in:
Caelan Sayler
2024-02-15 08:31:26 +00:00
parent bcdcbb4cda
commit 651f098aae
4 changed files with 10 additions and 13 deletions

View File

@@ -48,7 +48,7 @@ public partial class MainWindow : Window
private void BtnRestartApplyClick(object sender, RoutedEventArgs e) private void BtnRestartApplyClick(object sender, RoutedEventArgs e)
{ {
_um.ApplyUpdatesAndRestart(); _um.ApplyUpdatesAndRestart(_update);
} }
private void LogUpdated(object sender, LogUpdatedEventArgs e) private void LogUpdated(object sender, LogUpdatedEventArgs e)

View File

@@ -45,7 +45,7 @@ namespace VeloWpfSample
private void BtnRestartApplyClick(object sender, RoutedEventArgs e) private void BtnRestartApplyClick(object sender, RoutedEventArgs e)
{ {
_um.ApplyUpdatesAndRestart(); _um.ApplyUpdatesAndRestart(_update);
} }
private void LogUpdated(object sender, LogUpdatedEventArgs e) private void LogUpdated(object sender, LogUpdatedEventArgs e)

View File

@@ -39,5 +39,10 @@
BaseRelease = deltaBaseRelease; BaseRelease = deltaBaseRelease;
DeltasToTarget = deltasToTarget ?? new VelopackAsset[0]; DeltasToTarget = deltasToTarget ?? new VelopackAsset[0];
} }
/// <summary>
/// Implicitly convert an <see cref="UpdateInfo"/> to a <see cref="VelopackAsset"/>.
/// </summary>
public static implicit operator VelopackAsset(UpdateInfo updateInfo) => updateInfo.TargetFullRelease;
} }
} }

View File

@@ -9,11 +9,7 @@ namespace Velopack
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Please use one of the other overloads of ApplyUpdatesAndRestart() instead.")] [Obsolete("Please use one of the other overloads of ApplyUpdatesAndRestart() instead.")]
public void ApplyUpdatesAndRestart(string[]? restartArgs = null) public void ApplyUpdatesAndRestart(string[]? restartArgs = null)
=> ApplyUpdatesAndRestart((VelopackAsset?) null, restartArgs); => ApplyUpdatesAndRestart(null, restartArgs);
/// <inheritdoc cref="ApplyUpdatesAndRestart(VelopackAsset, string[])"/>
public void ApplyUpdatesAndRestart(UpdateInfo? toApply, string[]? restartArgs = null)
=> ApplyUpdatesAndRestart(toApply?.TargetFullRelease, restartArgs);
/// <summary> /// <summary>
/// This will exit your app immediately, apply updates, and then optionally relaunch the app using the specified /// This will exit your app immediately, apply updates, and then optionally relaunch the app using the specified
@@ -32,12 +28,8 @@ namespace Velopack
/// <inheritdoc cref="ApplyUpdatesAndExit(VelopackAsset)"/> /// <inheritdoc cref="ApplyUpdatesAndExit(VelopackAsset)"/>
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Please use one of the other overloads of ApplyUpdatesAndExit() instead.")] [Obsolete("Please use one of the other overloads of ApplyUpdatesAndExit() instead.")]
public void ApplyUpdatesAndExit(string[]? restartArgs = null) public void ApplyUpdatesAndExit()
=> ApplyUpdatesAndExit((VelopackAsset?) null); => ApplyUpdatesAndExit(null);
/// <inheritdoc cref="ApplyUpdatesAndExit(VelopackAsset)"/>
public void ApplyUpdatesAndExit(UpdateInfo? toApply)
=> ApplyUpdatesAndExit(toApply?.TargetFullRelease);
/// <summary> /// <summary>
/// This will exit your app immediately, apply updates, and then optionally relaunch the app using the specified /// This will exit your app immediately, apply updates, and then optionally relaunch the app using the specified