Esempio n. 1
0
        public override void OnDraw(Graphics2D graphics2D)
        {
            if (ShowDrawTimingWindow)
            {
                ExecutionTimer.Instance.Reset();
                totalDrawTime.Restart();
            }

            drawTimer.Start();
            base.OnDraw(graphics2D);
            drawTimer.Stop();

            if (ShowMemoryUsed)
            {
                totalDrawTime.Stop();
                long memory = GC.GetTotalMemory(false);
                this.Title = string.Format("Allocated = {0:n0} : {1}ms, d{2} Size = {3}x{4}", memory, totalDrawTime.ElapsedMilliseconds, drawCount++, this.Width, this.Height);
                if (DoCGCollectEveryDraw)
                {
                    GC.Collect();
                }
            }

            if (ShowDrawTimingWindow)
            {
                if (timingWindow == null)
                {
                    timingWindow = new PerformanceFeedbackWindow();
                }

                if (totalDrawTime.Elapsed.TotalSeconds > .05)
                {
                    timingWindow.ShowResults(totalDrawTime.Elapsed.TotalSeconds);
                }
            }

            if (firstDraw)
            {
                Parent.MinimumSize = new Vector2(590, 540);
                firstDraw          = false;
                foreach (string arg in commandLineArgs)
                {
                    if (Path.GetExtension(arg).ToUpper() == ".STL")
                    {
                        new PartPreviewMainWindow(new PrintItemWrapper(new DataStorage.PrintItem(Path.GetFileName(arg), Path.GetFullPath(arg))));
                    }
                }
            }
        }
        public override void OnDraw(Graphics2D graphics2D)
        {
#if DEBUG
            ExecutionTimer.Instance.Reset();
            totalDrawTime.Restart();
#endif
            drawTimer.Start();
            base.OnDraw(graphics2D);
            drawTimer.Stop();

#if DEBUG // this is to debug memory allocation and freeing
            totalDrawTime.Stop();
            long memory = GC.GetTotalMemory(false);
            this.Title = string.Format("Allocated = {0:n0} : {1}ms, d{2} Size = {3}x{4}", memory, totalDrawTime.ElapsedMilliseconds, drawCount++, this.Width, this.Height);

#if false
            if (timingWindow == null)
            {
                string   staticDataPath = ApplicationDataStorage.Instance.ApplicationStaticDataPath;
                string   fontPath       = Path.Combine(staticDataPath, "Fonts", "LiberationMono.svg");
                TypeFace boldTypeFace   = TypeFace.LoadSVG(fontPath);
                typeFaceToUse = new StyledTypeFace(boldTypeFace, 12);

                timingWindow = new PerformanceFeedbackWindow();
            }
            {
                if (totalDrawTime.Elapsed.TotalSeconds > .05)
                {
                    timingWindow.ShowResults(totalDrawTime.Elapsed.TotalSeconds);
                }
            }
#endif
#endif

            if (firstDraw)
            {
                Parent.MinimumSize = new Vector2(590, 540);
                firstDraw          = false;
                foreach (string arg in commandLineArgs)
                {
                    if (Path.GetExtension(arg).ToUpper() == ".STL")
                    {
                        new PartPreviewMainWindow(new PrintItemWrapper(new DataStorage.PrintItem(Path.GetFileName(arg), Path.GetFullPath(arg))));
                    }
                }
            }
        }
Esempio n. 3
0
        public override void OnDraw(Graphics2D graphics2D)
        {
            ExecutionTimer.Instance.Reset();

            totalDrawTime.Restart();
            partPreviewDraw.Start();
            base.OnDraw(graphics2D);
            partPreviewDraw.Stop();
            totalDrawTime.Stop();
#if true //DEBUG
#if false
            if (timingWindow == null)
            {
                string   staticDataPath = ApplicationDataStorage.Instance.ApplicationStaticDataPath;
                string   fontPath       = Path.Combine(staticDataPath, "Fonts", "LiberationMono.svg");
                TypeFace boldTypeFace   = TypeFace.LoadSVG(fontPath);
                timingWindow = new PerformanceFeedbackWindow(new StyledTypeFace(boldTypeFace, 12));
                //}
                //{
                timingWindow.ShowResults(totalDrawTime.Elapsed.TotalSeconds);
            }
#endif
#endif
        }
        public override void OnDraw(Graphics2D graphics2D)
        {
            if (ShowDrawTimingWindow)
            {
                ExecutionTimer.Instance.Reset();
                totalDrawTime.Restart();
            }

            drawTimer.Start();
            base.OnDraw(graphics2D);
            drawTimer.Stop();

            if (ShowMemoryUsed)
            {
                totalDrawTime.Stop();
                long memory = GC.GetTotalMemory(false);
                this.Title = string.Format("Allocated = {0:n0} : {1}ms, d{2} Size = {3}x{4}", memory, totalDrawTime.ElapsedMilliseconds, drawCount++, this.Width, this.Height);
                if (DoCGCollectEveryDraw)
                {
                    GC.Collect();
                }
            }

            if (ShowDrawTimingWindow)
            {
                if (timingWindow == null)
                {
                    timingWindow = new PerformanceFeedbackWindow();
                }

                if (totalDrawTime.Elapsed.TotalSeconds > .05)
                {
                    timingWindow.ShowResults(totalDrawTime.Elapsed.TotalSeconds);
                }
            }

            if (firstDraw)
            {
                Parent.MinimumSize = new Vector2(590, 540);
                firstDraw = false;
                foreach (string arg in commandLineArgs)
                {
                    if (Path.GetExtension(arg).ToUpper() == ".STL")
                    {
                        new PartPreviewMainWindow(new PrintItemWrapper(new DataStorage.PrintItem(Path.GetFileName(arg), Path.GetFullPath(arg))));
                    }
                }
            }
        }
        public override void OnDraw(Graphics2D graphics2D)
        {
            ExecutionTimer.Instance.Reset(); 
            
            totalDrawTime.Restart();
            partPreviewDraw.Start();
            base.OnDraw(graphics2D);
            partPreviewDraw.Stop();
            totalDrawTime.Stop();
#if true //DEBUG
#if false
            if (timingWindow == null)
            {
                string staticDataPath = ApplicationDataStorage.Instance.ApplicationStaticDataPath;
                string fontPath = Path.Combine(staticDataPath, "Fonts", "LiberationMono.svg");
                TypeFace boldTypeFace = TypeFace.LoadSVG(fontPath);
                timingWindow = new PerformanceFeedbackWindow(new StyledTypeFace(boldTypeFace, 12));
            //}
            //{
                timingWindow.ShowResults(totalDrawTime.Elapsed.TotalSeconds);
            }
#endif
#endif
        }