//PartPreview3DGcode part3DGcodeView;

        public PartPreviewMainWindow(PrintItemWrapper printItem)
            : base(690, 340)
        {
            string partPreviewTitle = new LocalizedString("MatterControl").Translated;

            Title = string.Format("{0}: ", partPreviewTitle) + Path.GetFileName(printItem.Name);

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            TabControl tabControl = new TabControl();

            tabControl.TabBar.BorderColor     = new RGBA_Bytes(0, 0, 0, 0);
            tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

            string part3DViewLblBeg  = ("3D");
            string part3DViewLblEnd  = new LocalizedString("View").Translated;
            string part3DViewLblFull = string.Format("{0} {1} ", part3DViewLblBeg, part3DViewLblEnd);

            part3DView = new View3DTransformPart(printItem, new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), ActiveSliceSettings.Instance.BedShape);
            TabPage partPreview3DView = new TabPage(part3DView, part3DViewLblFull);

            partGcodeView = new GcodeViewBasic(printItem, ActiveSliceSettings.Instance.GetBedSize, ActiveSliceSettings.Instance.GetBedCenter);
            TabPage layerView = new TabPage(partGcodeView, new LocalizedString("Layer View").Translated);

            //part3DGcodeView = new PartPreview3DGcode(printItem.FileLocation, bedXSize, bedYSize);

            tabControl.AddTab(new SimpleTextTabWidget(partPreview3DView, 16,
                                                      ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));

            tabControl.AddTab(new SimpleTextTabWidget(layerView, 16,
                                                      ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));

            this.AddChild(tabControl);
            this.AnchorAll();

            AddHandlers();

            Width  = 640;
            Height = 480;

            ShowAsSystemWindow();
            MinimumSize = new Vector2(400, 300);

            // We do this after showing the system window so that when we try and take fucus the parent window (the system window)
            // exists and can give the fucus to its child the gecode window.
            if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE")
            {
                tabControl.TabBar.SwitchToPage(layerView);
                partGcodeView.Focus();
            }
        }
        //PartPreview3DGcode part3DGcodeView;

        public PartPreviewMainWindow(PrintItemWrapper printItem)
            : base(690, 340)
        {
			string partPreviewTitle = new LocalizedString ("MatterControl").Translated;
			Title = string.Format("{0}: ", partPreviewTitle) + Path.GetFileName(printItem.Name);

            BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            TabControl tabControl = new TabControl();
            tabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0);
            tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;

            double buildHeight = ActiveSliceSettings.Instance.BuildHeight;

			string part3DViewLblBeg = ("3D");
			string part3DViewLblEnd = new LocalizedString ("View").Translated;
			string part3DViewLblFull = string.Format("{0} {1} ", part3DViewLblBeg, part3DViewLblEnd);
            part3DView = new View3DTransformPart(printItem, new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), ActiveSliceSettings.Instance.BedShape);
			TabPage partPreview3DView = new TabPage(part3DView, part3DViewLblFull);

            partGcodeView = new GcodeViewBasic(printItem, ActiveSliceSettings.Instance.GetBedSize, ActiveSliceSettings.Instance.GetBedCenter);
			TabPage layerView = new TabPage(partGcodeView, new LocalizedString("Layer View").Translated);

            //part3DGcodeView = new PartPreview3DGcode(printItem.FileLocation, bedXSize, bedYSize);

            tabControl.AddTab(new SimpleTextTabWidget(partPreview3DView , 16,
                        ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));

            tabControl.AddTab(new SimpleTextTabWidget(layerView, 16,
                        ActiveTheme.Instance.TabLabelSelected, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()));       

            this.AddChild(tabControl);
            this.AnchorAll();

            AddHandlers();

            Width = 640;
            Height = 480;

            ShowAsSystemWindow();
            MinimumSize = new Vector2(400, 300);

            // We do this after showing the system window so that when we try and take fucus the parent window (the system window)
            // exists and can give the fucus to its child the gecode window.
            if (Path.GetExtension(printItem.FileLocation).ToUpper() == ".GCODE")
            {
                tabControl.TabBar.SwitchToPage(layerView);
                partGcodeView.Focus();
            }
        }