77 lines
2.4 KiB
C#
77 lines
2.4 KiB
C#
using global::Pilz.Updating.Client.GUI.My.Resources;
|
|
|
|
namespace Pilz.Updating.Client.GUI
|
|
{
|
|
public partial class SimpleActionDialog
|
|
{
|
|
public SimpleActionDialog()
|
|
{
|
|
InitializeComponent();
|
|
SetCurrentState(UpdateStatus.Waiting);
|
|
}
|
|
|
|
public void SetCurrentState(UpdateStatus curAction)
|
|
{
|
|
SetCurrentStateInternal(curAction, -1);
|
|
}
|
|
|
|
public void SetCurrentState(UpdateStatus curAction, int progress)
|
|
{
|
|
SetCurrentStateInternal(curAction, progress);
|
|
}
|
|
|
|
private void SetCurrentStateInternal(UpdateStatus curAction, int progress)
|
|
{
|
|
var progressText = string.Empty;
|
|
|
|
switch (curAction)
|
|
{
|
|
case UpdateStatus.Waiting:
|
|
{
|
|
progressText = UpdatingClientGuiLangRes.SimpleActions_Waiting;
|
|
break;
|
|
}
|
|
|
|
case UpdateStatus.Searching:
|
|
{
|
|
progressText = UpdatingClientGuiLangRes.SimpleActions_Searching;
|
|
break;
|
|
}
|
|
|
|
case UpdateStatus.DownloadingInstaller:
|
|
{
|
|
progressText = UpdatingClientGuiLangRes.SimpleActions_DownloadingInstaller;
|
|
break;
|
|
}
|
|
|
|
case UpdateStatus.DownloadingPackage:
|
|
{
|
|
progressText = UpdatingClientGuiLangRes.SimpleActions_DownloadingPackage;
|
|
break;
|
|
}
|
|
|
|
case UpdateStatus.StartingInstaller:
|
|
{
|
|
progressText = UpdatingClientGuiLangRes.SimpleActions_DownloadingInstaller;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (progress == -1)
|
|
{
|
|
radProgressBar1.Visible = false;
|
|
radWaitingBar1.Text = progressText;
|
|
radWaitingBar1.BringToFront();
|
|
radWaitingBar1.StartWaiting();
|
|
}
|
|
else
|
|
{
|
|
radWaitingBar1.StopWaiting();
|
|
radProgressBar1.Text = progressText + $" ({progress}%)";
|
|
radProgressBar1.Value1 = progress;
|
|
radProgressBar1.BringToFront();
|
|
radProgressBar1.Visible = true;
|
|
}
|
|
}
|
|
}
|
|
} |