Skip to content

@ToJans /Refactored.cs
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
public interface IUpdaterUI
{
string Message {set;}
int Progress {set;}
bool AllowContinue {set;}
bool AllowCancel {set;}
void Close();
}
private void DownloadUpdates(IUpdaterUI ui)
{
try
{
ui.Progress = 5;
ui.Message = AvailableUpdate.DownloadingUpdateLabelText;
var IsSoftwareUpdate = AvailableUpdate.SoftwareUpdateAvailable;
var IsDataUpdate = !IsSoftwareUpdate && AvailableUpdate.DataUpdateAvailable;
var IsUpdate = IsSoftwareUpdate || IsDataUpdate;
if (IsUpdate) ui.Progress = 50;
if (IsSoftwareUpdate) UpdateSoftware();
if (IsDataUpdate) UpdateData();
if (IsUpdate) ui.Progress = 100;
if (IsSoftwareUpdate)
{
ui.Close();
}
if (IsDataUpdate)
{
ui.Message = "Complete";
ui.AllowCancel=false;
ui.AllowContinue = true;
}
}
catch (Exception e)
{
// error handler code here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.