public override void OnLoad(EventArgs args)
        {
            foreach (string arg in commandLineArgs)
            {
                string argExtension = Path.GetExtension(arg).ToUpper();
                if (argExtension.Length > 1 &&
                    MeshFileIo.ValidFileExtensions().Contains(argExtension))
                {
                    QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileName(arg), Path.GetFullPath(arg))));
                }
            }

            TerminalWindow.ShowIfLeftOpen();

            ApplicationController.Instance.OnLoadActions();

#if false
            {
                SystemWindow releaseNotes        = new SystemWindow(640, 480);
                string       releaseNotesFile    = Path.Combine("C:/Users/LarsBrubaker/Downloads", "test1.html");
                string       releaseNotesContent = StaticData.Instance.ReadAllText(releaseNotesFile);
                HtmlWidget   content             = new HtmlWidget(releaseNotesContent, RGBA_Bytes.Black);
                content.AddChild(new GuiWidget(HAnchor.AbsolutePosition, VAnchor.ParentBottomTop));
                content.VAnchor        |= VAnchor.ParentTop;
                content.BackgroundColor = RGBA_Bytes.White;
                releaseNotes.AddChild(content);
                releaseNotes.BackgroundColor = RGBA_Bytes.Cyan;
                UiThread.RunOnIdle((state) =>
                {
                    releaseNotes.ShowAsSystemWindow();
                }, 1);
            }
#endif
        }
        private static void HtmlWindowTest()
        {
            try
            {
                SystemWindow htmlTestWindow = new SystemWindow(640, 480);
                string       htmlContent    = "";
                if (true)
                {
                    string releaseNotesFile = Path.Combine("C:\\Users\\lbrubaker\\Downloads", "test1.html");
                    htmlContent = File.ReadAllText(releaseNotesFile);
                }
                else
                {
                    WebClient webClient = new WebClient();
                    htmlContent = webClient.DownloadString("http://www.matterhackers.com/s/store?q=pla");
                }

                HtmlWidget content = new HtmlWidget(htmlContent, RGBA_Bytes.Black);
                content.AddChild(new GuiWidget(HAnchor.AbsolutePosition, VAnchor.ParentBottomTop));
                content.VAnchor        |= VAnchor.ParentTop;
                content.BackgroundColor = RGBA_Bytes.White;
                htmlTestWindow.AddChild(content);
                htmlTestWindow.BackgroundColor = RGBA_Bytes.Cyan;
                UiThread.RunOnIdle((state) =>
                {
                    htmlTestWindow.ShowAsSystemWindow();
                }, 1);
            }
            catch
            {
                int stop = 1;
            }
        }
Пример #3
0
        public AboutWidget()
        {
            this.HAnchor = HAnchor.ParentLeftRight;
            this.VAnchor = VAnchor.ParentTop;

            this.Padding         = new BorderDouble(5);
            this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            FlowLayoutWidget customInfoTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);

            customInfoTopToBottom.Name    = "AboutPageCustomInfo";
            customInfoTopToBottom.HAnchor = HAnchor.ParentLeftRight;
            customInfoTopToBottom.VAnchor = VAnchor.Max_FitToChildren_ParentHeight;
            customInfoTopToBottom.Padding = new BorderDouble(5, 10, 5, 0);

            if (UserSettings.Instance.IsTouchScreen)
            {
                customInfoTopToBottom.AddChild(new UpdateControlView());
            }

            //AddMatterHackersInfo(customInfoTopToBottom);
            customInfoTopToBottom.AddChild(new GuiWidget(1, 10));

            string aboutHtmlFile = Path.Combine("OEMSettings", "AboutPage.html");
            string htmlContent   = StaticData.Instance.ReadAllText(aboutHtmlFile);

#if false // test
            {
                SystemWindow releaseNotes        = new SystemWindow(640, 480);
                string       releaseNotesFile    = Path.Combine("OEMSettings", "ReleaseNotes.html");
                string       releaseNotesContent = StaticData.Instance.ReadAllText(releaseNotesFile);
                HtmlWidget   content             = new HtmlWidget(releaseNotesContent, RGBA_Bytes.Black);
                content.AddChild(new GuiWidget(HAnchor.AbsolutePosition, VAnchor.ParentBottomTop));
                content.VAnchor        |= VAnchor.ParentTop;
                content.BackgroundColor = RGBA_Bytes.White;
                releaseNotes.AddChild(content);
                releaseNotes.BackgroundColor = RGBA_Bytes.Cyan;
                UiThread.RunOnIdle((state) =>
                {
                    releaseNotes.ShowAsSystemWindow();
                }, 1);
            }
