Repository: FlaxEngine/FlaxEngine
File: Source/Editor/Surface/VisjectSurfaceWindow.cs (C#)

Code before:
            {
                var action = new EditParamAttributesAction
                {
                    Window = window,
                    Index = index,
                    Before = window.VisjectSurface.Parameters[index].Meta.GetAttributes(),
                    After = newValue,
                };
                window.VisjectSurface.Undo.AddAction(action);
                action.Do();
            };
            editor.Show(label, label.Size * 0.5f);
        }

        private void DeleteParameter(int index)
        {
            bool displayWarning = Editor.Instance.Options.Options.Interface.WarnOnDeletingUsedVisjectParameter;

            var window = (IVisjectSurfaceWindow)Values[0];
            SurfaceParameter param = window.VisjectSurface.Parameters[index];

            int connectedParameterNodeCount = 0;

            List<SurfaceNode> nodes = window.VisjectSurface.Nodes;

            for (int i = 0; i < window.VisjectSurface.Nodes.Count; i++)
            {
                if (nodes[i] is IParametersDependantNode node)
                {
                    if (displayWarning && node.IsParamreferenced(param, window.VisjectSurface))
                        connectedParameterNodeCount++;
                }
            }

            if (displayWarning)
            {
                string singularPlural = connectedParameterNodeCount > 1 ? "s" : "";
                string msg = $"Delete parameter {param.Name}?\nParameter is being used in a graph {connectedParameterNodeCount} time{singularPlural}.\n\nYou can disable this warning in the editor settings.";

                if (connectedParameterNodeCount > 0)
                    if (MessageBox.Show(msg, "Delete parameter", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
                        return;
            }

            var action = new AddRemoveParamAction
            {
                Window = window,
                IsAdd = false,
                Index = index,
            };
            window.VisjectSurface.Undo.AddAction(action);

Review comment (refactor):
I would simplify this and just make `bool isParamUsed = window.VisjectSurface.IsParamreferenced(param )`, then ignore plural version of message.

Code after:
            {
                var action = new EditParamAttributesAction
                {
                    Window = window,
                    Index = index,
                    Before = window.VisjectSurface.Parameters[index].Meta.GetAttributes(),
                    After = newValue,
                };
                window.VisjectSurface.Undo.AddAction(action);
                action.Do();
            };
            editor.Show(label, label.Size * 0.5f);
        }

        private void DeleteParameter(int index)
        {
            bool displayWarning = Editor.Instance.Options.Options.Interface.WarnOnDeletingUsedVisjectParameter;

            var window = (IVisjectSurfaceWindow)Values[0];
            SurfaceParameter param = window.VisjectSurface.Parameters[index];

            int connectedParameterNodeCount = 0;

            List<SurfaceNode> nodes = window.VisjectSurface.Nodes;

            for (int i = 0; i < window.VisjectSurface.Nodes.Count; i++)
            {
                if (nodes[i] is IParametersDependantNode node)
                {
                    if (displayWarning && node.IsParamreferenced(param))
                        connectedParameterNodeCount++;
                }
            }

            if (displayWarning)
            {
                string singularPlural = connectedParameterNodeCount > 1 ? "s" : "";
                string msg = $"Delete parameter {param.Name}?\nParameter is being used in a graph {connectedParameterNodeCount} time{singularPlural}.\n\nYou can disable this warning in the editor settings.";

                if (connectedParameterNodeCount > 0)
                    if (MessageBox.Show(msg, "Delete parameter", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
                        return;
            }

            var action = new AddRemoveParamAction
            {
                Window = window,
                IsAdd = false,
                Index = index,
            };
            window.VisjectSurface.Undo.AddAction(action);