Esempio n. 1
0
        private static GuiWidget DefaultToolTipWidget(string toolTipText)
        {
            var content = new WrappedTextWidget(toolTipText)
            {
                BackgroundColor = Color.White,
                Width           = 350 * GuiWidget.DeviceScale,
                HAnchor         = HAnchor.Fit,
                Padding         = new BorderDouble(3),
            };

            content.AfterDraw += (sender, drawEventHandler) =>
            {
                drawEventHandler.Graphics2D.Rectangle(content.LocalBounds, Color.Black);
            };

            return(content);
        }
	public LicenseAgreementPage()
		: base("Cancel")
	{
		string eulaText = StaticData.Instance.ReadAllText("MatterControl EULA.txt").Replace("\r\n", "\n");

		var scrollable = new ScrollableWidget(true);
		scrollable.AnchorAll();
		scrollable.ScrollArea.HAnchor = HAnchor.ParentLeftRight;
		contentRow.AddChild(scrollable);

		var textBox = new WrappedTextWidget(eulaText, textColor: ActiveTheme.Instance.PrimaryTextColor, doubleBufferText: false)
		{
			DrawFromHintedCache = true,
			Name = "LicenseAgreementPage",
		};
		scrollable.ScrollArea.Margin = new BorderDouble(0, 0, 15, 0);
		scrollable.AddChild(textBox);

		var acceptButton = textImageButtonFactory.Generate("Accept".Localize());
		acceptButton.Click += (s, e) =>
		{
			UserSettings.Instance.set("SoftwareLicenseAccepted", "true");
			UiThread.RunOnIdle(WizardWindow.Close);
		};

		acceptButton.Visible = true;
		cancelButton.Visible = true;

		// Exit if EULA is not accepted
		cancelButton.Click += (s, e) => UiThread.RunOnIdle(MatterControlApplication.Instance.Close);

		//Add buttons to buttonContainer
		footerRow.AddChild(acceptButton);
		footerRow.AddChild(new HorizontalSpacer());
		footerRow.AddChild(cancelButton);

		footerRow.Visible = true;

		UiThread.RunOnIdle(MakeFrontWindow, .2);
	}
		private GuiWidget CreateDetailInfo(string detailText)
		{
			var wrappedText = new WrappedTextWidget(detailText)
			{
				TextColor = ActiveTheme.Instance.PrimaryTextColor,
			};

			var container = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.FitToChildren)
			{
				Margin = new BorderDouble(25, 15, 5, 5),
			};

			container.AddChild(wrappedText);

			return container;
		}
		public ShowAuthPanel()
		{
			WrappedTextWidget userSignInPromptLabel = new WrappedTextWidget("Sign in to access your cloud printer profiles.\n\nOnce signed in you will be able to access:".Localize())
			{
				TextColor = ActiveTheme.Instance.PrimaryTextColor,
			};
			contentRow.AddChild(userSignInPromptLabel);

			AddBulletPointAndDescription(contentRow,
				"Cloud Library".Localize(),
				"Save your designs to the cloud and access them from anywhere in the world. You can also share them any time with with anyone you want.".Localize());
			AddBulletPointAndDescription(contentRow,
				"Cloud Printer Profiles".Localize(),
				"Create your machine settings once, and have them available anywhere you want to print. All your changes appear on all your devices.".Localize());
			AddBulletPointAndDescription(contentRow,
				"Remote Monitoring".Localize(),
				"Check on your prints from anywhere. With cloud monitoring, you have access to your printer no matter where you go.".Localize());

			contentRow.AddChild(new VerticalSpacer());

			CheckBox rememberChoice = new CheckBox("Don't remind me again".Localize(), ActiveTheme.Instance.PrimaryTextColor);
			contentRow.AddChild(rememberChoice);
			rememberChoice.CheckedStateChanged += (s, e) =>
			{
				ApplicationSettings.Instance.set(ApplicationSettingsKey.SuppressAuthPanel, rememberChoice.Checked.ToString());
			};

			var skipButton = textImageButtonFactory.Generate("Skip".Localize());
			skipButton.Name = "Connection Wizard Skip Sign In Button";
			skipButton.Click += (sender, e) =>
			{
				if (!ProfileManager.Instance.ActiveProfiles.Any())
				{
					WizardWindow.ChangeToPage<SetupStepMakeModelName>();
				}
				else
				{
					UiThread.RunOnIdle(WizardWindow.Close);
				}
			};
			var createAccountButton = textImageButtonFactory.Generate("Create Account".Localize());
			createAccountButton.Name = "Create Account From Connection Wizard Button";
			createAccountButton.Margin = new Agg.BorderDouble(right: 5);
			createAccountButton.Click += (s, e) =>
			{
				WizardWindow.ChangeToAccountCreate();
				UiThread.RunOnIdle(WizardWindow.Close);
			};

			var signInButton = textImageButtonFactory.Generate("Sign In".Localize());
			signInButton.Name = "Sign In From Connection Wizard Button";
			signInButton.Click += (s, e) =>
			{
				WizardWindow.ShowAuthDialog?.Invoke();
				UiThread.RunOnIdle(WizardWindow.Close);
			};

			footerRow.AddChild(skipButton);
			footerRow.AddChild(new HorizontalSpacer());
			footerRow.AddChild(createAccountButton);
			footerRow.AddChild(signInButton);
		}
		private void AddInHelpText(FlowLayoutWidget topToBottomSettings, OrganizerSettingsData settingInfo)
		{
			FlowLayoutWidget allText = new FlowLayoutWidget(FlowDirection.TopToBottom);
			allText.HAnchor = HAnchor.ParentLeftRight;
			double textRegionWidth = 380 * TextWidget.GlobalPointSizeScaleRatio;
			allText.Margin = new BorderDouble(3);
			allText.Padding = new BorderDouble(5);
			allText.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;

			double helpPointSize = 10;

			GuiWidget helpWidget = new WrappedTextWidget(settingInfo.HelpText, textRegionWidth, pointSize: helpPointSize, textColor: RGBA_Bytes.White);
			helpWidget.Margin = new BorderDouble(5, 0, 0, 0);
			//helpWidget.HAnchor = HAnchor.ParentLeft;
			allText.AddChild(helpWidget);

			allText.MinimumSize = new Vector2(textRegionWidth, allText.MinimumSize.y);
			topToBottomSettings.AddChild(allText);
		}
		public ImportSucceeded(string successMessage) :
			base("Done", "Import Wizard")
		{
			this.headerLabel.Text = "Import Successful".Localize();

			var container = new FlowLayoutWidget(FlowDirection.TopToBottom)
			{
				HAnchor = HAnchor.ParentLeftRight,
			};
			contentRow.AddChild(container);

			var successMessageWidget = new WrappedTextWidget(successMessage, textColor: ActiveTheme.Instance.PrimaryTextColor);
			container.AddChild(successMessageWidget);

			footerRow.AddChild(new HorizontalSpacer());
			footerRow.AddChild(cancelButton);
		}
		private GuiWidget AddInHelpText(FlowLayoutWidget topToBottomSettings, SliceSettingData settingData)
		{
			FlowLayoutWidget allText = new FlowLayoutWidget(FlowDirection.TopToBottom);
			allText.HAnchor = HAnchor.ParentLeftRight;
			double textRegionWidth = 380 * GuiWidget.DeviceScale;
			allText.Margin = new BorderDouble(0);
			allText.Padding = new BorderDouble(5);
			allText.BackgroundColor = ActiveTheme.Instance.TransparentDarkOverlay;

			double helpPointSize = 10;

			GuiWidget helpWidget = new WrappedTextWidget(settingData.HelpText, pointSize: helpPointSize, textColor: RGBA_Bytes.White);
			helpWidget.Width = textRegionWidth;
			helpWidget.Margin = new BorderDouble(5, 0, 0, 0);
			//helpWidget.HAnchor = HAnchor.ParentLeft;
			allText.AddChild(helpWidget);

			allText.MinimumSize = new Vector2(0, allText.MinimumSize.y);
			return allText;
		}