#endif

            HtmlWidget htmlWidget = new HtmlWidget(htmlContent, ActiveTheme.Instance.PrimaryTextColor);

            customInfoTopToBottom.AddChild(htmlWidget);

            this.AddChild(customInfoTopToBottom);
        }
Пример #4
0
		public AboutWidget()
		{
			this.HAnchor = HAnchor.ParentLeftRight;
			this.VAnchor = VAnchor.ParentTop;

			this.Padding = new BorderDouble(5);
			this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

			FlowLayoutWidget customInfoTopToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
			customInfoTopToBottom.Name = "AboutPageCustomInfo";
			customInfoTopToBottom.HAnchor = HAnchor.ParentLeftRight;
			customInfoTopToBottom.VAnchor = VAnchor.Max_FitToChildren_ParentHeight;
			customInfoTopToBottom.Padding = new BorderDouble(5, 10, 5, 0);

			if (ActiveTheme.Instance.IsTouchScreen)
			{
				customInfoTopToBottom.AddChild(new UpdateControlView());
			}

			//AddMatterHackersInfo(customInfoTopToBottom);
			customInfoTopToBottom.AddChild(new GuiWidget(1, 10));

			string aboutHtmlFile = Path.Combine("OEMSettings", "AboutPage.html");
			string htmlContent = StaticData.Instance.ReadAllText(aboutHtmlFile); 

#if false // test
			{
				SystemWindow releaseNotes = new SystemWindow(640, 480);
				string releaseNotesFile = Path.Combine("OEMSettings", "ReleaseNotes.html");
				string releaseNotesContent = StaticData.Instance.ReadAllText(releaseNotesFile);
				HtmlWidget content = new HtmlWidget(releaseNotesContent, RGBA_Bytes.Black);
				content.AddChild(new GuiWidget(HAnchor.AbsolutePosition, VAnchor.ParentBottomTop));
				content.VAnchor |= VAnchor.ParentTop;
				content.BackgroundColor = RGBA_Bytes.White;
				releaseNotes.AddChild(content);
				releaseNotes.BackgroundColor = RGBA_Bytes.Cyan;
				UiThread.RunOnIdle((state) =>
				{
					releaseNotes.ShowAsSystemWindow();
				}, 1);
			}
#endif

			HtmlWidget htmlWidget = new HtmlWidget(htmlContent, ActiveTheme.Instance.PrimaryTextColor);

			customInfoTopToBottom.AddChild(htmlWidget);

			this.AddChild(customInfoTopToBottom);
		}
        public override void OnDraw(Graphics2D graphics2D)
        {
            totalDrawTime.Restart();
            GuiWidget.DrawCount = 0;
            using (new PerformanceTimer("Draw Timer", "MC Draw"))
            {
                base.OnDraw(graphics2D);
            }
            totalDrawTime.Stop();

            millisecondTimer.Update((int)totalDrawTime.ElapsedMilliseconds);

            if (ShowMemoryUsed)
            {
                long memory = GC.GetTotalMemory(false);
                this.Title = "Allocated = {0:n0} : {1:000}ms, d{2} Size = {3}x{4}, onIdle = {5:00}:{6:00}, widgetsDrawn = {7}".FormatWith(memory, millisecondTimer.GetAverage(), drawCount++, this.Width, this.Height, UiThread.CountExpired, UiThread.Count, GuiWidget.DrawCount);
                if (DoCGCollectEveryDraw)
                {
                    GC.Collect();
                }
            }

            if (firstDraw)
            {
                firstDraw = false;
                foreach (string arg in commandLineArgs)
                {
                    string argExtension = Path.GetExtension(arg).ToUpper();
                    if (argExtension.Length > 1 &&
                        MeshFileIo.ValidFileExtensions().Contains(argExtension))
                    {
                        QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileName(arg), Path.GetFullPath(arg))));
                    }
                }

                TerminalWindow.ShowIfLeftOpen();

#if false
                {
                    SystemWindow releaseNotes        = new SystemWindow(640, 480);
                    string       releaseNotesFile    = Path.Combine("C:/Users/LarsBrubaker/Downloads", "test1.html");
                    string       releaseNotesContent = StaticData.Instance.ReadAllText(releaseNotesFile);
                    HtmlWidget   content             = new HtmlWidget(releaseNotesContent, RGBA_Bytes.Black);
                    content.AddChild(new GuiWidget(HAnchor.AbsolutePosition, VAnchor.ParentBottomTop));
                    content.VAnchor        |= VAnchor.ParentTop;
                    content.BackgroundColor = RGBA_Bytes.White;
                    releaseNotes.AddChild(content);
                    releaseNotes.BackgroundColor = RGBA_Bytes.Cyan;
                    UiThread.RunOnIdle((state) =>
                    {
                        releaseNotes.ShowAsSystemWindow();
                    }, 1);
                }
