Exemplo n.º 1
0
 public void LoadHTML(string htmlContent)
 {
     htmlContent = DoTemplateReplacements(htmlContent);
     TextWidget textwdigt = new TextWidget("some test text");
     textwdigt.AnchorCenter();
     AddChild(textwdigt);
 }
		public FlowLayoutWidget createPrinterConnectionMessageContainer()
		{
			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.Margin = new BorderDouble(5);
			BorderDouble elementMargin = new BorderDouble(top: 5);

			TextWidget continueMessage = new TextWidget("Would you like to connect to this printer now?", 0, 0, 12);
			continueMessage.AutoExpandBoundsToText = true;
			continueMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			continueMessage.HAnchor = HAnchor.ParentLeftRight;
			continueMessage.Margin = elementMargin;

			TextWidget continueMessageTwo = new TextWidget("You can always configure this later.", 0, 0, 10);
			continueMessageTwo.AutoExpandBoundsToText = true;
			continueMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			continueMessageTwo.HAnchor = HAnchor.ParentLeftRight;
			continueMessageTwo.Margin = elementMargin;

			printerErrorMessage = new TextWidget("", 0, 0, 10);
			printerErrorMessage.AutoExpandBoundsToText = true;
			printerErrorMessage.TextColor = RGBA_Bytes.Red;
			printerErrorMessage.HAnchor = HAnchor.ParentLeftRight;
			printerErrorMessage.Margin = elementMargin;

			container.AddChild(continueMessage);
			container.AddChild(continueMessageTwo);
			container.AddChild(printerErrorMessage);

			container.HAnchor = HAnchor.ParentLeftRight;
			return container;
		}
        public PrintProgressBar()
        {
            MinimumSize = new Vector2(0, 24);
            HAnchor = HAnchor.ParentLeftRight;
            BackgroundColor = ActiveTheme.Instance.SecondaryAccentColor;
            Margin = new BorderDouble(0);

            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.LeftToRight);
            container.AnchorAll();
            container.Padding = new BorderDouble(6,0);

            printTimeElapsed = new TextWidget("", pointSize:11);
            printTimeElapsed.AutoExpandBoundsToText = true;
            printTimeElapsed.VAnchor = Agg.UI.VAnchor.ParentCenter;


            printTimeRemaining = new TextWidget("", pointSize: 11);
            printTimeRemaining.AutoExpandBoundsToText = true;
            printTimeRemaining.VAnchor = Agg.UI.VAnchor.ParentCenter;

            GuiWidget spacer = new GuiWidget();
            spacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

            container.AddChild(printTimeElapsed);
            container.AddChild(spacer);
            container.AddChild(printTimeRemaining);

            AddChild(container);
            AddHandlers();
            SetThemedColors();
            UpdatePrintStatus();            
            UiThread.RunOnIdle(OnIdle);
        }
        private FlowLayoutWidget createPrinterNameContainer()
        {
            FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
            container.Margin = new BorderDouble(0, 5);
            BorderDouble elementMargin = new BorderDouble(top: 3);

			string printerNameLabelTxt = new LocalizedString("Printer Name").Translated;
			string printerNameLabelTxtFull = string.Format ("{0}:", printerNameLabelTxt);
			TextWidget printerNameLabel = new TextWidget(printerNameLabelTxtFull, 0, 0, 12);
            printerNameLabel.TextColor = this.defaultTextColor;
            printerNameLabel.HAnchor = HAnchor.ParentLeftRight;
            printerNameLabel.Margin = new BorderDouble(0, 0, 0, 1);

            printerNameInput = new MHTextEditWidget(this.ActivePrinter.Name);
            printerNameInput.HAnchor = HAnchor.ParentLeftRight;

			printerNameError = new TextWidget(new LocalizedString("Give your printer a name.").Translated, 0, 0, 10);
            printerNameError.TextColor = RGBA_Bytes.White;
            printerNameError.HAnchor = HAnchor.ParentLeftRight;
            printerNameError.Margin = elementMargin;

            container.AddChild(printerNameLabel);
            container.AddChild(printerNameInput);
            container.AddChild(printerNameError);
            container.HAnchor = HAnchor.ParentLeftRight;
            return container;
        }
