gui: add event to handle EndUpdating
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
using Pilz.UI;
|
||||
using Pilz.UI.Telerik.Dialogs;
|
||||
using Pilz.Updating.Client.Gui.LangRes;
|
||||
using Pilz.Updating.Client.GUI;
|
||||
using Telerik.WinControls;
|
||||
|
||||
namespace Pilz.Updating.Client.Gui;
|
||||
|
||||
public class UpdateClientGui
|
||||
{
|
||||
// E v e n t s
|
||||
|
||||
public event UpdateEndedEventHandler OnUpdateEnded;
|
||||
|
||||
// F i e l d s
|
||||
|
||||
private Form parentForm;
|
||||
@@ -16,7 +19,7 @@ public class UpdateClientGui
|
||||
|
||||
// P r o p e r t i e s
|
||||
|
||||
public bool UseHiddenSearch { get; set; } = false;
|
||||
public bool UseHiddenSearch { get; set; }
|
||||
|
||||
private static Image MyAppIcon => Icon.ExtractAssociatedIcon(IO.Extensions.GetExecutablePath()).ToBitmap();
|
||||
|
||||
@@ -42,9 +45,15 @@ public class UpdateClientGui
|
||||
}
|
||||
|
||||
private void EndUpdating()
|
||||
{
|
||||
EndUpdating(false);
|
||||
}
|
||||
|
||||
private void EndUpdating(bool success)
|
||||
{
|
||||
curProgressDialog.AllowClose = true;
|
||||
curProgressDialog?.Invoke(curProgressDialog.Close);
|
||||
OnUpdateEnded?.Invoke(this, new(success));
|
||||
}
|
||||
|
||||
// E v e n t s
|
||||
@@ -86,6 +95,8 @@ public class UpdateClientGui
|
||||
switch (e.Status)
|
||||
{
|
||||
case UpdateStatus.Done:
|
||||
EndUpdating(true);
|
||||
break;
|
||||
case UpdateStatus.Failed:
|
||||
case UpdateStatus.Canceled:
|
||||
EndUpdating();
|
||||
|
||||
Reference in New Issue
Block a user