update nugets & cleanup
This commit is contained in:
@@ -6,12 +6,14 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Telerik.WinControls;
|
||||
using Telerik.WinControls.Themes;
|
||||
using Pilz.Updating.UpdateInstaller.Lib;
|
||||
using Pilz.Plugins.Advanced;
|
||||
using Pilz.Updating.UpdateInstaller.AddOns;
|
||||
|
||||
namespace Pilz.Updating.UpdateInstaller
|
||||
{
|
||||
public partial class Main
|
||||
{
|
||||
|
||||
// C o n s t r u c t o r s
|
||||
|
||||
public Main()
|
||||
@@ -26,58 +28,34 @@ namespace Pilz.Updating.UpdateInstaller
|
||||
if (args.Any())
|
||||
{
|
||||
// Load config
|
||||
Installer = new UpdateInstaller(UpdateInstallerConfig.Parse(args[0]));
|
||||
installer = new Lib.UpdateInstaller(UpdateInstallerConfig.Parse(args[0]));
|
||||
PluginFunctionController.Instance.ExecuteAll(UpdateInstallerFunctionTypes.OnInstancingUpdateInstaller);
|
||||
|
||||
// Init Form
|
||||
InitializeComponent();
|
||||
|
||||
// Init Style
|
||||
RadThemeComponentBase themeToUse = Installer.Configuration.UIDarkMode ? new FluentDarkTheme() : new FluentTheme();
|
||||
RadThemeComponentBase themeToUse = installer.Configuration.UIDarkMode ? new FluentDarkTheme() : new FluentTheme();
|
||||
ThemeResolutionService.ApplicationThemeName = themeToUse.ThemeName;
|
||||
|
||||
// Init Application Header Text
|
||||
string header;
|
||||
if (!string.IsNullOrEmpty(Installer.Configuration.ApplicationName))
|
||||
{
|
||||
header = string.Format(My.Resources.UpdateInstallerGuiLangRes.String_UpdatingApplicationX, Installer.Configuration.ApplicationName);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(installer.Configuration.ApplicationName))
|
||||
header = string.Format(My.Resources.UpdateInstallerGuiLangRes.String_UpdatingApplicationX, installer.Configuration.ApplicationName);
|
||||
else
|
||||
{
|
||||
header = My.Resources.UpdateInstallerGuiLangRes.String_UpdateIsRunning;
|
||||
}
|
||||
|
||||
radLabel_Header.Text = $"<html><span style=\"font-size: 18pt; color: #b7472a\"><b>{header}</b></span></html>";
|
||||
}
|
||||
|
||||
if (Installer is null)
|
||||
if (installer is null)
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
// F i e l d s
|
||||
|
||||
private bool allowClose = false;
|
||||
private UpdateInstaller _Installer;
|
||||
|
||||
private UpdateInstaller Installer
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Installer;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_Installer != null)
|
||||
{
|
||||
_Installer.StatusChanges -= Installer_StatusChanges;
|
||||
}
|
||||
|
||||
_Installer = value;
|
||||
if (_Installer != null)
|
||||
{
|
||||
_Installer.StatusChanges += Installer_StatusChanges;
|
||||
}
|
||||
}
|
||||
}
|
||||
private readonly Lib.UpdateInstaller installer;
|
||||
|
||||
// F e a t u r e s
|
||||
|
||||
@@ -97,9 +75,6 @@ namespace Pilz.Updating.UpdateInstaller
|
||||
case UpdateInstallerStatus.Extracting:
|
||||
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Extracting;
|
||||
break;
|
||||
case UpdateInstallerStatus.RunningAddons:
|
||||
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_RunningAddOns;
|
||||
break;
|
||||
case UpdateInstallerStatus.RemovingFiles:
|
||||
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_RemovingFiles;
|
||||
break;
|
||||
@@ -116,9 +91,6 @@ namespace Pilz.Updating.UpdateInstaller
|
||||
case UpdateInstallerStatus.Extracting:
|
||||
newStatusImage = MyIcons.icons8_open_archive_16px;
|
||||
break;
|
||||
case UpdateInstallerStatus.RunningAddons:
|
||||
newStatusImage = MyIcons.icons8_console_16px_1;
|
||||
break;
|
||||
case UpdateInstallerStatus.RemovingFiles:
|
||||
newStatusImage = MyIcons.icons8_recycle_bin_16px;
|
||||
break;
|
||||
@@ -143,12 +115,12 @@ namespace Pilz.Updating.UpdateInstaller
|
||||
private async Task WaitforHostApp()
|
||||
{
|
||||
SetStatus(UpdateInstallerStatus.Waiting);
|
||||
await Task.Run(() => Installer.WaitForHostApplication());
|
||||
await Task.Run(() => installer.WaitForHostApplication());
|
||||
}
|
||||
|
||||
private async void ExecuteUpdate()
|
||||
{
|
||||
await Task.Run(() => Installer.InstallUpdate());
|
||||
await Task.Run(() => installer.InstallUpdate());
|
||||
allowClose = true;
|
||||
Close();
|
||||
}
|
||||
@@ -162,7 +134,7 @@ namespace Pilz.Updating.UpdateInstaller
|
||||
|
||||
private void Main_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
Installer.StartHostApplication();
|
||||
installer.StartHostApplication();
|
||||
}
|
||||
|
||||
private void Main_FormClosing(object sender, FormClosingEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user