Exemplo n.º 5
0
		public MenuPage()
			: base("Menu Controls")
		{
			//GuiWidget.DebugBoundsUnderMouse = true;
			BackgroundColor = RGBA_Bytes.Green;
			lastAction = new TextWidget("Last Menu Action");
			lastAction.OriginRelativeParent = new Vector2(100, 250);
			AddChild(lastAction);

			Menu dropListMenu = new Menu(new TextWidget("gAction v"));
			dropListMenu.Name = "ListMenu Down";
			AddMenu(dropListMenu, "Walk");
			AddMenu(dropListMenu, "Jog");
			AddMenu(dropListMenu, "Run");
			dropListMenu.OriginRelativeParent = new Vector2(100, 200);
			AddChild(dropListMenu);

			Menu longMenue = new Menu(new TextWidget("very long"), maxHeight: 50);
			longMenue.Name = "ListMenu Down";
			for (int i = 0; i < 30; i++)
			{
				AddMenu(longMenue, "menu {0}".FormatWith(i));
			}
			longMenue.OriginRelativeParent = new Vector2(100, 300);
			AddChild(longMenue);

			Menu raiseListMenu = new Menu(new TextWidget("jAction ^"), Direction.Up);
			raiseListMenu.Name = "ListMenu Up";
			AddMenu(raiseListMenu, "Walk");
			AddMenu(raiseListMenu, "Jog");
			AddMenu(raiseListMenu, "Run");
			raiseListMenu.OriginRelativeParent = new Vector2(200, 200);
			AddChild(raiseListMenu);

			MenuBar mainMenu = new MenuBar();
			mainMenu.VAnchor = UI.VAnchor.ParentTop;

			PopupMenu popupMenu = new PopupMenu(new TextWidget("Simple Menu"));
			popupMenu.OriginRelativeParent = new Vector2(100, 100);
			//AddChild(popupMenu);

			DropDownList dropDownList = new DropDownList("- Select Something -", RGBA_Bytes.Black, RGBA_Bytes.Gray);

			dropDownList.BackgroundColor = RGBA_Bytes.Black;
			dropDownList.TextColor = RGBA_Bytes.White;

			dropDownList.MenuItemsPadding = new BorderDouble(13);
			dropDownList.MenuItemsBorderWidth = 3;
			dropDownList.MenuItemsBorderColor = RGBA_Bytes.Red;
			dropDownList.MenuItemsBackgroundColor = RGBA_Bytes.Blue;
			dropDownList.MenuItemsTextColor = RGBA_Bytes.White;
			dropDownList.MenuItemsTextHoverColor = RGBA_Bytes.Yellow;

			dropDownList.Name = "Drop Down List";
			dropDownList.AddItem("Item 1", "value1");
			dropDownList.AddItem("Item 2 long name");
			dropDownList.AddItem("Item 3 realy long name");
			dropDownList.OriginRelativeParent = new Vector2(300, 200);
			AddChild(dropDownList);
		}
