# HG changeset patch # User StephaneLenclud # Date 1469461692 -7200 # Node ID c466f72a834febe12f27cbfd878cef22fbb94ff1 # Parent 94f91d446339e83cedad3ded7fb126b3801167d0 Focusing relevant event node after rebuilding our tree view. diff -r 94f91d446339 -r c466f72a834f Server/MainForm.cs --- a/Server/MainForm.cs Mon Jul 25 17:14:45 2016 +0200 +++ b/Server/MainForm.cs Mon Jul 25 17:48:12 2016 +0200 @@ -300,7 +300,7 @@ } /// - /// + /// Populate tree view with events and actions /// private void SetupEvents() { @@ -308,6 +308,8 @@ buttonAddAction.Enabled = false; buttonDeleteAction.Enabled = false; + Event currentEvent = CurrentEvent(); + //Reset our tree iTreeViewEvents.Nodes.Clear(); //Populate registered events @@ -328,6 +330,7 @@ } iTreeViewEvents.ExpandAll(); + SelectEvent(currentEvent); } @@ -2642,6 +2645,27 @@ SetupCecLogLevel(); } + + /// + /// + /// + /// + private void SelectEvent(Event aEvent) + { + if (aEvent == null) + { + return; + } + + string key = aEvent.GetType().Name; + TreeNode[] res=iTreeViewEvents.Nodes.Find(key, false); + if (res.Length > 0) + { + iTreeViewEvents.SelectedNode = res[0]; + iTreeViewEvents.Focus(); + } + } + /// /// ///