public MatterControlApplication(double width, double height)
            : base(width, height)
        {
            this.commandLineArgs = Environment.GetCommandLineArgs();;
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            //WriteTestGCodeFile();
            if (File.Exists("RunUnitTests.txt"))
            {
                GuiHalWidget.SetClipboardFunctions(System.Windows.Forms.Clipboard.GetText, System.Windows.Forms.Clipboard.SetText, System.Windows.Forms.Clipboard.ContainsText);

                MatterHackers.Agg.Tests.UnitTests.Run();
                MatterHackers.VectorMath.Tests.UnitTests.Run();
                MatterHackers.Agg.UI.Tests.UnitTests.Run();
                MatterHackers.PolygonMesh.UnitTests.UnitTests.Run();

                // you can turn this on to debug some bounds issues
                //GuiWidget.DebugBoundsUnderMouse = true;
            }

            GuiWidget.DefaultEnforceIntegerBounds = true;

            FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);

            allControls.AnchorAll();

            this.AddChild(allControls);
            this.Padding = new BorderDouble(0); //To be re-enabled once native borders are turned off

            //allControls.AddChild(CreateMenues());
            allControls.AddChild(new ActionBarPlus());
            allControls.AddChild(MainSlidePanel.Instance);

#if false // this is to test freeing gcodefile memory
            Button test = new Button("test");
            test.Click += (sender, e) =>
            {
                //MatterHackers.GCodeVisualizer.GCodeFile gcode = new GCodeVisualizer.GCodeFile();
                //gcode.Load(@"C:\Users\lbrubaker\Downloads\drive assy.gcode");
                SystemWindow window = new SystemWindow(100, 100);
                window.ShowAsSystemWindow();
            };
            allControls.AddChild(test);
#endif
            this.AnchorAll();

            UseOpenGL = true;
            Title     = "MatterControl (beta)";

            PrinterCommunication.Instance.Initialize();
            UiThread.RunOnIdle(CheckOnPrinter);

            ShowAsSystemWindow();
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            GuiHalFactory.SetGuiBackend(GuiHalFactory.KnownGuiFactoriesIndexes.WindowsFormsBitmap);
            //GuiHalFactory.SetGuiBackend(GuiHalFactory.KnownGuiFactoriesIndexes.WindowsFormsOpenGL);

            CameraCalibrationWidgetFactory appWidgetFactory = new CameraCalibrationWidgetFactory();

            AppWidgetInfo appWidgetInfo = appWidgetFactory.GetAppParameters();
            GuiHalWidget  primaryWindow = GuiHalFactory.CreatePrimarySurface(appWidgetInfo.width, appWidgetInfo.height, GuiHalWidget.CreateFlags.Resizable, GuiHalWidget.PixelFormat.PixelFormatBgra32);

            //GuiHalWidget primaryWindow = GuiHalFactory.CreatePrimarySurface(appWidgetInfo.width, appWidgetInfo.height, GuiHalWidget.CreateFlags.Resizable, GuiHalWidget.PixelFormat.PixelFormatBgr24);
            //GuiHalWidget primaryWindow = GuiHalFactory.CreatePrimarySurface(appWidgetInfo.width, appWidgetInfo.height, GuiHalWidget.CreateFlags.Resizable, GuiHalWidget.PixelFormat.PixelFormatRgbaFloat);

            primaryWindow.Caption = appWidgetInfo.caption;

            primaryWindow.AddChild(appWidgetFactory.NewWidget());
            primaryWindow.Run();
        }
Ejemplo n.º 3
0
        public MatterControlApplication(double width, double height)
            : base(width, height)
        {
            this.commandLineArgs = Environment.GetCommandLineArgs();
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            if (commandLineArgs.Length > 1)
            {
                switch (commandLineArgs[1].ToUpper())
                {
                case "TEST":
                    Testing.TestingDispatch testDispatch = new Testing.TestingDispatch();
                    string[] testCommands = new string[commandLineArgs.Length - 2];
                    if (commandLineArgs.Length > 2)
                    {
                        commandLineArgs.CopyTo(testCommands, 2);
                    }
                    testDispatch.RunTests(testCommands);
                    return;

                case "SHOW_MEMORY":
                    ShowMemoryUsed = true;
                    break;

                case "DO_GC_COLLECT_EVERY_DRAW":
                    ShowMemoryUsed       = true;
                    DoCGCollectEveryDraw = true;
                    break;

                case "SHOW_DRAW_TIMING":
                    ShowDrawTimingWindow = true;
                    break;
                }
            }

            //WriteTestGCodeFile();
            if (File.Exists("RunUnitTests.txt"))
            {
                GuiHalWidget.SetClipboardFunctions(System.Windows.Forms.Clipboard.GetText, System.Windows.Forms.Clipboard.SetText, System.Windows.Forms.Clipboard.ContainsText);

                MatterHackers.Agg.Tests.UnitTests.Run();
                MatterHackers.VectorMath.Tests.UnitTests.Run();
                MatterHackers.Agg.UI.Tests.UnitTests.Run();
                MatterHackers.PolygonMesh.UnitTests.UnitTests.Run();

                // you can turn this on to debug some bounds issues
                //GuiWidget.DebugBoundsUnderMouse = true;
            }

            GuiWidget.DefaultEnforceIntegerBounds = true;

            FlowLayoutWidget allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);

            allControls.AnchorAll();

            this.AddChild(allControls);
            this.Padding = new BorderDouble(0); //To be re-enabled once native borders are turned off

            //allControls.AddChild(CreateMenues());
            allControls.AddChild(new ActionBarPlus());
            allControls.AddChild(MainSlidePanel.Instance);

#if false // this is to test freeing gcodefile memory
            Button test = new Button("test");
            test.Click += (sender, e) =>
            {
                //MatterHackers.GCodeVisualizer.GCodeFile gcode = new GCodeVisualizer.GCodeFile();
                //gcode.Load(@"C:\Users\lbrubaker\Downloads\drive assy.gcode");
                SystemWindow window = new SystemWindow(100, 100);
                window.ShowAsSystemWindow();
            };
            allControls.AddChild(test);
#endif
            this.AnchorAll();

            UseOpenGL = true;
            Title     = "MatterControl (beta)";

            ActivePrinterProfile.CheckForAndDoAutoConnect();
            UiThread.RunOnIdle(CheckOnPrinter);

            ShowAsSystemWindow();
        }