Exemplo n.º 6
0
		public ControlButtonViewBase(string label,
									 double width,
									 double height,
									 double textHeight,
									 double borderWidth,
									 double borderRadius,
									 double padding,
									 RGBA_Bytes textColor,
									 RGBA_Bytes fillColor,
									 RGBA_Bytes borderColor)
			: base(width, height)
		{
			this.borderRadius = borderRadius;
			this.borderWidth = borderWidth;
			this.fillColor = fillColor;
			this.borderColor = borderColor;
			this.padding = padding;

			TextWidget buttonText = new TextWidget(label, textHeight);
			buttonText.VAnchor = VAnchor.ParentCenter;
			buttonText.HAnchor = HAnchor.ParentCenter;
			buttonText.TextColor = textColor;

			//this.AnchorAll();
			this.AddChild(buttonText);
		}
		private int extruderIndex; //For multiple materials

		public PresetSelectorWidget(string label, RGBA_Bytes accentColor, string tag, int extruderIndex)
			: base(FlowDirection.TopToBottom)
		{
			this.extruderIndex = extruderIndex;
			this.filterLabel = label;
			this.filterTag = (tag == null) ? label.ToLower() : tag;
			
			this.HAnchor = HAnchor.ParentLeftRight;
			this.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
			this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			GuiWidget accentBar = new GuiWidget(7, 5)
			{
				BackgroundColor = accentColor,
				HAnchor = HAnchor.ParentLeftRight
			};

			TextWidget labelText = new TextWidget(label.Localize().ToUpper())
			{
				TextColor = ActiveTheme.Instance.PrimaryTextColor,
				HAnchor = Agg.UI.HAnchor.ParentCenter,
				Margin = new BorderDouble(0, 3, 0, 6)
			};

			this.AddChild(labelText);
			this.AddChild(GetPulldownContainer());
			this.AddChild(new VerticalSpacer());
			this.AddChild(accentBar);
		}
		public SyncingPrintersPage()
			: base("Close")
		{
			TextWidget syncingText = new TextWidget("Syncing Profiles...".Localize(),textColor: ActiveTheme.Instance.PrimaryTextColor);
			syncingDetails = new TextWidget("Retrieving sync information...".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize:10);
			syncingDetails.AutoExpandBoundsToText = true;
			contentRow.AddChild(syncingText);
			contentRow.AddChild(syncingDetails);
			Progress<SyncReportType> progress = new Progress<SyncReportType>(ReportProgress);

			ApplicationController.SyncPrinterProfiles("SyncingPrintersPage.ctor()", progress).ContinueWith((task) =>
			{
				if (!ProfileManager.Instance.ActiveProfiles.Any())
				{
					// Switch to setup wizard if no profiles exist
					WizardWindow.ChangeToSetupPrinterForm();
				}
				else if (ProfileManager.Instance.ActiveProfiles.Count() == 1)
				{
					//Set as active printer
					ActiveSliceSettings.SwitchToProfile(ProfileManager.Instance.ActiveProfiles.First().ID);
					// only close the window if we are not switching to the setup printer form
					UiThread.RunOnIdle(WizardWindow.Close);
				}
				else // multiple printers - close the window
				{
					UiThread.RunOnIdle(WizardWindow.Close);
				}
			});
			footerRow.AddChild(new HorizontalSpacer());
			footerRow.AddChild(cancelButton);
		}
		private int presetIndex; //For multiple materials

		public SliceSelectorWidget(string label, RGBA_Bytes accentColor, string tag = null, int presetIndex = 1)
			: base(FlowDirection.TopToBottom)
		{
			this.presetIndex = presetIndex;
			this.filterLabel = label;
			if (tag == null)
			{
				this.filterTag = label.ToLower();
			}
			else
			{
				this.filterTag = tag;
			}

			this.HAnchor = HAnchor.ParentLeftRight;
			this.VAnchor = Agg.UI.VAnchor.Max_FitToChildren_ParentHeight;
			this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			GuiWidget accentBar = new GuiWidget(7, 5);
			accentBar.BackgroundColor = accentColor;
			accentBar.HAnchor = HAnchor.ParentLeftRight;


			TextWidget labelText = new TextWidget(LocalizedString.Get(label).ToUpper());
			labelText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			labelText.HAnchor = Agg.UI.HAnchor.ParentCenter;
			labelText.Margin = new BorderDouble(0, 3, 0, 6);

			this.AddChild(labelText);
			this.AddChild(GetPulldownContainer());
			this.AddChild(new VerticalSpacer());
			this.AddChild(accentBar);
		}
