Example #1
0
        private void ExportThread()
        {
            ServiceProvider.Instance.OnMessage(Messages.SetBusy, "Exporting images ...");
            try
            {
                foreach (var exportItem in Profile.ExportItems)
                {
                    IExportPlugin plugin = GetPlugin(exportItem.Id);
                    if (plugin == null)
                    {
                        continue;
                    }

                    for (int i = 0; i < Profile.Files.Count; i++)
                    {
                        ServiceProvider.Instance.OnMessage(Messages.SetBusy,
                                                           $"Loading images ... {i + 1}/{Profile.Files.Count}");
                        var fileItem = Profile.Files[i];
                        fileItem.ImageNumber = i + 1;
                        plugin.Export(exportItem, fileItem, Profile);
                    }
                }
            }
            catch (Exception e)
            {
                Log.Debug("Export error", e);
            }
            ServiceProvider.Instance.OnMessage(Messages.ClearBusy);
            Profile.SessionCounter++;
            Profile.CleanUp();
            Profile.Save();
            ServiceProvider.Instance.OnMessage(Messages.ChangeLayout, null, ViewEnum.Start);
        }
Example #2
0
 private void Export(IExportPlugin obj)
 {
     if (Profile.ExportItems.Count == 0)
     {
         MessageBox.Show("No export action are defined !");
         return;
     }
     Task.Factory.StartNew(ExportThread);
 }
Example #3
0
        private void Add(IExportPlugin obj)
        {
            var item = obj.GetDefault();

            item.Name = "Export => " + obj.Name;
            item.Id   = obj.Id;
            item.Icon = obj.Icon;
            Profile.ExportItems.Add(item);
        }
 private void ExecuteExportPlugin(IExportPlugin obj)
 {
     try
     {
         obj.Execute();
     }
     catch (Exception ex)
     {
         Log.Error("Error refresh session ", ex);
         ServiceProvider.WindowsManager.ExecuteCommand(WindowsCmdConsts.MainWnd_Message, ex.Message);
     }
 }
Example #5
0
 /// <summary>
 /// <inheritdoc cref="Save()"/>
 /// </summary>
 /// <param name="exporter"></param>
 /// <param name="fileName"></param>
 public void Save(IExportPlugin exporter, string fileName)
 {
     if (exporter == null)
     {
         throw new ArgumentNullException(nameof(exporter));
     }
     if (string.IsNullOrWhiteSpace(fileName))
     {
         throw new ArgumentNullException(nameof(fileName));
     }
     exporter.Export(ObjectFX, fileName);
     if (Exporter == null)
     {
         Exporter = exporter;
     }
     FileName = fileName;
     OnStatusChanged(FileStatus.Saved);
 }
Example #6
0
 public void LoadPlugins()
 {
     try
     {
         OpenFileDialog ofd = new OpenFileDialog();
         ofd.InitialDirectory = $@"{Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}\WinFormsMod\Plugins";
         ofd.ShowDialog();
         string dllPath = ofd.FileName;
         plugin = LoadAssembly(dllPath);
         if (plugin.Name == "ExportToCsv")
         {
             exportAsCsvToolStripMenuItem.Visible = true;
         }
     }
     catch (Exception)
     {
         exportAsCsvToolStripMenuItem.Visible = false;
     }
 }
 private void ExecuteExportPlugin(IExportPlugin obj)
 {
     try
     {
         obj.Execute();
     }
     catch (Exception ex)
     {
         Log.Error("Error refresh session ", ex);
         ServiceProvider.WindowsManager.ExecuteCommand(WindowsCmdConsts.MainWnd_Message, ex.Message);
     }
 }
 private void ExecuteExportPlugin(IExportPlugin obj)
 {
     HideFlatOuts();
     obj.Execute();
 }
