diff -r 83dd86e73448 -r 96f8b4dc4300 Server/MainForm.cs --- a/Server/MainForm.cs Sat Jul 23 16:00:04 2016 +0200 +++ b/Server/MainForm.cs Sat Jul 23 19:22:56 2016 +0200 @@ -210,6 +210,8 @@ OnWndProc += iCecManager.OnWndProc; ResetCec(); + //Setup Events + SetupEvents(); //Setup notification icon SetupTrayIcon(); @@ -285,6 +287,30 @@ } + /// + /// + /// + private void SetupEvents() + { + //Reset our tree + iTreeViewEvents.Nodes.Clear(); + //Populate registered events + foreach (string key in EventActionManager.Current.Events.Keys) + { + Event e = EventActionManager.Current.Events[key]; + TreeNode eventNode = iTreeViewEvents.Nodes.Add(key,e.Name); + eventNode.Tag = e; + eventNode.Nodes.Add(key + ".Description", e.Description); + TreeNode actionsNodes = eventNode.Nodes.Add(key + ".Actions", "Actions"); + + foreach (SharpLib.Ear.Action a in e.Actions) + { + actionsNodes.Nodes.Add(a.Name); + } + } + + } + /// /// Called when our display is closed. /// @@ -2625,5 +2651,23 @@ { SetupCecLogLevel(); } + + private void buttonAddAction_Click(object sender, EventArgs e) + { + Event ear = (Event)iTreeViewEvents.SelectedNode.Tag; + if (ear == null) + { + //Must select event node + return; + } + + FormEditAction ea = new FormEditAction(); + DialogResult res = CodeProject.Dialog.DlgBox.ShowDialog(ea); + if (res == DialogResult.OK) + { + ear.Actions.Add(ea.Action); + SetupEvents(); + } + } } }