Exemplo n.º 10
0
        GuiWidget CreateOptionsMenu()
        {
            ImageBuffer gearImage = new ImageBuffer();
            string imagePathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "gear_icon.png");
            ImageBMPIO.LoadImageData(imagePathAndFile, gearImage);

            FlowLayoutWidget leftToRight = new FlowLayoutWidget();
            leftToRight.Margin = new BorderDouble(5, 0);
            string optionsString = new LocalizedString("Options").Translated;
            TextWidget optionsText = new TextWidget(optionsString, textColor: RGBA_Bytes.White);
            optionsText.VAnchor = Agg.UI.VAnchor.ParentCenter;
            optionsText.Margin = new BorderDouble(0, 0, 3, 0);
            leftToRight.AddChild(optionsText);
            GuiWidget gearWidget = new ImageWidget(gearImage);
            gearWidget.VAnchor = Agg.UI.VAnchor.ParentCenter;
            leftToRight.AddChild(gearWidget);
            leftToRight.HAnchor = HAnchor.FitToChildren;
            leftToRight.VAnchor = VAnchor.FitToChildren;

            Menu optionMenu = new Menu(leftToRight);
            optionMenu.OpenOffset = new Vector2(-2, -10);
            optionMenu.VAnchor = Agg.UI.VAnchor.ParentCenter;
            optionMenu.MenuItems.Add(new MenuItem(new ThemeColorSelectorWidget()));

            return optionMenu;
        }
		public FlowLayoutWidget createPrinterConnectionMessageContainer()
		{
			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.VAnchor = VAnchor.ParentBottomTop;
			container.Margin = new BorderDouble(5);
			BorderDouble elementMargin = new BorderDouble(top: 5);

			string printerMessageOneText = "MatterControl will now attempt to auto-detect printer.".Localize();
			TextWidget printerMessageOne = new TextWidget(printerMessageOneText, 0, 0, 10);
			printerMessageOne.Margin = new BorderDouble(0, 10, 0, 5);
			printerMessageOne.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			printerMessageOne.HAnchor = HAnchor.ParentLeftRight;
			printerMessageOne.Margin = elementMargin;

			string disconnectMessage = string.Format("1.) {0} ({1}).", "Disconnect printer".Localize(), "if currently connected".Localize());
			TextWidget printerMessageTwo = new TextWidget(disconnectMessage, 0, 0, 12);
			printerMessageTwo.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			printerMessageTwo.HAnchor = HAnchor.ParentLeftRight;
			printerMessageTwo.Margin = elementMargin;

			string printerMessageThreeBeg = "Power on and connect printer".Localize();
			string printerMessageThreeFull = string.Format("2.) {0}.", printerMessageThreeBeg);
			TextWidget printerMessageThree = new TextWidget(printerMessageThreeFull, 0, 0, 12);
            printerMessageThree.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            printerMessageThree.HAnchor = HAnchor.ParentLeftRight;
            printerMessageThree.Margin = elementMargin;

			string printerMessageFourTxtBeg = "Press".Localize();
			string printerMessageFourTxtEnd = "Connect".Localize();
			string printerMessageFourTxtFull = string.Format("3.) {0} '{1}'.", printerMessageFourTxtBeg, printerMessageFourTxtEnd);
			TextWidget printerMessageFour = new TextWidget(printerMessageFourTxtFull, 0, 0, 12);
            printerMessageFour.TextColor = ActiveTheme.Instance.PrimaryTextColor;
            printerMessageFour.HAnchor = HAnchor.ParentLeftRight;
            printerMessageFour.Margin = elementMargin;

			GuiWidget vSpacer = new GuiWidget();
			vSpacer.VAnchor = VAnchor.ParentBottomTop;

			Button manualLink = linkButtonFactory.Generate("Manual Configuration".Localize());
			manualLink.Margin = new BorderDouble(0, 5);
			manualLink.Click += (s, e) => WizardWindow.ChangeToPage<SetupStepComPortManual>();

			printerErrorMessage = new TextWidget("", 0, 0, 10);
			printerErrorMessage.AutoExpandBoundsToText = true;
			printerErrorMessage.TextColor = RGBA_Bytes.Red;
			printerErrorMessage.HAnchor = HAnchor.ParentLeftRight;
			printerErrorMessage.Margin = elementMargin;

			container.AddChild(printerMessageOne);
			container.AddChild(printerMessageTwo);
			container.AddChild(printerMessageThree);
			container.AddChild(printerMessageFour);
			container.AddChild(printerErrorMessage);
			container.AddChild(vSpacer);
			container.AddChild(manualLink);

			container.HAnchor = HAnchor.ParentLeftRight;
			return container;
		}
		public TemperatureWidgetBase(string textValue)
			: base(52 * TextWidget.GlobalPointSizeScaleRatio, 52 * TextWidget.GlobalPointSizeScaleRatio)
		{
			whiteButtonFactory.FixedHeight = 18 * TextWidget.GlobalPointSizeScaleRatio;
			whiteButtonFactory.fontSize = 7;
			whiteButtonFactory.normalFillColor = RGBA_Bytes.White;
			whiteButtonFactory.normalTextColor = RGBA_Bytes.DarkGray;

			FlowLayoutWidget container = new FlowLayoutWidget(FlowDirection.TopToBottom);
			container.AnchorAll();

			this.BackgroundColor = new RGBA_Bytes(255, 255, 255, 200);
			this.Margin = new BorderDouble(0, 2) * TextWidget.GlobalPointSizeScaleRatio;

			GuiWidget labelContainer = new GuiWidget();
			labelContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			labelContainer.Height = 18 * TextWidget.GlobalPointSizeScaleRatio;

			labelTextWidget = new TextWidget("", pointSize: 8);
			labelTextWidget.AutoExpandBoundsToText = true;
			labelTextWidget.HAnchor = HAnchor.ParentCenter;
			labelTextWidget.VAnchor = VAnchor.ParentCenter;
			labelTextWidget.TextColor = ActiveTheme.Instance.SecondaryAccentColor;
			labelTextWidget.Visible = false;

			labelContainer.AddChild(labelTextWidget);

			GuiWidget indicatorContainer = new GuiWidget();
			indicatorContainer.AnchorAll();

			indicatorTextWidget = new TextWidget(textValue, pointSize: 11);
			indicatorTextWidget.TextColor = ActiveTheme.Instance.PrimaryAccentColor;
			indicatorTextWidget.HAnchor = HAnchor.ParentCenter;
			indicatorTextWidget.VAnchor = VAnchor.ParentCenter;
			indicatorTextWidget.AutoExpandBoundsToText = true;

			indicatorContainer.AddChild(indicatorTextWidget);

			GuiWidget buttonContainer = new GuiWidget();
			buttonContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
			buttonContainer.Height = 18 * TextWidget.GlobalPointSizeScaleRatio;

			preheatButton = whiteButtonFactory.Generate("Preheat".Localize().ToUpper());
			preheatButton.Cursor = Cursors.Hand;
			preheatButton.Visible = false;

			buttonContainer.AddChild(preheatButton);

			container.AddChild(labelContainer);
			container.AddChild(indicatorContainer);
			container.AddChild(buttonContainer);

			this.AddChild(container);
			ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents);

			this.MouseEnterBounds += onEnterBounds;
			this.MouseLeaveBounds += onLeaveBounds;
			this.preheatButton.Click += onPreheatButtonClick;
		}
 TextWidget CreateNextLine(string startText)
 {
     TextWidget nextLine = new TextWidget(startText, textColor: RGBA_Bytes.White);
     nextLine.Margin = new BorderDouble(0, 2);
     nextLine.HAnchor = Agg.UI.HAnchor.ParentLeft;
     nextLine.AutoExpandBoundsToText = true;
     return nextLine;
 }
		private TextWidget CreateNextLine(string startText)
		{
			TextWidget nextLine = new TextWidget(startText, textColor: ActiveTheme.Instance.PrimaryTextColor);
			nextLine.Margin = new BorderDouble(0, 2);
			nextLine.HAnchor = Agg.UI.HAnchor.ParentLeft;
			nextLine.AutoExpandBoundsToText = true;
			return nextLine;
		}
		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);
			}
		}
		private async void LoadHistoryItems()
		{
			TextWidget loadingText = new TextWidget("Retrieving History from Web...");
			loadingText.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			scrollWindow.AddChild(loadingText);

			var results = await ApplicationController.GetProfileHistory(ProfileManager.Instance.ActiveProfile.DeviceToken);
			printerProfileData = results;
			if(printerProfileData != null)
			{
				loadingText.Visible= false;

				List<DateTime> sourceTimes = new List<DateTime>();
				foreach (var printerProfile in results.OrderByDescending(d => d.Key))
				{
					// AppEngine results are current in the form of: "2016-07-21 00:43:30.965830"
					sourceTimes.Add(Convert.ToDateTime(printerProfile.Key).ToLocalTime());
				}

				var groupedTimes = RelativeTime.GroupTimes(DateTime.Now, sourceTimes);

				FlowLayoutWidget topToBottomStuff = new FlowLayoutWidget(FlowDirection.TopToBottom);
				scrollWindow.AddChild(topToBottomStuff);
				foreach (var group in groupedTimes)
				{
					// add in the group header
					topToBottomStuff.AddChild(new TextWidget(RelativeTime.BlockDescriptions[group.Key], textColor: ActiveTheme.Instance.PrimaryTextColor)
					{
						Margin = new BorderDouble(0, 0, 0, 5),
					});

					foreach (var time in group.Value)
					{
						// add in the radio buttons
						var profileVersionButton = new RadioButton(time.Value, textColor: ActiveTheme.Instance.PrimaryTextColor)
						{
							Margin = new BorderDouble(5, 0),
						};
						profileVersionButton.Checked = false;
						radioButtonList.Add(profileVersionButton);
						topToBottomStuff.AddChild(profileVersionButton);
					}
				}

				foreach(var printerProfile in results)
				{
					orderedProfiles.Add(printerProfile.Key.ToString());
				}
			}
			else
			{
				loadingText.Text = "Failed To Download History!";
				loadingText.TextColor = RGBA_Bytes.Red;
			}
			
			//remove loading profile text/icon
		}