Example #9
0
        public ExportPrintItemPage(IEnumerable <ILibraryItem> libraryItems, bool centerOnBed, PrinterConfig printer)
        {
            this.WindowTitle = "Export File".Localize();
            this.HeaderText  = "Export selection to".Localize() + ":";
            this.Name        = "Export Item Window";

            var commonMargin = new BorderDouble(4, 2);

            bool isFirstItem = true;

            // Must be constructed before plugins are initialized
            var exportButton = theme.CreateDialogButton("Export".Localize());

            validationPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit
            };

            // GCode export
            exportPluginButtons = new Dictionary <RadioButton, IExportPlugin>();

            foreach (IExportPlugin plugin in PluginFinder.CreateInstancesOf <IExportPlugin>().OrderBy(p => p.ButtonText))
            {
                plugin.Initialize(printer);

                // Skip plugins which are invalid for the current printer
                if (!plugin.Enabled)
                {
                    if (!string.IsNullOrEmpty(plugin.DisabledReason))
                    {
                        // add a message to let us know why not enabled
                        var disabledPluginButton = new RadioButton(new RadioImageWidget(plugin.ButtonText, theme.TextColor, plugin.Icon))
                        {
                            HAnchor = HAnchor.Left,
                            Margin  = commonMargin,
                            Cursor  = Cursors.Hand,
                            Name    = plugin.ButtonText + " Button",
                            Enabled = false
                        };
                        contentRow.AddChild(disabledPluginButton);
                        contentRow.AddChild(new TextWidget("Disabled: {0}".Localize().FormatWith(plugin.DisabledReason), textColor: theme.PrimaryAccentColor)
                        {
                            Margin  = new BorderDouble(left: 80),
                            HAnchor = HAnchor.Left
                        });
                    }
                    continue;
                }

                // Create export button for each plugin
                var pluginButton = new RadioButton(new RadioImageWidget(plugin.ButtonText, theme.TextColor, plugin.Icon))
                {
                    HAnchor = HAnchor.Left,
                    Margin  = commonMargin,
                    Cursor  = Cursors.Hand,
                    Name    = plugin.ButtonText + " Button"
                };
                contentRow.AddChild(pluginButton);

                if (plugin is GCodeExport)
                {
                    var gcodeExportButton = pluginButton;
                    gcodeExportButton.CheckedStateChanged += (s, e) =>
                    {
                        validationPanel.CloseAllChildren();

                        if (gcodeExportButton.Checked)
                        {
                            var errors = printer.ValidateSettings(validatePrintBed: false);

                            exportButton.Enabled = !errors.Any(item => item.ErrorLevel == ValidationErrorLevel.Error);

                            validationPanel.AddChild(
                                new ValidationErrorsPanel(
                                    errors,
                                    AppContext.Theme)
                            {
                                HAnchor = HAnchor.Stretch
                            });
                        }
                        else
                        {
                            exportButton.Enabled = true;
                        }
                    };
                }

                if (isFirstItem)
                {
                    pluginButton.Checked = true;
                    isFirstItem          = false;
                }

                if (plugin is IExportWithOptions pluginWithOptions)
                {
                    var optionPanel = pluginWithOptions.GetOptionsPanel();
                    if (optionPanel != null)
                    {
                        optionPanel.HAnchor = HAnchor.Stretch;
                        optionPanel.VAnchor = VAnchor.Fit;
                        contentRow.AddChild(optionPanel);
                    }
                }

                exportPluginButtons.Add(pluginButton, plugin);
            }

            ContentRow.AddChild(new VerticalSpacer());
            contentRow.AddChild(validationPanel);

            // TODO: make this work on the mac and then delete this if
            if (AggContext.OperatingSystem == OSType.Windows ||
                AggContext.OperatingSystem == OSType.X11)
            {
                showInFolderAfterSave = new CheckBox("Show file in folder after save".Localize(), theme.TextColor, 10)
                {
                    HAnchor = HAnchor.Left,
                    Cursor  = Cursors.Hand
                };
                contentRow.AddChild(showInFolderAfterSave);
            }

            exportButton.Name   = "Export Button";
            exportButton.Click += (s, e) =>
            {
                IExportPlugin activePlugin = null;

                // Loop over all plugin buttons, break on the first checked item found
                foreach (var button in this.exportPluginButtons.Keys)
                {
                    if (button.Checked)
                    {
                        activePlugin = exportPluginButtons[button];
                        break;
                    }
                }

                // Early exit if no plugin radio button is selected
                if (activePlugin == null)
                {
                    return;
                }

                DoExport(libraryItems, printer, activePlugin, centerOnBed, showInFolderAfterSave.Checked);

                this.Parent.CloseOnIdle();
            };


            this.AddPageAction(exportButton);
        }
