Ejemplo n.º 1
0
 private void bug_Click()
 {
     UiThread.RunOnIdle(() =>
     {
         ContactFormWindow.Open();
     });
 }
Ejemplo n.º 2
0
 bool bug_Click()
 {
     UiThread.RunOnIdle((state) =>
     {
         ContactFormWindow.Open();
     });
     return(true);
 }
Ejemplo n.º 3
0
        public bool IsValid()
        {
            try
            {
                if (LayerHeight > NozzleDiameter)
                {
                    string error    = new LocalizedString("'Layer Height' must be less than or equal to the 'Nozzle Diameter'.").Translated;
                    string details  = string.Format("Layer Height = {0}\nNozzle Diameter = {1}", LayerHeight, NozzleDiameter);
                    string location = new LocalizedString("Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'").Translated;
                    StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
                    return(false);
                }
                else if (FirstLayerHeight > NozzleDiameter)
                {
                    string error    = new LocalizedString("First Layer Height' must be less than or equal to the 'Nozzle Diameter'.").Translated;
                    string details  = string.Format("First Layer Height = {0}\nNozzle Diameter = {1}", FirstLayerHeight, NozzleDiameter);
                    string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'";
                    StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
                    return(false);
                }

                if (MinFanSpeed > 100)
                {
                    string error    = "The Min Fan Speed can only go as high as 100%.";
                    string details  = string.Format("It is currently set to {0}.", MinFanSpeed);
                    string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Fillament' -> 'Cooling' (show all settings)";
                    StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
                    return(false);
                }

                if (MaxFanSpeed > 100)
                {
                    string error    = "The Max Fan Speed can only go as high as 100%.";
                    string details  = string.Format("It is currently set to {0}.", MaxFanSpeed);
                    string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Fillament' -> 'Cooling' (show all settings)";
                    StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
                    return(false);
                }
            }
            catch (Exception e)
            {
                string stackTraceNoBackslashRs = e.StackTrace.Replace("\r", "");
                ContactFormWindow.Open("Parse Error while slicing", e.Message + stackTraceNoBackslashRs);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
 protected override IEnumerable <MenuItemAction> GetMenuItems()
 {
     return(new List <MenuItemAction>
     {
         new MenuItemAction("Getting Started".Localize(), () => MatterControlApplication.Instance.LaunchBrowser("http://www.mattercontrol.com/articles/mattercontrol-getting-started")),
         new MenuItemAction("View Help".Localize(), () => MatterControlApplication.Instance.LaunchBrowser("http://www.mattercontrol.com/articles")),
         new MenuItemAction("Release Notes".Localize(), () => MatterControlApplication.Instance.LaunchBrowser("http://wiki.mattercontrol.com/Release_Notes")),
         new MenuItemAction("User Manual".Localize(), () => MatterControlApplication.Instance.LaunchBrowser("http://wiki.mattercontrol.com")),
         new MenuItemAction("------------------------", null),
         new MenuItemAction("Report a Bug".Localize(), () => ContactFormWindow.Open()),
         new MenuItemAction("Check For Update".Localize(), () =>
         {
             ApplicationMenuRow.AlwaysShowUpdateStatus = true;
             UpdateControlData.Instance.CheckForUpdateUserRequested();
             CheckForUpdateWindow.Show();
         }),
         new MenuItemAction("------------------------", null),
         new MenuItemAction("About MatterControl".Localize(), () => AboutWindow.Show()),
     });
 }
Ejemplo n.º 5
0
        private void AddContent(HtmlParser htmlParser, string htmlContent)
        {
            ElementState elementState = htmlParser.CurrentElementState;
            string       decodedHtml  = HtmlParser.UrlDecode(htmlContent);

            switch (elementState.TypeName)
            {
            case "p":
            {
                elementsUnderConstruction.Push(new FlowLayoutWidget());
                elementsUnderConstruction.Peek().Name    = "p";
                elementsUnderConstruction.Peek().HAnchor = HAnchor.ParentLeftRight;

                if (decodedHtml != null && decodedHtml != "")
                {
                    WrappingTextWidget content = new WrappingTextWidget(decodedHtml, pointSize: elementState.PointSize, textColor: ActiveTheme.Instance.PrimaryTextColor);
                    //content.VAnchor = VAnchor.ParentTop;
                    elementsUnderConstruction.Peek().AddChild(content);
                }
            }
            break;

            case "div":
            {
                elementsUnderConstruction.Push(new FlowLayoutWidget());
                elementsUnderConstruction.Peek().Name = "div";

                if (decodedHtml != null && decodedHtml != "")
                {
                    TextWidget content = new TextWidget(decodedHtml, pointSize: elementState.PointSize, textColor: ActiveTheme.Instance.PrimaryTextColor);
                    elementsUnderConstruction.Peek().AddChild(content);
                }
            }
            break;

            case "!DOCTYPE":
                break;

            case "body":
                break;

            case "img":
            {
                ImageBuffer image = new ImageBuffer(elementState.SizeFixed.x, elementState.SizeFixed.y, 32, new BlenderBGRA());
                ImageWidget_AsyncLoadOnDraw imageWidget = new ImageWidget_AsyncLoadOnDraw(image, elementState.src);
                // put the image into the widget when it is done downloading.

                if (elementsUnderConstruction.Peek().Name == "a")
                {
                    Button linkButton = new Button(0, 0, imageWidget);
                    linkButton.Cursor = Cursors.Hand;
                    linkButton.Click += (sender, mouseEvent) =>
                    {
                        MatterControlApplication.Instance.LaunchBrowser(elementState.Href);
                    };
                    elementsUnderConstruction.Peek().AddChild(linkButton);
                }
                else
                {
                    elementsUnderConstruction.Peek().AddChild(imageWidget);
                }
            }
            break;

            case "a":
            {
                elementsUnderConstruction.Push(new FlowLayoutWidget());
                elementsUnderConstruction.Peek().Name = "a";

                if (decodedHtml != null && decodedHtml != "")
                {
                    Button         linkButton      = linkButtonFactory.Generate(decodedHtml);
                    StyledTypeFace styled          = new StyledTypeFace(LiberationSansFont.Instance, elementState.PointSize);
                    double         descentInPixels = styled.DescentInPixels;
                    linkButton.OriginRelativeParent = new VectorMath.Vector2(linkButton.OriginRelativeParent.x, linkButton.OriginRelativeParent.y + descentInPixels);
                    linkButton.Click += (sender, mouseEvent) =>
                    {
                        MatterControlApplication.Instance.LaunchBrowser(elementState.Href);
                    };
                    elementsUnderConstruction.Peek().AddChild(linkButton);
                }
            }
            break;

            case "table":
                break;

            case "td":
            case "span":
                GuiWidget widgetToAdd;

                if (elementState.Classes.Contains("translate"))
                {
                    decodedHtml = decodedHtml.Localize();
                }
                if (elementState.Classes.Contains("toUpper"))
                {
                    decodedHtml = decodedHtml.ToUpper();
                }
                if (elementState.Classes.Contains("versionNumber"))
                {
                    decodedHtml = VersionInfo.Instance.ReleaseVersion;
                }
                if (elementState.Classes.Contains("buildNumber"))
                {
                    decodedHtml = VersionInfo.Instance.BuildVersion;
                }

                Button createdButton = null;
                if (elementState.Classes.Contains("centeredButton"))
                {
                    createdButton = textImageButtonFactory.Generate(decodedHtml);
                    widgetToAdd   = createdButton;
                }
                else if (elementState.Classes.Contains("linkButton"))
                {
                    double oldFontSize = linkButtonFactory.fontSize;
                    linkButtonFactory.fontSize = elementState.PointSize;
                    createdButton = linkButtonFactory.Generate(decodedHtml);
                    StyledTypeFace styled          = new StyledTypeFace(LiberationSansFont.Instance, elementState.PointSize);
                    double         descentInPixels = styled.DescentInPixels;
                    createdButton.OriginRelativeParent = new VectorMath.Vector2(createdButton.OriginRelativeParent.x, createdButton.OriginRelativeParent.y + descentInPixels);
                    widgetToAdd = createdButton;
                    linkButtonFactory.fontSize = oldFontSize;
                }
                else
                {
                    TextWidget content = new TextWidget(decodedHtml, pointSize: elementState.PointSize, textColor: ActiveTheme.Instance.PrimaryTextColor);
                    widgetToAdd = content;
                }

                if (createdButton != null)
                {
                    if (elementState.Id == "sendFeedback")
                    {
                        createdButton.Click += (sender, mouseEvent) => { ContactFormWindow.Open(); };
                    }
                    else if (elementState.Id == "clearCache")
                    {
                        createdButton.Click += (sender, mouseEvent) => { AboutWidget.DeleteCacheData(); };
                    }
                }

                if (elementState.VerticalAlignment == ElementState.VerticalAlignType.top)
                {
                    widgetToAdd.VAnchor = VAnchor.ParentTop;
                }

                elementsUnderConstruction.Peek().AddChild(widgetToAdd);
                break;

            case "tr":
                elementsUnderConstruction.Push(new FlowLayoutWidget());
                elementsUnderConstruction.Peek().Name = "tr";
                if (elementState.SizePercent.y == 100)
                {
                    elementsUnderConstruction.Peek().VAnchor = VAnchor.ParentBottomTop;
                }
                if (elementState.Alignment == ElementState.AlignType.center)
                {
                    elementsUnderConstruction.Peek().HAnchor |= HAnchor.ParentCenter;
                }
                break;

            default:
                throw new NotImplementedException("Don't know what to do with '{0}'".FormatWith(elementState.TypeName));
            }
        }
Ejemplo n.º 6
0
        private void AddMatterHackersInfo(FlowLayoutWidget topToBottom)
        {
            FlowLayoutWidget headerContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);

            headerContainer.Margin  = new BorderDouble(0, 0, 0, 10);
            headerContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
            {
                TextWidget headerText = new TextWidget(string.Format(new LocalizedString("MatterControl").Translated), textColor: RGBA_Bytes.White, pointSize: 20);
                headerText.MinimumSize = new VectorMath.Vector2(headerText.Width, headerText.Height);
                headerText.HAnchor     = Agg.UI.HAnchor.ParentCenter;
                headerContainer.AddChild(headerText);

                TextWidget versionText = new TextWidget(string.Format(new LocalizedString("Version {0}").Translated, VersionInfo.Instance.ReleaseVersion), textColor: RGBA_Bytes.White, pointSize: 10);
                versionText.MinimumSize = new VectorMath.Vector2(versionText.Width, versionText.Height);
                versionText.HAnchor     = Agg.UI.HAnchor.ParentCenter;
                headerContainer.AddChild(versionText);

                TextWidget developedByText = new TextWidget(new LocalizedString("Developed by MatterHackers").Translated, textColor: RGBA_Bytes.White);
                developedByText.Margin      = new BorderDouble(top: 5);
                developedByText.HAnchor     = Agg.UI.HAnchor.ParentCenter;
                developedByText.MinimumSize = new VectorMath.Vector2(developedByText.Width, developedByText.Height);
                headerContainer.AddChild(developedByText);
            }
            topToBottom.AddChild(headerContainer);

            GuiWidget topSpacer = new GuiWidget();

            topSpacer.VAnchor = VAnchor.ParentBottomTop;
            topToBottom.AddChild(topSpacer);

            // Slicer and agg thanks
            {
                // donate to mc
                {
                    FlowLayoutWidget donateTextContanier = new FlowLayoutWidget();
                    TextWidget       donateStartText     = new TextWidget(new LocalizedString("Please consider ").Translated, textColor: RGBA_Bytes.White);
                    donateTextContanier.AddChild(donateStartText);
                    Button matterControlDonateLink = linkButtonFactory.Generate(new LocalizedString("donating").Translated);
                    matterControlDonateLink.OriginRelativeParent = new VectorMath.Vector2(matterControlDonateLink.OriginRelativeParent.x, matterControlDonateLink.OriginRelativeParent.y + donateStartText.Printer.TypeFaceStyle.DescentInPixels);
                    matterControlDonateLink.Click += (sender, mouseEvent) => { System.Diagnostics.Process.Start("http://www.matterhackers.com/store/printer-accessories/mattercontrol-donation"); };
                    donateTextContanier.AddChild(matterControlDonateLink);
                    donateTextContanier.AddChild(new TextWidget(new LocalizedString(" to help support and improve MatterControl.").Translated, textColor: RGBA_Bytes.White));
                    donateTextContanier.HAnchor = Agg.UI.HAnchor.ParentCenter;
                    topToBottom.AddChild(donateTextContanier);
                }

                // spacer
                topToBottom.AddChild(new GuiWidget(10, 15));

                InsertAttributionText(topToBottom, linkButtonFactory);
            }

            GuiWidget bottomSpacer = new GuiWidget();

            bottomSpacer.VAnchor = VAnchor.ParentBottomTop;
            topToBottom.AddChild(bottomSpacer);

            FlowLayoutWidget feedbackButtons = new FlowLayoutWidget();

            feedbackButtons.Margin = new BorderDouble(bottom: 10);
            {
                feedbackButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter;

                Button feedbackLink = textImageButtonFactory.Generate(new LocalizedString("Send Feedback").Translated);

                feedbackLink.Click += (sender, mouseEvent) => { ContactFormWindow.Open(); };
                feedbackButtons.AddChild(feedbackLink);

                GuiWidget buttonSpacer = new GuiWidget(10, 10);
                feedbackButtons.AddChild(buttonSpacer);
            }

            topToBottom.AddChild(feedbackButtons);

            Button learnMoreLink = linkButtonFactory.Generate(new LocalizedString("www.matterhackers.com").Translated);

            learnMoreLink.Margin  = new BorderDouble(right: 12);
            learnMoreLink.Click  += (sender, mouseEvent) => { System.Diagnostics.Process.Start("http://www.matterhackers.com?clk=mc"); };
            learnMoreLink.HAnchor = HAnchor.ParentCenter;
            learnMoreLink.Margin  = new BorderDouble(0, 5);
            topToBottom.AddChild(learnMoreLink);

            TextWidget copyrightText = new TextWidget(string.Format(new LocalizedString("Copyright © 2013 MatterHackers, Inc.").Translated), textColor: offWhite);

            copyrightText.HAnchor = Agg.UI.HAnchor.ParentCenter;
            topToBottom.AddChild(copyrightText);

            {
                FlowLayoutWidget leftToRightBuildInfo = new FlowLayoutWidget();
                leftToRightBuildInfo.HAnchor |= HAnchor.ParentCenter;

                TextWidget buildText = new TextWidget(string.Format(new LocalizedString("Build: {0} | ").Translated, VersionInfo.Instance.BuildVersion), textColor: offWhite, pointSize: 10);
                leftToRightBuildInfo.AddChild(buildText);

                double oldFontSize = linkButtonFactory.fontSize;
                linkButtonFactory.fontSize = 10;
                Button deleteCacheLink = linkButtonFactory.Generate(new LocalizedString("Clear Cache").Translated);
                linkButtonFactory.fontSize           = oldFontSize;
                deleteCacheLink.OriginRelativeParent = new VectorMath.Vector2(deleteCacheLink.OriginRelativeParent.x, deleteCacheLink.OriginRelativeParent.y + buildText.Printer.TypeFaceStyle.DescentInPixels);
                deleteCacheLink.Click += (sender, mouseEvent) => { DeleteCacheData(); };
                leftToRightBuildInfo.AddChild(deleteCacheLink);

                topToBottom.AddChild(leftToRightBuildInfo);
            }
        }
Ejemplo n.º 7
0
        public bool IsValid()
        {
            try
            {
                if (LayerHeight > NozzleDiameter)
                {
                    string error    = new LocalizedString("'Layer Height' must be less than or equal to the 'Nozzle Diameter'.").Translated;
                    string details  = string.Format("Layer Height = {0}\nNozzle Diameter = {1}", LayerHeight, NozzleDiameter);
                    string location = new LocalizedString("Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'").Translated;
                    StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
                    return(false);
                }
                else if (FirstLayerHeight > NozzleDiameter)
                {
                    string error    = new LocalizedString("First Layer Height' must be less than or equal to the 'Nozzle Diameter'.").Translated;
                    string details  = string.Format("First Layer Height = {0}\nNozzle Diameter = {1}", FirstLayerHeight, NozzleDiameter);
                    string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'";
                    StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
                    return(false);
                }

                if (MinFanSpeed > 100)
                {
                    string error    = "The Min Fan Speed can only go as high as 100%.";
                    string details  = string.Format("It is currently set to {0}.", MinFanSpeed);
                    string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Fillament' -> 'Cooling' (show all settings)";
                    StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
                    return(false);
                }

                if (MaxFanSpeed > 100)
                {
                    string error    = "The Max Fan Speed can only go as high as 100%.";
                    string details  = string.Format("It is currently set to {0}.", MaxFanSpeed);
                    string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Fillament' -> 'Cooling' (show all settings)";
                    StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
                    return(false);
                }
                if (FillDensity < 0 || FillDensity > 1)
                {
                    string error    = "The Fill Density must be between 0 and 1 inclusive.";
                    string details  = string.Format("It is currently set to {0}.", FillDensity);
                    string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Infill'";
                    StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
                    return(false);
                }

                // If the given speed is part of the current slice engine then check that it is greater than 0.
                if (!ValidateGoodSpeedSettingGreaterThan0("bridge_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("external_perimeter_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("first_layer_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("gap_fill_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("infill_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("perimeter_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("retract_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("small_perimeter_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("solid_infill_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("support_material_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("top_solid_infill_speed"))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("travel_speed"))
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                string stackTraceNoBackslashRs = e.StackTrace.Replace("\r", "");
                ContactFormWindow.Open("Parse Error while slicing", e.Message + stackTraceNoBackslashRs);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 8
0
        private void AddContent(HtmlParser htmlParser, string htmlContent)
        {
            ElementState elementState = htmlParser.CurrentElementState;
            string       decodedHtml  = HtmlParser.UrlDecode(htmlContent);

            switch (elementState.TypeName)
            {
            case "a":
            {
                Button         linkButton      = linkButtonFactory.Generate(decodedHtml);
                StyledTypeFace styled          = new StyledTypeFace(LiberationSansFont.Instance, elementState.PointSize);
                double         descentInPixels = styled.DescentInPixels;
                linkButton.OriginRelativeParent = new VectorMath.Vector2(linkButton.OriginRelativeParent.x, linkButton.OriginRelativeParent.y + descentInPixels);
                linkButton.Click += (sender, mouseEvent) =>
                {
                    MatterControlApplication.Instance.LaunchBrowser(elementState.Href);
                };
                currentRow.AddChild(linkButton);
            }
            break;

            case "table":
                break;

            case "td":
            case "span":
                GuiWidget widgetToAdd;

                if (elementState.Classes.Contains("translate"))
                {
                    decodedHtml = decodedHtml.Localize();
                }
                if (elementState.Classes.Contains("toUpper"))
                {
                    decodedHtml = decodedHtml.ToUpper();
                }
                if (elementState.Classes.Contains("versionNumber"))
                {
                    decodedHtml = VersionInfo.Instance.ReleaseVersion;
                }
                if (elementState.Classes.Contains("buildNumber"))
                {
                    decodedHtml = VersionInfo.Instance.BuildVersion;
                }

                Button createdButton = null;
                if (elementState.Classes.Contains("centeredButton"))
                {
                    createdButton = textImageButtonFactory.Generate(decodedHtml);
                    widgetToAdd   = createdButton;
                }
                else if (elementState.Classes.Contains("linkButton"))
                {
                    double oldFontSize = linkButtonFactory.fontSize;
                    linkButtonFactory.fontSize = elementState.PointSize;
                    createdButton = linkButtonFactory.Generate(decodedHtml);
                    StyledTypeFace styled          = new StyledTypeFace(LiberationSansFont.Instance, elementState.PointSize);
                    double         descentInPixels = styled.DescentInPixels;
                    createdButton.OriginRelativeParent = new VectorMath.Vector2(createdButton.OriginRelativeParent.x, createdButton.OriginRelativeParent.y + descentInPixels);
                    widgetToAdd = createdButton;
                    linkButtonFactory.fontSize = oldFontSize;
                }
                else
                {
                    TextWidget content = new TextWidget(decodedHtml, pointSize: elementState.PointSize, textColor: ActiveTheme.Instance.PrimaryTextColor);
                    widgetToAdd = content;
                }

                if (createdButton != null)
                {
                    if (elementState.Id == "sendFeedback")
                    {
                        createdButton.Click += (sender, mouseEvent) => { ContactFormWindow.Open(); };
                    }
                    else if (elementState.Id == "clearCache")
                    {
                        createdButton.Click += (sender, mouseEvent) => { DeleteCacheData(); };
                    }
                }

                if (elementState.VerticalAlignment == ElementState.VerticalAlignType.top)
                {
                    widgetToAdd.VAnchor = VAnchor.ParentTop;
                }

                currentRow.AddChild(widgetToAdd);
                break;

            case "tr":
                currentRow = new FlowLayoutWidget();
                if (elementState.HeightPercent == 100)
                {
                    currentRow.VAnchor = VAnchor.ParentBottomTop;
                }
                if (elementState.Alignment == ElementState.AlignType.center)
                {
                    currentRow.HAnchor |= HAnchor.ParentCenter;
                }
                break;

            default:
                throw new NotImplementedException("Don't know what to do with {0}".FormatWith(elementState.TypeName));
            }
        }
Ejemplo n.º 9
0
        public bool IsValid()
        {
            try
            {
                if (LayerHeight() > NozzleDiameter())
                {
                    string error    = "'Layer Height' must be less than or equal to the 'Nozzle Diameter'.".Localize();
                    string details  = string.Format("Layer Height = {0}\nNozzle Diameter = {1}".Localize(), LayerHeight(), NozzleDiameter());
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Layers/Surface'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }
                else if (FirstLayerHeight() > NozzleDiameter())
                {
                    string error    = "'First Layer Height' must be less than or equal to the 'Nozzle Diameter'.".Localize();
                    string details  = string.Format("First Layer Height = {0}\nNozzle Diameter = {1}".Localize(), FirstLayerHeight(), NozzleDiameter());
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Layers/Surface'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                // If we have print leveling turned on then make sure we don't have any leveling commands in the start gcode.
                if (PrinterConnectionAndCommunication.Instance.ActivePrinter.DoPrintLeveling())
                {
                    string[] startGCode = ActiveValue("start_gcode").Replace("\\n", "\n").Split('\n');
                    foreach (string startGCodeLine in startGCode)
                    {
                        if (startGCodeLine.StartsWith("G29"))
                        {
                            string error    = "Start G-Code cannot contain G29 if Print Leveling is enabled.".Localize();
                            string details  = "Your Start G-Code should not contain a G29 if you are planning on using print leveling. Change your start G-Code or turn off print leveling".Localize();
                            string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Printer' -> 'Custom G-Code' -> 'Start G-Code'".Localize();
                            StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                            return(false);
                        }

                        if (startGCodeLine.StartsWith("G30"))
                        {
                            string error    = "Start G-Code cannot contain G30 if Print Leveling is enabled.".Localize();
                            string details  = "Your Start G-Code should not contain a G30 if you are planning on using print leveling. Change your start G-Code or turn off print leveling".Localize();
                            string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Printer' -> 'Custom G-Code' -> 'Start G-Code'".Localize();
                            StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                            return(false);
                        }
                    }
                }

                if (FirstLayerExtrusionWidth() > NozzleDiameter() * 4)
                {
                    string error    = "'First Layer Extrusion Width' must be less than or equal to the 'Nozzle Diameter' * 4.".Localize();
                    string details  = string.Format("First Layer Extrusion Width = {0}\nNozzle Diameter = {1}".Localize(), ActiveValue("first_layer_extrusion_width"), NozzleDiameter());
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'First Layer'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (FirstLayerExtrusionWidth() <= 0)
                {
                    string error    = "'First Layer Extrusion Width' must be greater than 0.".Localize();
                    string details  = string.Format("First Layer Extrusion Width = {0}".Localize(), ActiveValue("first_layer_extrusion_width"));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'First Layer'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (MinFanSpeed() > 100)
                {
                    string error    = "The Minimum Fan Speed can only go as high as 100%.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), MinFanSpeed());
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Cooling'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (MaxFanSpeed() > 100)
                {
                    string error    = "The Maximum Fan Speed can only go as high as 100%.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), MaxFanSpeed());
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Cooling'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (ExtruderCount() < 1)
                {
                    string error    = "The Extruder Count must be at least 1.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), ExtruderCount());
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Printer' -> 'Features'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (FillDensity() < 0 || FillDensity() > 1)
                {
                    string error    = "The Fill Density must be between 0 and 1.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), FillDensity());
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Infill'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (FillDensity() == 1 &&
                    ActiveValue("infill_type") != "LINES")
                {
                    string error    = "Solid Infill works best when set to LINES.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), ActiveValue("infill_type"));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Infill Type'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(true);
                }


                string normalSpeedLocation = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Speed'".Localize();
                // If the given speed is part of the current slice engine then check that it is greater than 0.
                if (!ValidateGoodSpeedSettingGreaterThan0("bridge_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("external_perimeter_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("first_layer_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("gap_fill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("infill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("perimeter_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("small_perimeter_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("solid_infill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("support_material_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("top_solid_infill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("travel_speed", normalSpeedLocation))
                {
                    return(false);
                }

                string retractSpeedLocation = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Filament' -> 'Retraction'".Localize();
                if (!ValidateGoodSpeedSettingGreaterThan0("retract_speed", retractSpeedLocation))
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.Message);
                GuiWidget.BreakInDebugger();
                string stackTraceNoBackslashRs = e.StackTrace.Replace("\r", "");
                ContactFormWindow.Open("Parse Error while slicing".Localize(), e.Message + stackTraceNoBackslashRs);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 10
0
        public bool IsValid()
        {
            try
            {
                if (GetValue <double>(SettingsKey.layer_height) > GetValue <double>(SettingsKey.nozzle_diameter))
                {
                    string error    = "'Layer Height' must be less than or equal to the 'Nozzle Diameter'.".Localize();
                    string details  = string.Format("Layer Height = {0}\nNozzle Diameter = {1}".Localize(), GetValue <double>(SettingsKey.layer_height), GetValue <double>(SettingsKey.nozzle_diameter));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Layers/Surface'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }
                else if (GetValue <double>(SettingsKey.first_layer_height) > GetValue <double>(SettingsKey.nozzle_diameter))
                {
                    string error    = "'First Layer Height' must be less than or equal to the 'Nozzle Diameter'.".Localize();
                    string details  = string.Format("First Layer Height = {0}\nNozzle Diameter = {1}".Localize(), GetValue <double>(SettingsKey.first_layer_height), GetValue <double>(SettingsKey.nozzle_diameter));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Layers/Surface'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                // Print recovery can only work with a manually leveled or software leveled bed. Hardware leveling does not work.
                if (GetValue <bool>(SettingsKey.recover_is_enabled))
                {
                    string   location   = "Location: 'Settings & Controls' -> 'Settings' -> 'Printer' -> 'Print Recovery' -> 'Enable Recovery'".Localize();
                    string[] startGCode = GetValue("start_gcode").Replace("\\n", "\n").Split('\n');
                    foreach (string startGCodeLine in startGCode)
                    {
                        if (startGCodeLine.StartsWith("G29"))
                        {
                            string error   = "Start G-Code cannot contain G29 if Print Recovery is enabled.".Localize();
                            string details = "Your Start G-Code should not contain a G29 if you are planning on using Print Recovery. Change your start G-Code or turn off Print Recovery".Localize();
                            StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                            return(false);
                        }

                        if (startGCodeLine.StartsWith("G30"))
                        {
                            string error   = "Start G-Code cannot contain G30 if Print Leveling is enabled.".Localize();
                            string details = "Your Start G-Code should not contain a G30 if you are planning on using Print Recovery. Change your start G-Code or turn off Print Recovery".Localize();
                            StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                            return(false);
                        }
                    }
                }

                // If we have print leveling turned on then make sure we don't have any leveling commands in the start gcode.
                if (GetValue <bool>(SettingsKey.print_leveling_enabled))
                {
                    string   location   = "Location: 'Settings & Controls' -> 'Settings' -> 'Printer' -> 'Custom G-Code' -> 'Start G-Code'".Localize();
                    string[] startGCode = GetValue("start_gcode").Replace("\\n", "\n").Split('\n');
                    foreach (string startGCodeLine in startGCode)
                    {
                        if (startGCodeLine.StartsWith("G29"))
                        {
                            string error   = "Start G-Code cannot contain G29 if Print Leveling is enabled.".Localize();
                            string details = "Your Start G-Code should not contain a G29 if you are planning on using print leveling. Change your start G-Code or turn off print leveling".Localize();
                            StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                            return(false);
                        }

                        if (startGCodeLine.StartsWith("G30"))
                        {
                            string error   = "Start G-Code cannot contain G30 if Print Leveling is enabled.".Localize();
                            string details = "Your Start G-Code should not contain a G30 if you are planning on using print leveling. Change your start G-Code or turn off print leveling".Localize();
                            StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                            return(false);
                        }
                    }
                }

                if (GetValue <double>(SettingsKey.first_layer_extrusion_width) > GetValue <double>(SettingsKey.nozzle_diameter) * 4)
                {
                    string error    = "'First Layer Extrusion Width' must be less than or equal to the 'Nozzle Diameter' * 4.".Localize();
                    string details  = string.Format("First Layer Extrusion Width = {0}\nNozzle Diameter = {1}".Localize(), GetValue(SettingsKey.first_layer_extrusion_width), GetValue <double>(SettingsKey.nozzle_diameter));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'First Layer'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (GetValue <double>(SettingsKey.first_layer_extrusion_width) <= 0)
                {
                    string error    = "'First Layer Extrusion Width' must be greater than 0.".Localize();
                    string details  = string.Format("First Layer Extrusion Width = {0}".Localize(), GetValue(SettingsKey.first_layer_extrusion_width));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'First Layer'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (GetValue <double>(SettingsKey.external_perimeter_extrusion_width) > GetValue <double>(SettingsKey.nozzle_diameter) * 4)
                {
                    string error    = "'External Perimeter Extrusion Width' must be less than or equal to the 'Nozzle Diameter' * 4.".Localize();
                    string details  = string.Format("External Perimeter Extrusion Width = {0}\nNozzle Diameter = {1}".Localize(), GetValue(SettingsKey.external_perimeter_extrusion_width), GetValue <double>(SettingsKey.nozzle_diameter));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'External Perimeter'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (GetValue <double>(SettingsKey.external_perimeter_extrusion_width) <= 0)
                {
                    string error    = "'External Perimeter Extrusion Width' must be greater than 0.".Localize();
                    string details  = string.Format("External Perimeter Extrusion Width = {0}".Localize(), GetValue(SettingsKey.external_perimeter_extrusion_width));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'External Perimeter'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (GetValue <double>(SettingsKey.min_fan_speed) > 100)
                {
                    string error    = "The Minimum Fan Speed can only go as high as 100%.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), GetValue <double>(SettingsKey.min_fan_speed));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Cooling'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (GetValue <double>("max_fan_speed") > 100)
                {
                    string error    = "The Maximum Fan Speed can only go as high as 100%.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), GetValue <double>("max_fan_speed"));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Cooling'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (GetValue <int>(SettingsKey.extruder_count) < 1)
                {
                    string error    = "The Extruder Count must be at least 1.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), GetValue <int>(SettingsKey.extruder_count));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Printer' -> 'Features'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (GetValue <double>(SettingsKey.fill_density) < 0 || GetValue <double>(SettingsKey.fill_density) > 1)
                {
                    string error    = "The Fill Density must be between 0 and 1.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), GetValue <double>(SettingsKey.fill_density));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Infill'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (GetValue <double>(SettingsKey.fill_density) == 1 &&
                    GetValue("infill_type") != "LINES")
                {
                    string error    = "Solid Infill works best when set to LINES.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), GetValue("infill_type"));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Infill Type'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(true);
                }


                string normalSpeedLocation = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Speed'".Localize();
                // If the given speed is part of the current slice engine then check that it is greater than 0.
                if (!ValidateGoodSpeedSettingGreaterThan0("bridge_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("external_perimeter_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0(SettingsKey.first_layer_speed, normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("gap_fill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("infill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("perimeter_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("small_perimeter_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("solid_infill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("support_material_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("top_solid_infill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("travel_speed", normalSpeedLocation))
                {
                    return(false);
                }

                string retractSpeedLocation = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Filament' -> 'Retraction'".Localize();
                if (!ValidateGoodSpeedSettingGreaterThan0("retract_speed", retractSpeedLocation))
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.Message);
                GuiWidget.BreakInDebugger();
                string stackTraceNoBackslashRs = e.StackTrace.Replace("\r", "");
                ContactFormWindow.Open("Parse Error while slicing".Localize(), e.Message + stackTraceNoBackslashRs);
                return(false);
            }

            return(true);
        }
        public bool IsValid()
        {
            try
            {
                if (LayerHeight > NozzleDiameter)
                {
                    string error    = "'Layer Height' must be less than or equal to the 'Nozzle Diameter'.".Localize();
                    string details  = string.Format("Layer Height = {0}\nNozzle Diameter = {1}".Localize(), LayerHeight, NozzleDiameter);
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Layers/Surface'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }
                else if (FirstLayerHeight > NozzleDiameter)
                {
                    string error    = "First Layer Height' must be less than or equal to the 'Nozzle Diameter'.".Localize();
                    string details  = string.Format("First Layer Height = {0}\nNozzle Diameter = {1}".Localize(), FirstLayerHeight, NozzleDiameter);
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Layers/Surface'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (FirstLayerExtrusionWidth > NozzleDiameter * 4)
                {
                    string error    = "First Layer Extrusion Width' must be less than or equal to the 'Nozzle Diameter' * 4.".Localize();
                    string details  = string.Format("First Layer Extrusion Width = {0}\nNozzle Diameter = {1}".Localize(), GetActiveValue("first_layer_extrusion_width"), NozzleDiameter);
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'First Layer'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (FirstLayerExtrusionWidth <= 0)
                {
                    string error    = "First Layer Extrusion Width' must be greater than 0.".Localize();
                    string details  = string.Format("First Layer Extrusion Width = {0}".Localize(), GetActiveValue("first_layer_extrusion_width"));
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Extrusion' -> 'First Layer'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (MinFanSpeed > 100)
                {
                    string error    = "The Min Fan Speed can only go as high as 100%.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), MinFanSpeed);
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Cooling' (Advanced display)".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (MaxFanSpeed > 100)
                {
                    string error    = "The Max Fan Speed can only go as high as 100%.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), MaxFanSpeed);
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Cooling' (Advanced display)".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (ExtruderCount < 1)
                {
                    string error    = "The Extruder Count must be at least 1.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), ExtruderCount);
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'Printer' -> 'Features' (Advanced display)".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                if (FillDensity < 0 || FillDensity > 1)
                {
                    string error    = "The Fill Density must be between 0 and 1 inclusive.".Localize();
                    string details  = string.Format("It is currently set to {0}.".Localize(), FillDensity);
                    string location = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Infill'".Localize();
                    StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error".Localize());
                    return(false);
                }

                string normalSpeedLocation = "Location: 'Settings & Controls' -> 'Settings' -> 'General' -> 'Speed'".Localize();
                // If the given speed is part of the current slice engine then check that it is greater than 0.
                if (!ValidateGoodSpeedSettingGreaterThan0("bridge_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("external_perimeter_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("first_layer_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("gap_fill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("infill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("perimeter_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("small_perimeter_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("solid_infill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("support_material_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("top_solid_infill_speed", normalSpeedLocation))
                {
                    return(false);
                }
                if (!ValidateGoodSpeedSettingGreaterThan0("travel_speed", normalSpeedLocation))
                {
                    return(false);
                }

                string retractSpeedLocation = "Location: 'Settings & Controls' -> 'Settings' -> 'Filament' -> 'Filament' -> 'Retraction'".Localize();
                if (!ValidateGoodSpeedSettingGreaterThan0("retract_speed", retractSpeedLocation))
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.Message);
                GuiWidget.BreakInDebugger();
                string stackTraceNoBackslashRs = e.StackTrace.Replace("\r", "");
                ContactFormWindow.Open("Parse Error while slicing".Localize(), e.Message + stackTraceNoBackslashRs);
                return(false);
            }

            return(true);
        }