Exemplo n.º 17
0
		private void AddText(string tabText, GuiWidget widgetState, RGBA_Bytes textColor, RGBA_Bytes backgroundColor, double pointSize)
		{
			tabTitle = new TextWidget(tabText, pointSize: pointSize, textColor: textColor);
			tabTitle.AutoExpandBoundsToText = true;
			widgetState.AddChild(tabTitle);
			widgetState.Selectable = false;
			widgetState.SetBoundsToEncloseChildren();
			widgetState.BackgroundColor = backgroundColor;
		}
Exemplo n.º 18
0
        public UpdateControl()
        {
            textImageButtonFactory.normalFillColor = ActiveTheme.Instance.PrimaryTextColor;
            textImageButtonFactory.normalTextColor = RGBA_Bytes.Black;

            HAnchor = HAnchor.ParentLeftRight;
            BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
            Padding = new BorderDouble(6, 5);
            {
                updateStatusText = new TextWidget(string.Format(""), textColor: offWhite);
                updateStatusText.AutoExpandBoundsToText = true;
                updateStatusText.VAnchor = VAnchor.ParentCenter;

                GuiWidget horizontalSpacer = new GuiWidget();
                horizontalSpacer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;

				checkUpdateLink = textImageButtonFactory.Generate(new LocalizedString("Check for Update").Translated);
                checkUpdateLink.VAnchor = VAnchor.ParentCenter;
                checkUpdateLink.Click += CheckForUpdate;
                checkUpdateLink.Visible = false;

				downloadUpdateLink = textImageButtonFactory.Generate(new LocalizedString("Download Update").Translated);
                downloadUpdateLink.VAnchor = VAnchor.ParentCenter;
                downloadUpdateLink.Click += DownloadUpdate;
                downloadUpdateLink.Visible = false;


				installUpdateLink = textImageButtonFactory.Generate(new LocalizedString("Install Update").Translated);
                installUpdateLink.VAnchor = VAnchor.ParentCenter;
                installUpdateLink.Click += InstallUpdate;
                installUpdateLink.Visible = false;

                AddChild(updateStatusText);
                AddChild(horizontalSpacer);
                AddChild(checkUpdateLink);
                AddChild(downloadUpdateLink);
                AddChild(installUpdateLink);
            }

            CheckVersionStatus();
            if (ApplicationSettings.Instance.get("ClientToken") != null)
            {
                //If we have already requested an update once, check on load
                CheckForUpdate(this, null);
            }
            else
            {
                DataStorage.ApplicationSession firstSession;
                firstSession = DataStorage.Datastore.Instance.dbSQLite.Table<DataStorage.ApplicationSession>().OrderBy(v => v.SessionStart).Take(1).FirstOrDefault();
                if (firstSession != null
                    && DateTime.Compare(firstSession.SessionStart.AddDays(7), DateTime.Now) < 0)
                {
                    NeedToCheckForUpdateFirstTimeEver = true;
                }
            }
        }
