diff --git a/source/MvcNavigation/Node.cs b/source/MvcNavigation/Node.cs index 794f679..8cffa8c 100644 --- a/source/MvcNavigation/Node.cs +++ b/source/MvcNavigation/Node.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Web.Mvc; @@ -9,19 +9,21 @@ public class Node : NodeBase where TController : IController { IList _childNodes; - public Node(Expression> action) : this(action, null, new INode[0]) + public Node(Expression> action) + : this(action, null, String.Empty, new INode[0]) { } - public Node(Expression> action, string title) : this(action, title, new INode[0]) + public Node(Expression> action, string title) : this(action, title, String.Empty, new INode[0]) { } - public Node(Expression> action, params INode[] childNodes) : this(action, null, childNodes) + public Node(Expression> action, params INode[] childNodes) + : this(action, null, String.Empty, childNodes) { } - public Node(Expression> action, string title, params INode[] childNodes) + public Node(Expression> action, string title, string iconFileName, params INode[] childNodes) { if (action == null) throw new ArgumentNullException("action"); @@ -33,7 +35,7 @@ public Node(Expression> action, string title, params INode[] if (methodCallExpression == null) throw new ArgumentException("Node must be initialised with method call expression (e.g. controller => controller.Action())", "action"); - Initialise(methodCallExpression, title); + Initialise(methodCallExpression, title, iconFileName); InitialiseChildNodes(childNodes); } @@ -61,16 +63,30 @@ public class Node : Node where TCon { } + public Node(Expression> action, string title, string iconFileName) + : this(action, title, iconFileName, new INode[0]) + { + } + public Node(Expression> action, params INode[] childNodes) : this(action, null, childNodes) { } - public Node(Expression> action, string title, params INode[] childNodes) : base(action, title, childNodes) + public Node(Expression> action, string title, params INode[] childNodes) : base(action, title, String.Empty, childNodes) { // ReSharper disable DoNotCallOverridableMethodsInConstructor AreaName = Activator.CreateInstance().AreaName; SetAreaName(RouteValues, AreaName); // ReSharper restore DoNotCallOverridableMethodsInConstructor } + + public Node(Expression> action, string title, string iconFileName, params INode[] childNodes) + : base(action, title, iconFileName, childNodes) + { + // ReSharper disable DoNotCallOverridableMethodsInConstructor + AreaName = Activator.CreateInstance().AreaName; + SetAreaName(RouteValues, AreaName); + // ReSharper restore DoNotCallOverridableMethodsInConstructor + } } -} \ No newline at end of file +}