Trying to make updater show errors better.

Fixed a bug using Frosted Serial Port. Now go through wrapper.
Only add the Manual Controls plugins one time.
This commit is contained in:
larsbrubaker 2014-05-13 17:00:50 -07:00
parent 03db4d1002
commit a26c8d8caa
4 changed files with 19 additions and 11 deletions

View file

@ -159,7 +159,6 @@ namespace MatterHackers.MatterControl
if (DownloadHasZeroSize())
{
SetUpdateStatus(UpdateStatusStates.UpToDate);
this.updateInitiated = false;
}
else
{
@ -170,8 +169,8 @@ namespace MatterHackers.MatterControl
void onVersionRequestFailed(object sender, EventArgs e)
{
SetUpdateStatus(UpdateStatusStates.UpToDate);
this.updateInitiated = false;
SetUpdateStatus(UpdateStatusStates.UpToDate);
}
public void InitiateUpdateDownload()
@ -253,9 +252,9 @@ namespace MatterHackers.MatterControl
void DownloadCompleted(object sender, EventArgs e)
{
updateInitiated = false;
SetUpdateStatus(UpdateStatusStates.ReadyToInstall);
webClient.Dispose();
updateInitiated = false;
}
private UpdateControlData()
@ -283,7 +282,7 @@ namespace MatterHackers.MatterControl
UpdateStatusChanged.CallEvents(this, e);
}
public void InstallUpdate(GuiWidget windowToClose)
public bool InstallUpdate(GuiWidget windowToClose)
{
string downloadToken = ApplicationSettings.Instance.get("CurrentBuildToken");
@ -322,6 +321,7 @@ namespace MatterHackers.MatterControl
if (topSystemWindow != null)
{
topSystemWindow.CloseOnIdle();
return true;
}
}
catch
@ -331,6 +331,8 @@ namespace MatterHackers.MatterControl
System.IO.File.Delete(friendlyFileName);
}
}
return false;
}
}
}

View file

@ -105,7 +105,11 @@ namespace MatterHackers.MatterControl
{
try
{
UpdateControlData.Instance.InstallUpdate(this);
if (!UpdateControlData.Instance.InstallUpdate(this))
{
installUpdateLink.Visible = false;
updateStatusText.Text = string.Format("Oops! Unable to install update.".Localize());
}
}
catch
{

View file

@ -1558,11 +1558,7 @@ namespace MatterHackers.MatterControl
{
if (serialPort == null && this.ActivePrinter != null)
{
#if USE_FROSTED_SERIAL_PORT
serialPort = new FrostedSerialPort(this.ActivePrinter.ComPort);
#else
serialPort = new SerialPort(this.ActivePrinter.ComPort);
#endif
serialPort = FrostedSerialPort.Create(this.ActivePrinter.ComPort);
serialPort.BaudRate = this.BaudRate;
if (PrinterCommunication.Instance.DtrEnableOnConnect)
{

View file

@ -186,12 +186,18 @@ namespace MatterHackers.MatterControl
AddHandlers();
SetVisibleControls();
UiThread.RunOnIdle(AddPlugins);
if (!pluginsQueuedToAdd)
{
UiThread.RunOnIdle(AddPlugins);
pluginsQueuedToAdd = true;
}
}
static bool pluginsQueuedToAdd = false;
public void AddPlugins(object state)
{
AddPluginControls.CallEvents(this, null);
pluginsQueuedToAdd = false;
}
private void AddFanControls(FlowLayoutWidget controlsTopToBottomLayout)