1.1 --- a/Server/MainForm.cs Sat Jul 23 16:00:04 2016 +0200
1.2 +++ b/Server/MainForm.cs Sat Jul 23 19:22:56 2016 +0200
1.3 @@ -210,6 +210,8 @@
1.4 OnWndProc += iCecManager.OnWndProc;
1.5 ResetCec();
1.6
1.7 + //Setup Events
1.8 + SetupEvents();
1.9
1.10 //Setup notification icon
1.11 SetupTrayIcon();
1.12 @@ -285,6 +287,30 @@
1.13
1.14 }
1.15
1.16 + /// <summary>
1.17 + ///
1.18 + /// </summary>
1.19 + private void SetupEvents()
1.20 + {
1.21 + //Reset our tree
1.22 + iTreeViewEvents.Nodes.Clear();
1.23 + //Populate registered events
1.24 + foreach (string key in EventActionManager.Current.Events.Keys)
1.25 + {
1.26 + Event e = EventActionManager.Current.Events[key];
1.27 + TreeNode eventNode = iTreeViewEvents.Nodes.Add(key,e.Name);
1.28 + eventNode.Tag = e;
1.29 + eventNode.Nodes.Add(key + ".Description", e.Description);
1.30 + TreeNode actionsNodes = eventNode.Nodes.Add(key + ".Actions", "Actions");
1.31 +
1.32 + foreach (SharpLib.Ear.Action a in e.Actions)
1.33 + {
1.34 + actionsNodes.Nodes.Add(a.Name);
1.35 + }
1.36 + }
1.37 +
1.38 + }
1.39 +
1.40 /// <summary>
1.41 /// Called when our display is closed.
1.42 /// </summary>
1.43 @@ -2625,5 +2651,23 @@
1.44 {
1.45 SetupCecLogLevel();
1.46 }
1.47 +
1.48 + private void buttonAddAction_Click(object sender, EventArgs e)
1.49 + {
1.50 + Event ear = (Event)iTreeViewEvents.SelectedNode.Tag;
1.51 + if (ear == null)
1.52 + {
1.53 + //Must select event node
1.54 + return;
1.55 + }
1.56 +
1.57 + FormEditAction ea = new FormEditAction();
1.58 + DialogResult res = CodeProject.Dialog.DlgBox.ShowDialog(ea);
1.59 + if (res == DialogResult.OK)
1.60 + {
1.61 + ear.Actions.Add(ea.Action);
1.62 + SetupEvents();
1.63 + }
1.64 + }
1.65 }
1.66 }