From 4e1ad536e2a5984ff53811fdfbcd2eb601bcd7cd Mon Sep 17 00:00:00 2001 From: John Lewin Date: Wed, 21 Jan 2015 08:28:11 -0800 Subject: [PATCH] Conditionally display port details on printer edit form - Fixes #86355354 --- .../PrinterConnections/EditConnectionWidget.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/PrinterControls/PrinterConnections/EditConnectionWidget.cs b/PrinterControls/PrinterConnections/EditConnectionWidget.cs index e00f2740e..3f2a09a0d 100644 --- a/PrinterControls/PrinterConnections/EditConnectionWidget.cs +++ b/PrinterControls/PrinterConnections/EditConnectionWidget.cs @@ -126,6 +126,9 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections refreshComPorts.VAnchor = VAnchor.ParentBottom; refreshComPorts.Click += new EventHandler(RefreshComPorts); + FlowLayoutWidget comPortContainer = null; + +#if !__ANDROID__ TextWidget comPortLabel = new TextWidget(LocalizedString.Get("Serial Port"), 0, 0, 10); comPortLabel.TextColor = this.defaultTextColor; @@ -134,7 +137,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections comPortLabelWidget.Margin = new BorderDouble(0, 0, 0, 10); comPortLabelWidget.HAnchor = HAnchor.ParentLeftRight; - FlowLayoutWidget comPortContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); + comPortContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); comPortContainer.Margin = new BorderDouble(0); comPortContainer.HAnchor = HAnchor.ParentLeftRight; @@ -181,7 +184,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections comPortOption.TextColor = this.subContainerTextColor; comPortContainer.AddChild(comPortOption); } - +#endif TextWidget baudRateLabel = new TextWidget(LocalizedString.Get("Baud Rate"), 0, 0, 10); baudRateLabel.TextColor = this.defaultTextColor; @@ -208,8 +211,12 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections enableAutoconnect.Checked = ((StateBeforeRefresh)state).autoConnect; } - SerialPortControl serialPortScroll = new SerialPortControl(); - serialPortScroll.AddChild(comPortContainer); + SerialPortControl serialPortScroll = new SerialPortControl(); + + if (comPortContainer != null) + { + serialPortScroll.AddChild (comPortContainer); + } ConnectionControlContainer.VAnchor = VAnchor.ParentBottomTop; ConnectionControlContainer.AddChild(printerNameLabel);