Exemplo n.º 19
0
		private void AddMenu(Menu listMenuToAddTo, string name)
		{
			GuiWidget normal = new TextWidget(name);
			normal.BackgroundColor = RGBA_Bytes.White;
			GuiWidget hover = new TextWidget(name);
			hover.BackgroundColor = RGBA_Bytes.LightGray;
			MenuItem menuItem = new MenuItem(new MenuItemStatesView(normal, hover));
			menuItem.Selected += (sender, e) => { lastAction.Text = name; };
			listMenuToAddTo.MenuItems.Add(menuItem);
		}
Exemplo n.º 20
0
		public RadioButtonViewText(string label)
		{
			labelTextWidget = new TextWidget(label, 12);
			AddChild(labelTextWidget);

			LocalBounds = GetLocalBounds();

			inactiveColor = new RGBA_Bytes(0.0, 0.0, 0.0);
			activeColor = new RGBA_Bytes(0.4, 0.0, 0.0);
		}
Exemplo n.º 21
0
 public ProgressControl(string message)
 {
     textWidget = new TextWidget(message, textColor: RGBA_Bytes.White);
     textWidget.AutoExpandBoundsToText = true;
     textWidget.Margin = new BorderDouble(5, 0);
     AddChild(textWidget);
     bar = new GuiWidget(80, 15);
     bar.VAnchor = Agg.UI.VAnchor.ParentCenter;
     AddChild(bar);
 }
		public TextImageWidget(string label, RGBA_Bytes fillColor, RGBA_Bytes borderColor, RGBA_Bytes textColor, double borderWidth, BorderDouble margin, ImageBuffer image = null, double fontSize = 12, FlowDirection flowDirection = FlowDirection.LeftToRight, double height = 40, double width = 0, bool centerText = false, double imageSpacing = 0)
			: base()
		{
			this.image = image;
			this.fillColor = fillColor;
			this.borderColor = borderColor;
			this.borderWidth = borderWidth;
			this.Margin = new BorderDouble(0);
			this.Padding = new BorderDouble(0);

			TextWidget textWidget = new TextWidget(label, pointSize: fontSize);
			ImageWidget imageWidget;

			FlowLayoutWidget container = new FlowLayoutWidget(flowDirection);

			if (centerText)
			{
				// make sure the contents are centered
				GuiWidget leftSpace = new GuiWidget(0, 1);
				leftSpace.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
				container.AddChild(leftSpace);
			}

			if (image != null && image.Width > 0)
			{
				imageWidget = new ImageWidget(image);
				imageWidget.VAnchor = VAnchor.ParentCenter;
				imageWidget.Margin = new BorderDouble(right: imageSpacing);
				container.AddChild(imageWidget);
			}

			if (label != "")
			{
				textWidget.VAnchor = VAnchor.ParentCenter;
				textWidget.TextColor = textColor;
				textWidget.Padding = new BorderDouble(3, 0);
				container.AddChild(textWidget);
			}

			if (centerText)
			{
				GuiWidget rightSpace = new GuiWidget(0, 1);
				rightSpace.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
				container.AddChild(rightSpace);

				container.HAnchor = Agg.UI.HAnchor.ParentLeftRight | Agg.UI.HAnchor.FitToChildren;
			}
			container.VAnchor = Agg.UI.VAnchor.ParentCenter;

			container.MinimumSize = new Vector2(width, height);
			container.Margin = margin;
			this.AddChild(container);
			HAnchor = HAnchor.ParentLeftRight | HAnchor.FitToChildren;
			VAnchor = VAnchor.ParentCenter | Agg.UI.VAnchor.FitToChildren;
		}
