Made the "(refresh)" button not change the current selection of the 'auto save' checkbox in the edit profile window.

This commit is contained in:
larsbrubaker 2014-08-25 20:22:06 -07:00
parent ba2068cffa
commit 74dacdb90a
2 changed files with 20 additions and 5 deletions

View file

@ -31,7 +31,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
bool addNewPrinterFlag = false;
public EditConnectionWidget(ConnectionWindow windowController, GuiWidget containerWindowToClose, Printer activePrinter = null)
public EditConnectionWidget(ConnectionWindow windowController, GuiWidget containerWindowToClose, Printer activePrinter = null, object state = null)
: base(windowController, containerWindowToClose)
{
textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
@ -202,6 +202,11 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
enableAutoconnect.Checked = true;
}
if (state as StateBeforeRefresh != null)
{
enableAutoconnect.Checked = ((StateBeforeRefresh)state).autoConnect;
}
ConnectionControlContainer.VAnchor = VAnchor.ParentBottomTop;
ConnectionControlContainer.AddChild(printerNameLabel);
ConnectionControlContainer.AddChild(printerNameInput);
@ -390,6 +395,16 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
return comPortOption;
}
internal class StateBeforeRefresh
{
internal bool autoConnect;
internal StateBeforeRefresh(bool autoConnect)
{
this.autoConnect = autoConnect;
}
}
void RefreshComPorts(object sender, MouseEventArgs mouseEvent)
{
try
@ -402,7 +417,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
}
this.windowController.ChangedToEditPrinter(this.ActivePrinter);
this.windowController.ChangedToEditPrinter(this.ActivePrinter, new StateBeforeRefresh(enableAutoconnect.Checked));
}
void ReloadCurrentWidget(object sender, MouseEventArgs mouseEvent)

View file

@ -89,15 +89,15 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
this.Invalidate();
}
public void ChangedToEditPrinter(Printer activePrinter)
public void ChangedToEditPrinter(Printer activePrinter, object state = null)
{
this.activePrinter = activePrinter;
UiThread.RunOnIdle(DoChangeToEditPrinter);
UiThread.RunOnIdle(DoChangeToEditPrinter, state);
}
private void DoChangeToEditPrinter(object state)
{
GuiWidget addConnectionWidget = new EditConnectionWidget(this, this, activePrinter);
GuiWidget addConnectionWidget = new EditConnectionWidget(this, this, activePrinter, state);
this.RemoveAllChildren();
this.AddChild(addConnectionWidget);
this.Invalidate();