diff --git a/UVtools.Core/Operations/OperationLayerImport.cs b/UVtools.Core/Operations/OperationLayerImport.cs index 591e42c..b4dacd0 100644 --- a/UVtools.Core/Operations/OperationLayerImport.cs +++ b/UVtools.Core/Operations/OperationLayerImport.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; using System.IO; using System.Threading.Tasks; @@ -43,17 +44,16 @@ namespace UVtools.Core.Operations { if (DiscardRemainingLayers) { - return (uint) (1 + InsertAfterLayerIndex + Files.Count - (ReplaceStartLayer ? 1u : 0u)); + return (uint) (1 + InsertAfterLayerIndex + Files.Count - (ReplaceStartLayer ? 1 : 0)); } - if (!ReplaceSubsequentLayers) + if (ReplaceSubsequentLayers) { - return (uint)(totalLayers + Files.Count - (ReplaceStartLayer ? 1u : 0u)); + uint result = (uint) (1 + InsertAfterLayerIndex + Files.Count - (ReplaceStartLayer ? 1 : 0)); + return result <= totalLayers ? totalLayers : result; } - // Need to calculate the total layer count after subsequent replacing, taking in account that layer count can grow + return (uint)(totalLayers + Files.Count - (ReplaceStartLayer ? 1 : 0)); - - return 0; } } } diff --git a/UVtools.GUI/Controls/CtrlToolWindowContent.cs b/UVtools.GUI/Controls/CtrlToolWindowContent.cs index cfbc47f..599798d 100644 --- a/UVtools.GUI/Controls/CtrlToolWindowContent.cs +++ b/UVtools.GUI/Controls/CtrlToolWindowContent.cs @@ -11,6 +11,7 @@ using System.Runtime.CompilerServices; using System.Windows.Forms; using UVtools.Core.Extensions; using UVtools.GUI.Annotations; +using UVtools.GUI.Forms; namespace UVtools.GUI.Controls { @@ -69,10 +70,12 @@ namespace UVtools.GUI.Controls } } #endregion - + #region Properties + [ReadOnly(true)] [Browsable(false)] public FrmToolWindow ParentToolWindow => ParentForm as FrmToolWindow; + [Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))] [SettingsBindable(true)] public string Description { get; set; } @@ -105,7 +108,7 @@ namespace UVtools.GUI.Controls [ReadOnly(true)] [Browsable(false)] - public virtual string ConfirmationText { get; } = "do this action?"; + public virtual string ConfirmationText => $"{Text}?"; #endregion diff --git a/UVtools.GUI/Forms/FrmToolWindow.cs b/UVtools.GUI/Forms/FrmToolWindow.cs index 08fc7d1..8be891e 100644 --- a/UVtools.GUI/Forms/FrmToolWindow.cs +++ b/UVtools.GUI/Forms/FrmToolWindow.cs @@ -82,7 +82,7 @@ namespace UVtools.GUI.Forms [ReadOnly(true)] [Browsable(false)] - public virtual string ConfirmationText { get; } = "do this action?"; + public virtual string ConfirmationText => $"{Text}?"; #endregion