Exemplo n.º 23
0
        public void AddTextField(string instructionsText, int pixelsFromLast)
        {
            GuiWidget spacer = new GuiWidget(10, pixelsFromLast);
            topToBottomControls.AddChild(spacer);

            string wrappedInstructions = TypeFacePrinter.InsertCRs(instructionsText, 400, 12);
            string wrappedInstructionsTabsToSpaces = wrappedInstructions.Replace("\t", "    ");
            TextWidget instructionsWidget = new TextWidget(wrappedInstructionsTabsToSpaces, textColor: RGBA_Bytes.White);
            instructionsWidget.HAnchor = Agg.UI.HAnchor.ParentCenter;
            topToBottomControls.AddChild(instructionsWidget);
        }
		public DropDownMenu(string topMenuText, Direction direction = Direction.Down, double pointSize = 12)
			: base(direction)
		{
			TextWidget textWidget = new TextWidget(topMenuText, pointSize: pointSize);
			textWidget.TextColor = this.TextColor;
			TextColorChanged += (s, e) => textWidget.TextColor = this.TextColor;
			textWidget.AutoExpandBoundsToText = true;
			this.Name = topMenuText + " Menu";

			SetStates(textWidget);
		}
		public SetupConnectionWidgetBase(ConnectionWindow windowController, GuiWidget containerWindowToClose, PrinterSetupStatus printerSetupStatus = null)
			: base(windowController, containerWindowToClose)
		{
			SetDisplayAttributes();

			if (printerSetupStatus == null)
			{
				this.currentPrinterSetupStatus = new PrinterSetupStatus();
			}
			else
			{
				this.currentPrinterSetupStatus = printerSetupStatus;
			}

			cancelButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel"));
			cancelButton.Name = "Setup Connection Cancel Button";
			cancelButton.Click += new EventHandler(CancelButton_Click);

			//Create the main container
			GuiWidget mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
			mainContainer.AnchorAll();
			mainContainer.Padding = new BorderDouble(3, 5, 3, 5);
			mainContainer.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			//Create the header row for the widget
			headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			headerRow.Margin = new BorderDouble(0, 3, 0, 0);
			headerRow.Padding = new BorderDouble(0, 3, 0, 3);
			headerRow.HAnchor = HAnchor.ParentLeftRight;
			{
				string defaultHeaderTitle = LocalizedString.Get("3D Printer Setup");
				headerLabel = new TextWidget(defaultHeaderTitle, pointSize: 14);
				headerLabel.AutoExpandBoundsToText = true;
				headerLabel.TextColor = this.defaultTextColor;
				headerRow.AddChild(headerLabel);
			}

			//Create the main control container
			contentRow = new FlowLayoutWidget(FlowDirection.TopToBottom);
			contentRow.Padding = new BorderDouble(5);
			contentRow.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
			contentRow.HAnchor = HAnchor.ParentLeftRight;
			contentRow.VAnchor = VAnchor.ParentBottomTop;

			//Create the footer (button) container
			footerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
			footerRow.HAnchor = HAnchor.ParentLeft | HAnchor.ParentRight;
			footerRow.Margin = new BorderDouble(0, 3);

			mainContainer.AddChild(headerRow);
			mainContainer.AddChild(contentRow);
			mainContainer.AddChild(footerRow);
			this.AddChild(mainContainer);
		}
 public void StartingNextPart(object sender, EventArgs e)
 {
     count++;
     StringEventArgs stringEvent = e as StringEventArgs;
     if (stringEvent != null)
     {
         string partDescription = string.Format("{0}/{1} '{2}'", count, totalParts, stringEvent.Data);
         nextLine.Text = partDescription;
         nextLine = CreateNextLine("");
         feedback.AddChild(nextLine);
     }
 }