Example #10
0
        public static void DoExport(IEnumerable <ILibraryItem> libraryItems, PrinterConfig printer, IExportPlugin exportPlugin, bool centerOnBed = false, bool showFile = false)
        {
            string targetExtension = exportPlugin.FileExtension;

            if (exportPlugin is FolderExport)
            {
                UiThread.RunOnIdle(() =>
                {
                    AggContext.FileDialogs.SelectFolderDialog(
                        new SelectFolderDialogParams("Select Location To Export Files")
                    {
                        ActionButtonLabel = "Export".Localize(),
                        Title             = ApplicationController.Instance.ProductName + " - " + "Select A Folder".Localize()
                    },
                        (openParams) => {
                        ApplicationController.Instance.Tasks.Execute(
                            "Saving".Localize() + "...",
                            printer,
                            async(reporter, cancellationToken) => {
                            string path = openParams.FolderPath;
                            if (!string.IsNullOrEmpty(path))
                            {
                                await exportPlugin.Generate(libraryItems, path, reporter, cancellationToken);
                            }
                        });
                    });
                });

                return;
            }

            UiThread.RunOnIdle(() =>
            {
                string title         = ApplicationController.Instance.ProductName + " - " + "Export File".Localize();
                string workspaceName = "Workspace " + DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss");
                AggContext.FileDialogs.SaveFileDialog(
                    new SaveFileDialogParams(exportPlugin.ExtensionFilter)
                {
                    Title             = title,
                    ActionButtonLabel = "Export".Localize(),
                    FileName          = Path.GetFileNameWithoutExtension(libraryItems.FirstOrDefault()?.Name ?? workspaceName)
                },
                    (saveParams) =>
                {
                    string savePath = saveParams.FileName;

                    if (!string.IsNullOrEmpty(savePath))
                    {
                        ApplicationController.Instance.Tasks.Execute(
                            "Exporting".Localize() + "...",
                            printer,
                            async(reporter, cancellationToken) =>
                        {
                            string extension = Path.GetExtension(savePath);
                            if (!extension.Equals(targetExtension, StringComparison.OrdinalIgnoreCase))
                            {
                                savePath += targetExtension;
                            }

                            List <ValidationError> exportErrors = null;

                            if (exportPlugin != null)
                            {
                                if (exportPlugin is GCodeExport gCodeExport)
                                {
                                    gCodeExport.CenterOnBed = centerOnBed;
                                }

                                exportErrors = await exportPlugin.Generate(libraryItems, savePath, reporter, cancellationToken);
                            }

                            if (exportErrors == null || exportErrors.Count == 0)
                            {
                                {
                                    if (AggContext.OperatingSystem == OSType.Windows || AggContext.OperatingSystem == OSType.X11)
                                    {
                                        if (showFile)
                                        {
                                            AggContext.FileDialogs.ShowFileInFolder(savePath);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                bool showGenerateErrors = !(exportPlugin is GCodeExport);

                                // Only show errors in Generate if not GCodeExport - GCodeExport shows validation errors before Generate call
                                if (showGenerateErrors)
                                {
                                    ApplicationController.Instance.ShowValidationErrors("Export Error".Localize(), exportErrors);
                                }
                            }
                        });
                    }
                });
            });
        }
        public ExportPrintItemPage(IEnumerable <ILibraryItem> libraryItems, bool centerOnBed, PrinterConfig printer)
        {
            this.centerOnBed = centerOnBed;
            this.WindowTitle = "Export File".Localize();
            this.HeaderText  = "Export selection to".Localize() + ":";

            this.libraryItems = libraryItems;
            this.Name         = "Export Item Window";

            var commonMargin = new BorderDouble(4, 2);

            bool isFirstItem = true;

            // GCode export
            exportPluginButtons = new Dictionary <RadioButton, IExportPlugin>();

            foreach (IExportPlugin plugin in PluginFinder.CreateInstancesOf <IExportPlugin>().OrderBy(p => p.ButtonText))
            {
                plugin.Initialize(printer);

                // Skip plugins which are invalid for the current printer
                if (!plugin.Enabled)
                {
                    continue;
                }

                // Create export button for each plugin
                var pluginButton = new RadioButton(new RadioImageWidget(plugin.ButtonText, theme.TextColor, plugin.Icon))
                {
                    HAnchor = HAnchor.Left,
                    Margin  = commonMargin,
                    Cursor  = Cursors.Hand,
                    Name    = plugin.ButtonText + " Button"
                };
                contentRow.AddChild(pluginButton);

                if (isFirstItem)
                {
                    pluginButton.Checked = true;
                    isFirstItem          = false;
                }

                if (plugin is IExportWithOptions pluginWithOptions)
                {
                    var optionPanel = pluginWithOptions.GetOptionsPanel();
                    if (optionPanel != null)
                    {
                        optionPanel.HAnchor = HAnchor.Stretch;
                        optionPanel.VAnchor = VAnchor.Fit;
                        contentRow.AddChild(optionPanel);
                    }
                }

                exportPluginButtons.Add(pluginButton, plugin);
            }

            contentRow.AddChild(new VerticalSpacer());

            // TODO: make this work on the mac and then delete this if
            if (AggContext.OperatingSystem == OSType.Windows ||
                AggContext.OperatingSystem == OSType.X11)
            {
                showInFolderAfterSave = new CheckBox("Show file in folder after save".Localize(), theme.TextColor, 10)
                {
                    HAnchor = HAnchor.Left,
                    Cursor  = Cursors.Hand
                };
                contentRow.AddChild(showInFolderAfterSave);
            }

            var exportButton = theme.CreateDialogButton("Export".Localize());

            exportButton.Name   = "Export Button";
            exportButton.Click += (s, e) =>
            {
                string fileTypeFilter  = "";
                string targetExtension = "";

                IExportPlugin activePlugin = null;

                // Loop over all plugin buttons, break on the first checked item found
                foreach (var button in this.exportPluginButtons.Keys)
                {
                    if (button.Checked)
                    {
                        activePlugin = exportPluginButtons[button];
                        break;
                    }
                }

                // Early exit if no plugin radio button is selected
                if (activePlugin == null)
                {
                    return;
                }

                fileTypeFilter  = activePlugin.ExtensionFilter;
                targetExtension = activePlugin.FileExtension;

                this.Parent.CloseOnIdle();

                if (activePlugin is FolderExport)
                {
                    UiThread.RunOnIdle(() =>
                    {
                        AggContext.FileDialogs.SelectFolderDialog(
                            new SelectFolderDialogParams("Select Location To Export Files")
                        {
                            ActionButtonLabel = "Export".Localize(),
                            Title             = ApplicationController.Instance.ProductName + " - " + "Select A Folder".Localize()
                        },
                            (openParams) =>
                        {
                            ApplicationController.Instance.Tasks.Execute(
                                "Saving".Localize() + "...",
                                async(reporter, cancellationToken) =>
                            {
                                string path = openParams.FolderPath;
                                if (!string.IsNullOrEmpty(path))
                                {
                                    await activePlugin.Generate(libraryItems, path, reporter, cancellationToken);
                                }
                            });
                        });
                    });

                    return;
                }

                UiThread.RunOnIdle(() =>
                {
                    string title         = ApplicationController.Instance.ProductName + " - " + "Export File".Localize();
                    string workspaceName = "Workspace " + DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss");
                    AggContext.FileDialogs.SaveFileDialog(
                        new SaveFileDialogParams(fileTypeFilter)
                    {
                        Title             = title,
                        ActionButtonLabel = "Export".Localize(),
                        FileName          = Path.GetFileNameWithoutExtension(libraryItems.FirstOrDefault()?.Name ?? workspaceName)
                    },
                        (saveParams) =>
                    {
                        string savePath = saveParams.FileName;

                        if (!string.IsNullOrEmpty(savePath))
                        {
                            ApplicationController.Instance.Tasks.Execute(
                                "Exporting".Localize() + "...",
                                async(reporter, cancellationToken) =>
                            {
                                string extension = Path.GetExtension(savePath);
                                if (extension != targetExtension)
                                {
                                    savePath += targetExtension;
                                }

                                bool succeeded = false;

                                if (activePlugin != null)
                                {
                                    if (activePlugin is GCodeExport gCodeExport)
                                    {
                                        gCodeExport.CenterOnBed = centerOnBed;
                                    }
                                    succeeded = await activePlugin.Generate(libraryItems, savePath, reporter, cancellationToken);
                                }

                                if (succeeded)
                                {
                                    ShowFileIfRequested(savePath);
                                }
                                else
                                {
                                    UiThread.RunOnIdle(() =>
                                    {
                                        StyledMessageBox.ShowMessageBox("Export failed".Localize(), title);
                                    });
                                }
                            });
                        }
                    });
                });
            };

            this.AddPageAction(exportButton);
        }
 private void ExecuteExportPlugin(IExportPlugin obj)
 {
     HideFlatOuts();
     obj.Execute();
 }
Example #13
0
 private void ExecuteExportPlugin(IExportPlugin obj)
 {
     Flyouts[0].IsOpen = false;
     Flyouts[1].IsOpen = false;
     obj.Execute();
 }
 private void ExecuteExportPlugin(IExportPlugin obj)
 {
     obj.Execute();
 }
Example #15
0
        public ExportPrintItemPage(IEnumerable <ILibraryItem> libraryItems, bool centerOnBed, PrinterConfig printer)
        {
            this.centerOnBed = centerOnBed;
            this.WindowTitle = "Export File".Localize();
            this.HeaderText  = "Export selection to".Localize() + ":";

            this.libraryItems = libraryItems;
            this.Name         = "Export Item Window";

            var commonMargin = new BorderDouble(4, 2);

            bool isFirstItem = true;

            // Must be constructed before plugins are initialized
            var exportButton = theme.CreateDialogButton("Export".Localize());

            validationPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
            {
                HAnchor = HAnchor.Stretch,
                VAnchor = VAnchor.Fit
            };

            // GCode export
            exportPluginButtons = new Dictionary <RadioButton, IExportPlugin>();

            foreach (IExportPlugin plugin in PluginFinder.CreateInstancesOf <IExportPlugin>().OrderBy(p => p.ButtonText))
            {
                plugin.Initialize(printer);

                // Skip plugins which are invalid for the current printer
                if (!plugin.Enabled)
                {
                    if (!string.IsNullOrEmpty(plugin.DisabledReason))
                    {
                        // add a message to let us know why not enabled
                        var disabledPluginButton = new RadioButton(new RadioImageWidget(plugin.ButtonText, theme.TextColor, plugin.Icon))
                        {
                            HAnchor = HAnchor.Left,
                            Margin  = commonMargin,
                            Cursor  = Cursors.Hand,
                            Name    = plugin.ButtonText + " Button",
                            Enabled = false
                        };
                        contentRow.AddChild(disabledPluginButton);
                        contentRow.AddChild(new TextWidget("Disabled: {0}".Localize().FormatWith(plugin.DisabledReason), textColor: theme.PrimaryAccentColor)
                        {
                            Margin  = new BorderDouble(left: 80),
                            HAnchor = HAnchor.Left
                        });
                    }
                    continue;
                }

                // Create export button for each plugin
                var pluginButton = new RadioButton(new RadioImageWidget(plugin.ButtonText, theme.TextColor, plugin.Icon))
                {
                    HAnchor = HAnchor.Left,
                    Margin  = commonMargin,
                    Cursor  = Cursors.Hand,
                    Name    = plugin.ButtonText + " Button"
                };
                contentRow.AddChild(pluginButton);

                if (plugin is GCodeExport)
                {
                    var gcodeExportButton = pluginButton;
                    gcodeExportButton.CheckedStateChanged += (s, e) =>
                    {
                        validationPanel.CloseAllChildren();

                        if (gcodeExportButton.Checked)
                        {
                            var errors = printer.ValidateSettings();

                            exportButton.Enabled = !errors.Any(item => item.ErrorLevel == ValidationErrorLevel.Error);

                            validationPanel.AddChild(
                                new ValidationErrorsPanel(
                                    errors,
                                    AppContext.Theme)
                            {
                                HAnchor = HAnchor.Stretch
                            });
                        }
                        else
                        {
                            exportButton.Enabled = true;
                        }
                    };
                }

                if (isFirstItem)
                {
                    pluginButton.Checked = true;
                    isFirstItem          = false;
                }

                if (plugin is IExportWithOptions pluginWithOptions)
                {
                    var optionPanel = pluginWithOptions.GetOptionsPanel();
                    if (optionPanel != null)
                    {
                        optionPanel.HAnchor = HAnchor.Stretch;
                        optionPanel.VAnchor = VAnchor.Fit;
                        contentRow.AddChild(optionPanel);
                    }
                }


                exportPluginButtons.Add(pluginButton, plugin);
            }

            ContentRow.AddChild(new VerticalSpacer());
            contentRow.AddChild(validationPanel);

            // TODO: make this work on the mac and then delete this if
            if (AggContext.OperatingSystem == OSType.Windows ||
                AggContext.OperatingSystem == OSType.X11)
            {
                showInFolderAfterSave = new CheckBox("Show file in folder after save".Localize(), theme.TextColor, 10)
                {
                    HAnchor = HAnchor.Left,
                    Cursor  = Cursors.Hand
                };
                contentRow.AddChild(showInFolderAfterSave);
            }

            exportButton.Name   = "Export Button";
            exportButton.Click += (s, e) =>
            {
                string fileTypeFilter  = "";
                string targetExtension = "";

                IExportPlugin activePlugin = null;

                // Loop over all plugin buttons, break on the first checked item found
                foreach (var button in this.exportPluginButtons.Keys)
                {
                    if (button.Checked)
                    {
                        activePlugin = exportPluginButtons[button];
                        break;
                    }
                }

                // Early exit if no plugin radio button is selected
                if (activePlugin == null)
                {
                    return;
                }

                fileTypeFilter  = activePlugin.ExtensionFilter;
                targetExtension = activePlugin.FileExtension;

                this.Parent.CloseOnIdle();

                if (activePlugin is FolderExport)
                {
                    UiThread.RunOnIdle(() =>
                    {
                        AggContext.FileDialogs.SelectFolderDialog(
                            new SelectFolderDialogParams("Select Location To Export Files")
                        {
                            ActionButtonLabel = "Export".Localize(),
                            Title             = ApplicationController.Instance.ProductName + " - " + "Select A Folder".Localize()
                        },
                            (openParams) =>
                        {
                            ApplicationController.Instance.Tasks.Execute(
                                "Saving".Localize() + "...",
                                printer,
                                async(reporter, cancellationToken) =>
                            {
                                string path = openParams.FolderPath;
                                if (!string.IsNullOrEmpty(path))
                                {
                                    await activePlugin.Generate(libraryItems, path, reporter, cancellationToken);
                                }
                            });
                        });
                    });

                    return;
                }

                UiThread.RunOnIdle(() =>
                {
                    string title         = ApplicationController.Instance.ProductName + " - " + "Export File".Localize();
                    string workspaceName = "Workspace " + DateTime.Now.ToString("yyyy-MM-dd HH_mm_ss");
                    AggContext.FileDialogs.SaveFileDialog(
                        new SaveFileDialogParams(fileTypeFilter)
                    {
                        Title             = title,
                        ActionButtonLabel = "Export".Localize(),
                        FileName          = Path.GetFileNameWithoutExtension(libraryItems.FirstOrDefault()?.Name ?? workspaceName)
                    },
                        (saveParams) =>
                    {
                        string savePath = saveParams.FileName;

                        if (!string.IsNullOrEmpty(savePath))
                        {
                            ApplicationController.Instance.Tasks.Execute(
                                "Exporting".Localize() + "...",
                                printer,
                                async(reporter, cancellationToken) =>
                            {
                                string extension = Path.GetExtension(savePath);
                                if (extension != targetExtension)
                                {
                                    savePath += targetExtension;
                                }

                                List <ValidationError> exportErrors = null;

                                if (activePlugin != null)
                                {
                                    if (activePlugin is GCodeExport gCodeExport)
                                    {
                                        gCodeExport.CenterOnBed = centerOnBed;
                                    }

                                    exportErrors = await activePlugin.Generate(libraryItems, savePath, reporter, cancellationToken);
                                }

                                if (exportErrors == null || exportErrors.Count == 0)
                                {
                                    ShowFileIfRequested(savePath);
                                }
                                else
                                {
                                    bool showGenerateErrors = !(activePlugin is GCodeExport);

                                    // Only show errors in Generate if not GCodeExport - GCodeExport shows validation errors before Generate call
                                    if (showGenerateErrors)
                                    {
                                        ApplicationController.Instance.ShowValidationErrors("Export Error".Localize(), exportErrors);
                                    }
                                }
                            });
                        }
                    });
                });
            };

            this.AddPageAction(exportButton);
        }