public HardwareSettingsWidget()
			: base(LocalizedString.Get("Hardware Settings"))
		{
			eePromControlsContainer = new DisableableWidget();
			eePromControlsContainer.AddChild(GetEEPromControl());
			terminalCommunicationsContainer = new DisableableWidget();
			terminalCommunicationsContainer.AddChild(GetGcodeTerminalControl());

			printLevelingContainer = new DisableableWidget();
			if (!ActiveSliceSettings.Instance.HasHardwareLeveling())
			{
				printLevelingContainer.AddChild(GetAutoLevelControl());

				mainContainer.AddChild(printLevelingContainer);
			}

			mainContainer.AddChild(new HorizontalLine(separatorLineColor));
			mainContainer.AddChild(eePromControlsContainer);
			mainContainer.AddChild(new HorizontalLine(separatorLineColor));

			mainContainer.AddChild(terminalCommunicationsContainer);

			DisableableWidget cameraContainer = new DisableableWidget();
			cameraContainer.AddChild(GetCameraControl());

			if (ApplicationSettings.Instance.get("HardwareHasCamera") == "true")
			{
				mainContainer.AddChild(new HorizontalLine(separatorLineColor));
				mainContainer.AddChild(cameraContainer);
			}

			AddChild(mainContainer);
			AddHandlers();
			SetVisibleControls();
		}
		public HardwareSettingsWidget()
			: base("Hardware".Localize())
		{
			eePromControlsContainer = new DisableableWidget();
			eePromControlsContainer.AddChild(GetEEPromControl());
			terminalCommunicationsContainer = new DisableableWidget();
			terminalCommunicationsContainer.AddChild(GetGcodeTerminalControl());

			mainContainer.AddChild(new HorizontalLine(separatorLineColor));
			mainContainer.AddChild(eePromControlsContainer);
			mainContainer.AddChild(new HorizontalLine(separatorLineColor));

			mainContainer.AddChild(terminalCommunicationsContainer);

			DisableableWidget cameraContainer = new DisableableWidget();
			cameraContainer.AddChild(GetCameraControl());

			if (ApplicationSettings.Instance.get("HardwareHasCamera") == "true")
			{
				mainContainer.AddChild(new HorizontalLine(separatorLineColor));
				mainContainer.AddChild(cameraContainer);
			}

			AddChild(mainContainer);
			AddHandlers();
			SetVisibleControls();
		}
		protected override void AddChildElements()
		{
			AltGroupBox temperatureGroupBox = new AltGroupBox(new TextWidget("Temperature".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));
			temperatureGroupBox.Margin = new BorderDouble(0);

			FlowLayoutWidget mainContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom);
			mainContainer.HAnchor = HAnchor.ParentLeftRight;
			mainContainer.Margin = new BorderDouble(left: 0);

			TextWidget subheader = new TextWidget("Temporarily override target temperature", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor);
			subheader.Margin = new BorderDouble(bottom: 6);
			mainContainer.AddChild(subheader);

			temperatureGroupBox.AddChild(mainContainer);
			RGBA_Bytes separatorLineColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100);

			int numberOfHeatedExtruders = 1;
			if (!ActiveSliceSettings.Instance.ExtrudersShareTemperature)
			{
				numberOfHeatedExtruders = ActiveSliceSettings.Instance.ExtruderCount;
			}

			if (numberOfHeatedExtruders > 1)
			{
				for (int i = 0; i < numberOfHeatedExtruders; i++)
				{
					DisableableWidget extruderTemperatureControlWidget = new DisableableWidget();
					extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget(i));
					mainContainer.AddChild(extruderTemperatureControlWidget);
					mainContainer.AddChild(new HorizontalLine(separatorLineColor));
					ExtruderWidgetContainers.Add(extruderTemperatureControlWidget);
				}
			}
			else
			{
				DisableableWidget extruderTemperatureControlWidget = new DisableableWidget();
				extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget());
				mainContainer.AddChild(extruderTemperatureControlWidget);
				mainContainer.AddChild(new HorizontalLine(separatorLineColor));
				ExtruderWidgetContainers.Add(extruderTemperatureControlWidget);
			}

			BedTemperatureControlWidget = new DisableableWidget();
			BedTemperatureControlWidget.AddChild(new BedTemperatureControlWidget());

			if (ActiveSliceSettings.Instance.HasHeatedBed())
			{
				mainContainer.AddChild(BedTemperatureControlWidget);
			}

			this.AddChild(temperatureGroupBox);
		}
		public CloudSettingsWidget()
			: base(LocalizedString.Get("Cloud Settings"))
		{
			mainContainer.AddChild(new HorizontalLine(separatorLineColor));

			notificationSettingsContainer = new DisableableWidget();
			notificationSettingsContainer.AddChild(GetNotificationControls());
			mainContainer.AddChild(notificationSettingsContainer);

			AddChild(mainContainer);


			AddHandlers();
		}
		public CalibrationSettingsWidget()
			: base("Calibration".Localize())
		{
			printLevelingContainer = new DisableableWidget();
			if (!ActiveSliceSettings.Instance.HasHardwareLeveling())
			{
				printLevelingContainer.AddChild(GetAutoLevelControl());

				mainContainer.AddChild(printLevelingContainer);
			}

			mainContainer.AddChild(new HorizontalLine(separatorLineColor));

			AddChild(mainContainer);
			AddHandlers();
			SetVisibleControls();
		}
		public TemperatureControls()
		{
			AltGroupBox temperatureGroupBox = new AltGroupBox(new TextWidget("Temperature".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor));
			temperatureGroupBox.Margin = new BorderDouble(0);

			FlowLayoutWidget mainContainer = new FlowLayoutWidget(Agg.UI.FlowDirection.TopToBottom);
			mainContainer.HAnchor = HAnchor.ParentLeftRight;
			mainContainer.Margin = new BorderDouble(left: 0);

			temperatureGroupBox.AddChild(mainContainer);
			RGBA_Bytes separatorLineColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 100);

			int numberOfHeatedExtruders = ActiveSliceSettings.Instance.Helpers.NumberOfHotEnds();
			if (numberOfHeatedExtruders > 1)
			{
				for (int i = 0; i < numberOfHeatedExtruders; i++)
				{
					DisableableWidget extruderTemperatureControlWidget = new DisableableWidget();
					extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget(i));
					mainContainer.AddChild(extruderTemperatureControlWidget);
					mainContainer.AddChild(new HorizontalLine(separatorLineColor));
					ExtruderWidgetContainers.Add(extruderTemperatureControlWidget);
				}
			}
			else
			{
				DisableableWidget extruderTemperatureControlWidget = new DisableableWidget();
				extruderTemperatureControlWidget.AddChild(new ExtruderTemperatureControlWidget());
				mainContainer.AddChild(extruderTemperatureControlWidget);
				mainContainer.AddChild(new HorizontalLine(separatorLineColor));
				ExtruderWidgetContainers.Add(extruderTemperatureControlWidget);
			}

			BedTemperatureControlWidget = new DisableableWidget();
			BedTemperatureControlWidget.AddChild(new BedTemperatureControlWidget());

			if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_heated_bed))
			{
				mainContainer.AddChild(BedTemperatureControlWidget);
			}

			this.AddChild(temperatureGroupBox);
		}
		public CalibrationSettingsWidget()
			: base("Calibration".Localize())
		{
			printLevelingContainer = new DisableableWidget();
			if (!ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_hardware_leveling))
			{
				printLevelingContainer.AddChild(GetAutoLevelControl());

				mainContainer.AddChild(printLevelingContainer);
			}

			mainContainer.AddChild(new HorizontalLine(separatorLineColor));

			AddChild(mainContainer);

			PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(PrinterStatusChanged, ref unregisterEvents);
			PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(PrinterStatusChanged, ref unregisterEvents);

			SetVisibleControls();
		}
Esempio n. 8
0
		/// <summary>
		/// Helper method to create DisableableWidget containers and populate the DisableableWidgets local property.
		/// </summary>
		/// <param name="widget">The widget to wrap.</param>
		private DisableableWidget CreateDisableableContainer(GuiWidget widget)
		{
			var container = new DisableableWidget();
			container.AddChild(widget);
			DisableableWidgets.Add(container);

			return container;
		}