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
        }
        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)
            {
                //Task.Run((Action)AutomationTest);
                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 (AfterFirstDraw != null)
                {
                    AfterFirstDraw();
                }

                UiThread.RunOnIdle(() =>
                {
                    //StyledMessageBox.ShowMessageBox(null, "message that is long and wraps. message that is long and wraps. message that is long and wraps." , "caption", StyledMessageBox.MessageType.YES_NO);
                    // show a dialog to tell the user there is an update
                });
            }

            //msGraph.AddData("ms", totalDrawTime.ElapsedMilliseconds);
            //msGraph.Draw(MatterHackers.Agg.Transform.Affine.NewIdentity(), graphics2D);
        }
        public override void OnDraw(Graphics2D graphics2D)
        {
            totalDrawTime.Restart();
            GuiWidget.DrawCount = 0;
            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}, drawCount = {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
                foreach (CreatorInformation creatorInfo in RegisteredCreators.Instance.Creators)
                {
                    if (creatorInfo.description.Contains("Image"))
                    {
                        creatorInfo.functionToLaunchCreator(null, null);
                    }
                }
#endif
            }

            //msGraph.AddData("ms", totalDrawTime.ElapsedMilliseconds);
            //msGraph.Draw(MatterHackers.Agg.Transform.Affine.NewIdentity(), graphics2D);
        }
Exemple #4
0
        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();

            //HtmlWindowTest();

            IsLoading = false;
        }
        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);
        }