Posted on 27/04/2020 11:46:37
Yes, see screendump and code.
You cannot create root level nodes and parent nodes should have at least one child
using Dynamicweb.Core.UI;
using Dynamicweb.Management.Actions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dynamicweb.Management.Demo
{
[Navigator("Settings/")]
public class MySettingsNavigator : INavigator
{
private readonly Node Hello1Node;
private readonly Node Hello2Node;
private readonly Node Hello3Node;
public MySettingsNavigator()
{
Hello1Node = new Node()
{
Id = "Hello1",
HasNodes = false,
HasActions = true,
Icon = Core.UI.Icons.KnownIcon.AccountBalanceWallet,
IconColor = KnownColor.Folder,
Title = "Hello 1",
DefaultAction = new OpenScreenAction("/Admin/Content/Management/EventViewer/EventViewerOverview.aspx"),
Actions = new Core.UI.Actions.Action[]
{
new OpenScreenAction("/Admin/Content/Management/EventViewer/EventViewerOverview.aspx")
{
Icon= Core.UI.Icons.KnownIcon.Facebook,
Title = "Facebook 1"
},
new OpenScreenAction("/Admin/Content/Management/EventViewer/EventViewerOverview.aspx")
{
Icon= Core.UI.Icons.KnownIcon.FacebookSquare,
Title = "Facebook 2"
}
}
};
Hello2Node = new Node()
{
Id = "Hello2",
HasNodes = false,
HasActions = false,
Icon = Core.UI.Icons.KnownIcon.BookmarkOutline,
IconColor = KnownColor.Danger,
Title = "Hello 2",
DefaultAction = new OpenScreenAction("/Admin/Content/Management/EventViewer/EventViewerOverview.aspx"),
};
Hello3Node = new Node()
{
Id = "Hello3",
HasNodes = false,
HasActions = false,
Icon = Core.UI.Icons.KnownIcon.TencentWeibo,
IconColor = KnownColor.Modules,
Title = "Hello 3",
DefaultAction = new ShowMessageAction("Hello world!")
};
}
public IEnumerable<Node> GetNodes(string path, IDictionary<string, string> requestParameters)
{
if (path == "System")
{
return new[] { Hello1Node, Hello2Node };
}
else if (path == "ControlPanel")
{
return new[] { Hello3Node };
}
return Enumerable.Empty<Node>();
}
public IEnumerable<Core.UI.Actions.Action> GetActions(string path, IDictionary<string, string> requestParameters)
{
if (path == Hello1Node.Id)
{
return Hello1Node.Actions;
}
if (path == Hello2Node.Id)
{
return Hello2Node.Actions;
}
if (path == Hello3Node.Id)
{
return Hello3Node.Actions;
}
return Enumerable.Empty<Core.UI.Actions.Action>();
}
}
}