Exemplo n.º 27
0
		public FatFlatClickWidget(TextWidget textWidget)
		{
			overlay = new GuiWidget();
			overlay.AnchorAll();
			overlay.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;
			overlay.Visible = false;

			this.GetChildClicks = true;

			this.AddChild(textWidget);
			this.AddChild(overlay);
		}
		private FlowLayoutWidget GetCameraControl()
		{
			FlowLayoutWidget buttonRow = new FlowLayoutWidget();
			buttonRow.HAnchor = HAnchor.ParentLeftRight;
			buttonRow.Margin = new BorderDouble(0, 4);

			ImageBuffer cameraIconImage = StaticData.Instance.LoadIcon("camera-24x24.png",24,24).InvertLightness();
			cameraIconImage.SetRecieveBlender(new BlenderPreMultBGRA());
			int iconSize = (int)(24 * GuiWidget.DeviceScale);

			if (!ActiveTheme.Instance.IsDarkTheme)
			{
				cameraIconImage.InvertLightness();
			}

			ImageWidget cameraIcon = new ImageWidget(cameraIconImage);
			cameraIcon.Margin = new BorderDouble(right: 6);

			TextWidget cameraLabel = new TextWidget("Camera Monitoring".Localize());
			cameraLabel.AutoExpandBoundsToText = true;
			cameraLabel.TextColor = ActiveTheme.Instance.PrimaryTextColor;
			cameraLabel.VAnchor = VAnchor.ParentCenter;

			openCameraButton = textImageButtonFactory.Generate("Preview".Localize().ToUpper());
			openCameraButton.Click += new EventHandler(openCameraPreview_Click);
			openCameraButton.Margin = new BorderDouble(left: 6);

			buttonRow.AddChild(cameraIcon);
			buttonRow.AddChild(cameraLabel);
			buttonRow.AddChild(new HorizontalSpacer());
			buttonRow.AddChild(openCameraButton);

			if (ApplicationSettings.Instance.get(ApplicationSettingsKey.HardwareHasCamera) == "true")
			{
				GuiWidget publishImageSwitchContainer = new FlowLayoutWidget();
				publishImageSwitchContainer.VAnchor = VAnchor.ParentCenter;
				publishImageSwitchContainer.Margin = new BorderDouble(left: 16);

				CheckBox toggleSwitch = ImageButtonFactory.CreateToggleSwitch(ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.publish_bed_image));
				toggleSwitch.CheckedStateChanged += (sender, e) =>
				{
					CheckBox thisControl = sender as CheckBox;
					ActiveSliceSettings.Instance.SetValue(SettingsKey.publish_bed_image, thisControl.Checked ? "1" : "0");
				};
				publishImageSwitchContainer.AddChild(toggleSwitch);

				publishImageSwitchContainer.SetBoundsToEncloseChildren();

				buttonRow.AddChild(publishImageSwitchContainer);
			}

			return buttonRow;
		}
		public void AddTextField(string instructionsText, int pixelsFromLast)
		{
			GuiWidget spacer = new GuiWidget(10, pixelsFromLast);
			topToBottomControls.AddChild(spacer);

			EnglishTextWrapping wrapper = new EnglishTextWrapping(12);
			string wrappedInstructions = wrapper.InsertCRs(instructionsText, 400);
			string wrappedInstructionsTabsToSpaces = wrappedInstructions.Replace("\t", "    ");
			TextWidget instructionsWidget = new TextWidget(wrappedInstructionsTabsToSpaces, textColor: ActiveTheme.Instance.PrimaryTextColor);
			instructionsWidget.HAnchor = Agg.UI.HAnchor.ParentLeft;
			topToBottomControls.AddChild(instructionsWidget);
		}
		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);
		}