コード例 #1
0
		public RunningMacroPage(string message, bool showOkButton, bool showMaterialSelector, double expectedSeconds, double expectedTemperature)
					: base("Close", "Macro Feedback")
		{
			TextWidget syncingText = new TextWidget(message, textColor: ActiveTheme.Instance.PrimaryTextColor);
			contentRow.AddChild(syncingText);

			footerRow.AddChild(new HorizontalSpacer());
			footerRow.AddChild(cancelButton);

			if (showMaterialSelector)
			{
				int extruderIndex = 0;
				contentRow.AddChild(new PresetSelectorWidget(string.Format($"{"Material".Localize()} {extruderIndex + 1}"), RGBA_Bytes.Orange, NamedSettingsLayers.Material, extruderIndex));
			}

			var holder = new FlowLayoutWidget();
			progressBar = new ProgressBar((int)(150 * GuiWidget.DeviceScale), (int)(15 * GuiWidget.DeviceScale))
			{
				FillColor = ActiveTheme.Instance.PrimaryAccentColor,
				BorderColor = ActiveTheme.Instance.PrimaryTextColor,
				//HAnchor = HAnchor.ParentCenter,
				Margin = new BorderDouble(3, 0, 0, 10),
			};
			progressBarText = new TextWidget("", pointSize: 10, textColor: ActiveTheme.Instance.PrimaryTextColor)
			{
				AutoExpandBoundsToText = true,
				Margin = new BorderDouble(5, 0, 0, 0),
			};
			holder.AddChild(progressBar);
			holder.AddChild(progressBarText);
			contentRow.AddChild(holder);
			progressBar.Visible = false;

			if (expectedSeconds > 0)
			{
				timeToWaitMs = (long)(expectedSeconds * 1000);
				endTimeMs = UiThread.CurrentTimerMs + timeToWaitMs;
				UiThread.RunOnIdle(CountDownTime, 1);
				progressBar.Visible = true;
			}

			PrinterConnectionAndCommunication.Instance.WroteLine.RegisterEvent(LookForTempRequest, ref unregisterEvents);

			if (showOkButton)
			{
				Button okButton = textImageButtonFactory.Generate("Continue".Localize());
				okButton.Margin = new BorderDouble(0, 0, 0, 25);
				okButton.HAnchor = HAnchor.ParentCenter;

				okButton.Click += (s, e) =>
				{
					PrinterConnectionAndCommunication.Instance.MacroContinue();
					UiThread.RunOnIdle(() => WizardWindow?.Close());
				};

				contentRow.AddChild(okButton);
			}
		}
コード例 #2
0
		public ProgressControl(string message, RGBA_Bytes textColor, RGBA_Bytes fillColor, int barWidgth = 80, int barHeight = 15)
		{
			processTextWidget = new TextWidget(message, textColor: textColor);
			processTextWidget.AutoExpandBoundsToText = true;
			processTextWidget.Margin = new BorderDouble(5, 0);
			processTextWidget.VAnchor = VAnchor.ParentCenter;
			AddChild(processTextWidget);

            progressBar = new ProgressBar(barWidgth, barHeight)
            {
                FillColor = fillColor,
            };

			progressBar.VAnchor = VAnchor.ParentCenter;
			AddChild(progressBar);
			progressTextWidget = new TextWidget("", textColor: textColor, pointSize: 8);
			progressTextWidget.AutoExpandBoundsToText = true;
			progressTextWidget.VAnchor = VAnchor.ParentCenter;
			progressTextWidget.Margin = new BorderDouble(5, 0);
			AddChild(progressTextWidget);
		}
コード例 #3
0
		private void AddLoadingProgressBar()
		{
			processingProgressControl = new ProgressBar(ActiveTheme.Instance.SecondaryAccentColor, (int)(100 * TextWidget.GlobalPointSizeScaleRatio), 5);
			processingProgressControl.BackgroundColor = RGBA_Bytes.White;
			processingProgressControl.VAnchor = VAnchor.ParentBottom;
			processingProgressControl.HAnchor = HAnchor.ParentLeft;
			processingProgressControl.Margin = new BorderDouble(thumbnailWidth + 3, 3, 3, 3);
			processingProgressControl.Visible = false;
			this.AddChild(processingProgressControl);
		}