#endif

                AfterFirstDraw?.Invoke();

                if (false && UserSettings.Instance.get("SoftwareLicenseAccepted") != "true")
                {
                    UiThread.RunOnIdle(() => WizardWindow.Show <LicenseAgreementPage>("SoftwareLicense", "Software License Agreement"));
                }

                if (!ProfileManager.Instance.ActiveProfiles.Any())
                {
                    // Start the setup wizard if no profiles exist
                    UiThread.RunOnIdle(() => WizardWindow.Show());
                }
            }

            //msGraph.AddData("ms", totalDrawTime.ElapsedMilliseconds);
            //msGraph.Draw(MatterHackers.Agg.Transform.Affine.NewIdentity(), graphics2D);
        }
		private static void HtmlWindowTest()
		{
			try
			{
				SystemWindow htmlTestWindow = new SystemWindow(640, 480);
				string htmlContent = "";
				if (true)
				{
					string releaseNotesFile = Path.Combine("C:\\Users\\lbrubaker\\Downloads", "test1.html");
					htmlContent = File.ReadAllText(releaseNotesFile);
				}
				else
				{
					WebClient webClient = new WebClient();
					htmlContent = webClient.DownloadString("http://www.matterhackers.com/s/store?q=pla");
				}

				HtmlWidget content = new HtmlWidget(htmlContent, RGBA_Bytes.Black);
				content.AddChild(new GuiWidget(HAnchor.AbsolutePosition, VAnchor.ParentBottomTop));
				content.VAnchor |= VAnchor.ParentTop;
				content.BackgroundColor = RGBA_Bytes.White;
				htmlTestWindow.AddChild(content);
				htmlTestWindow.BackgroundColor = RGBA_Bytes.Cyan;
				UiThread.RunOnIdle((state) =>
				{
					htmlTestWindow.ShowAsSystemWindow();
				}, 1);
			}
			catch
			{
				int stop = 1;
			}
		}
        public override void OnDraw(Graphics2D graphics2D)
		{
			totalDrawTime.Restart();
			GuiWidget.DrawCount = 0;
			using (new PerformanceTimer("Draw Timer", "MC Draw"))
			{
				base.OnDraw(graphics2D);
			}
			totalDrawTime.Stop();

			millisecondTimer.Update((int)totalDrawTime.ElapsedMilliseconds);

			if (ShowMemoryUsed)
			{
				long memory = GC.GetTotalMemory(false);
				this.Title = "Allocated = {0:n0} : {1:000}ms, d{2} Size = {3}x{4}, onIdle = {5:00}:{6:00}, widgetsDrawn = {7}".FormatWith(memory, millisecondTimer.GetAverage(), drawCount++, this.Width, this.Height, UiThread.CountExpired, UiThread.Count, GuiWidget.DrawCount);
				if (DoCGCollectEveryDraw)
				{
					GC.Collect();
				}
			}

			if (firstDraw)
			{
				UiThread.RunOnIdle(DoAutoConnectIfRequired);

				firstDraw = false;
				foreach (string arg in commandLineArgs)
				{
					string argExtension = Path.GetExtension(arg).ToUpper();
					if (argExtension.Length > 1
						&& MeshFileIo.ValidFileExtensions().Contains(argExtension))
					{
						QueueData.Instance.AddItem(new PrintItemWrapper(new DataStorage.PrintItem(Path.GetFileName(arg), Path.GetFullPath(arg))));
					}
				}

				TerminalWindow.ShowIfLeftOpen();

#if false
			{
				SystemWindow releaseNotes = new SystemWindow(640, 480);
				string releaseNotesFile = Path.Combine("C:/Users/LarsBrubaker/Downloads", "test1.html");
				string releaseNotesContent = StaticData.Instance.ReadAllText(releaseNotesFile);
				HtmlWidget content = new HtmlWidget(releaseNotesContent, RGBA_Bytes.Black);
				content.AddChild(new GuiWidget(HAnchor.AbsolutePosition, VAnchor.ParentBottomTop));
				content.VAnchor |= VAnchor.ParentTop;
				content.BackgroundColor = RGBA_Bytes.White;
				releaseNotes.AddChild(content);
				releaseNotes.BackgroundColor = RGBA_Bytes.Cyan;
				UiThread.RunOnIdle((state) =>
				{
					releaseNotes.ShowAsSystemWindow();
				}, 1);
			}
#endif

				AfterFirstDraw?.Invoke();
			}

			//msGraph.AddData("ms", totalDrawTime.ElapsedMilliseconds);
			//msGraph.Draw(MatterHackers.Agg.Transform.Affine.NewIdentity(), graphics2D);
		}