1.1 --- a/Server/FormMain.cs Mon Aug 15 12:11:26 2016 +0200
1.2 +++ b/Server/FormMain.cs Tue Aug 16 12:25:20 2016 +0200
1.3 @@ -46,7 +46,7 @@
1.4 using SharpDisplay;
1.5 using MiniDisplayInterop;
1.6 using SharpLib.Display;
1.7 -using SharpLib.Ear;
1.8 +using Ear = SharpLib.Ear;
1.9
1.10 namespace SharpDisplayManager
1.11 {
1.12 @@ -80,7 +80,7 @@
1.13 [System.ComponentModel.DesignerCategory("Form")]
1.14 public partial class FormMain : FormMainHid, IMMNotificationClient
1.15 {
1.16 - //public ManagerEventAction iManager = new ManagerEventAction();
1.17 + //public Manager iManager = new Manager();
1.18 DateTime LastTickTime;
1.19 Display iDisplay;
1.20 System.Drawing.Bitmap iBmp;
1.21 @@ -141,18 +141,18 @@
1.22
1.23 public FormMain()
1.24 {
1.25 - ManagerEventAction.Current = Properties.Settings.Default.Events;
1.26 - if (ManagerEventAction.Current == null)
1.27 + Ear.Manager.Current = Properties.Settings.Default.Events;
1.28 + if (Ear.Manager.Current == null)
1.29 {
1.30 //No actions in our settings yet
1.31 - ManagerEventAction.Current = new ManagerEventAction();
1.32 - Properties.Settings.Default.Events = ManagerEventAction.Current;
1.33 + Ear.Manager.Current = new Ear.Manager();
1.34 + Properties.Settings.Default.Events = Ear.Manager.Current;
1.35 }
1.36 else
1.37 {
1.38 //We loaded actions from our settings
1.39 //We need to hook them with corresponding events
1.40 - ManagerEventAction.Current.Init();
1.41 + Ear.Manager.Current.Init();
1.42 }
1.43 iSkipFrameRendering = false;
1.44 iClosing = false;
1.45 @@ -322,14 +322,14 @@
1.46 buttonActionAdd.Enabled = false;
1.47 buttonActionDelete.Enabled = false;
1.48
1.49 - Event currentEvent = CurrentEvent();
1.50 - SharpLib.Ear.Action currentAction = CurrentAction();
1.51 + Ear.Event currentEvent = CurrentEvent();
1.52 + Ear.Action currentAction = CurrentAction();
1.53 TreeNode treeNodeToSelect = null;
1.54
1.55 //Reset our tree
1.56 iTreeViewEvents.Nodes.Clear();
1.57 //Populate registered events
1.58 - foreach (SharpLib.Ear.Event e in ManagerEventAction.Current.Events)
1.59 + foreach (Ear.Event e in Ear.Manager.Current.Events)
1.60 {
1.61 //Create our event node
1.62 TreeNode eventNode = iTreeViewEvents.Nodes.Add(e.Name);
1.63 @@ -347,7 +347,7 @@
1.64 actionsNodes.ForeColor = eventNode.ForeColor;
1.65
1.66 // Add our actions for that event
1.67 - foreach (SharpLib.Ear.Action a in e.Actions)
1.68 + foreach (Ear.Action a in e.Actions)
1.69 {
1.70 TreeNode actionNode = actionsNodes.Nodes.Add(a.Brief());
1.71 actionNode.Tag = a;
1.72 @@ -2765,7 +2765,7 @@
1.73 ///
1.74 /// </summary>
1.75 /// <param name="aEvent"></param>
1.76 - private void SelectEvent(Event aEvent)
1.77 + private void SelectEvent(Ear.Event aEvent)
1.78 {
1.79 if (aEvent == null)
1.80 {
1.81 @@ -2788,16 +2788,16 @@
1.82 /// Get the current event based on event tree view selection.
1.83 /// </summary>
1.84 /// <returns></returns>
1.85 - private Event CurrentEvent()
1.86 + private Ear.Event CurrentEvent()
1.87 {
1.88 //Walk up the tree from the selected node to find our event
1.89 TreeNode node = iTreeViewEvents.SelectedNode;
1.90 - Event selectedEvent = null;
1.91 + Ear.Event selectedEvent = null;
1.92 while (node != null)
1.93 {
1.94 - if (node.Tag is Event)
1.95 + if (node.Tag is Ear.Event)
1.96 {
1.97 - selectedEvent = (Event) node.Tag;
1.98 + selectedEvent = (Ear.Event) node.Tag;
1.99 break;
1.100 }
1.101 node = node.Parent;
1.102 @@ -2810,12 +2810,12 @@
1.103 /// Get the current action based on event tree view selection
1.104 /// </summary>
1.105 /// <returns></returns>
1.106 - private SharpLib.Ear.Action CurrentAction()
1.107 + private Ear.Action CurrentAction()
1.108 {
1.109 TreeNode node = iTreeViewEvents.SelectedNode;
1.110 - if (node != null && node.Tag is SharpLib.Ear.Action)
1.111 + if (node != null && node.Tag is Ear.Action)
1.112 {
1.113 - return (SharpLib.Ear.Action) node.Tag;
1.114 + return (Ear.Action) node.Tag;
1.115 }
1.116
1.117 return null;
1.118 @@ -2828,20 +2828,20 @@
1.119 /// <param name="e"></param>
1.120 private void buttonActionAdd_Click(object sender, EventArgs e)
1.121 {
1.122 - Event selectedEvent = CurrentEvent();
1.123 + Ear.Event selectedEvent = CurrentEvent();
1.124 if (selectedEvent == null)
1.125 {
1.126 //We did not find a corresponding event
1.127 return;
1.128 }
1.129
1.130 - FormEditObject<SharpLib.Ear.Action> ea = new FormEditObject<SharpLib.Ear.Action>();
1.131 + FormEditObject<Ear.Action> ea = new FormEditObject<Ear.Action>();
1.132 ea.Text = "Add action";
1.133 DialogResult res = CodeProject.Dialog.DlgBox.ShowDialog(ea);
1.134 if (res == DialogResult.OK)
1.135 {
1.136 selectedEvent.Actions.Add(ea.Object);
1.137 - Properties.Settings.Default.Events = ManagerEventAction.Current;
1.138 + Properties.Settings.Default.Events = Ear.Manager.Current;
1.139 Properties.Settings.Default.Save();
1.140 PopulateEventsTreeView();
1.141 }
1.142 @@ -2854,15 +2854,15 @@
1.143 /// <param name="e"></param>
1.144 private void buttonActionEdit_Click(object sender, EventArgs e)
1.145 {
1.146 - Event selectedEvent = CurrentEvent();
1.147 - SharpLib.Ear.Action selectedAction = CurrentAction();
1.148 + Ear.Event selectedEvent = CurrentEvent();
1.149 + Ear.Action selectedAction = CurrentAction();
1.150 if (selectedEvent == null || selectedAction == null)
1.151 {
1.152 //We did not find a corresponding event
1.153 return;
1.154 }
1.155
1.156 - FormEditObject<SharpLib.Ear.Action> ea = new FormEditObject<SharpLib.Ear.Action>();
1.157 + FormEditObject<Ear.Action> ea = new FormEditObject<Ear.Action>();
1.158 ea.Text = "Edit action";
1.159 ea.Object = selectedAction;
1.160 int actionIndex = iTreeViewEvents.SelectedNode.Index;
1.161 @@ -2872,7 +2872,7 @@
1.162 //Update our action
1.163 selectedEvent.Actions[actionIndex]=ea.Object;
1.164 //Save and rebuild our event tree view
1.165 - Properties.Settings.Default.Events = ManagerEventAction.Current;
1.166 + Properties.Settings.Default.Events = Ear.Manager.Current;
1.167 Properties.Settings.Default.Save();
1.168 PopulateEventsTreeView();
1.169 }
1.170 @@ -2886,15 +2886,15 @@
1.171 private void buttonActionDelete_Click(object sender, EventArgs e)
1.172 {
1.173
1.174 - SharpLib.Ear.Action action = CurrentAction();
1.175 + Ear.Action action = CurrentAction();
1.176 if (action == null)
1.177 {
1.178 //Must select action node
1.179 return;
1.180 }
1.181
1.182 - ManagerEventAction.Current.RemoveAction(action);
1.183 - Properties.Settings.Default.Events = ManagerEventAction.Current;
1.184 + Ear.Manager.Current.RemoveAction(action);
1.185 + Properties.Settings.Default.Events = Ear.Manager.Current;
1.186 Properties.Settings.Default.Save();
1.187 PopulateEventsTreeView();
1.188 }
1.189 @@ -2906,7 +2906,7 @@
1.190 /// <param name="e"></param>
1.191 private void buttonActionTest_Click(object sender, EventArgs e)
1.192 {
1.193 - SharpLib.Ear.Action a = CurrentAction();
1.194 + Ear.Action a = CurrentAction();
1.195 if (a != null)
1.196 {
1.197 a.Test();
1.198 @@ -2921,7 +2921,7 @@
1.199 /// <param name="e"></param>
1.200 private void buttonActionMoveUp_Click(object sender, EventArgs e)
1.201 {
1.202 - SharpLib.Ear.Action a = CurrentAction();
1.203 + Ear.Action a = CurrentAction();
1.204 if (a == null ||
1.205 //Action already at the top of the list
1.206 iTreeViewEvents.SelectedNode.Index == 0)
1.207 @@ -2930,15 +2930,15 @@
1.208 }
1.209
1.210 //Swap actions in event's action list
1.211 - Event currentEvent = CurrentEvent();
1.212 + Ear.Event currentEvent = CurrentEvent();
1.213 int currentIndex = iTreeViewEvents.SelectedNode.Index;
1.214 - SharpLib.Ear.Action movingUp = currentEvent.Actions[currentIndex];
1.215 - SharpLib.Ear.Action movingDown = currentEvent.Actions[currentIndex-1];
1.216 + Ear.Action movingUp = currentEvent.Actions[currentIndex];
1.217 + Ear.Action movingDown = currentEvent.Actions[currentIndex-1];
1.218 currentEvent.Actions[currentIndex] = movingDown;
1.219 currentEvent.Actions[currentIndex-1] = movingUp;
1.220
1.221 //Save and populate our tree again
1.222 - Properties.Settings.Default.Events = ManagerEventAction.Current;
1.223 + Properties.Settings.Default.Events = Ear.Manager.Current;
1.224 Properties.Settings.Default.Save();
1.225 PopulateEventsTreeView();
1.226
1.227 @@ -2951,7 +2951,7 @@
1.228 /// <param name="e"></param>
1.229 private void buttonActionMoveDown_Click(object sender, EventArgs e)
1.230 {
1.231 - SharpLib.Ear.Action a = CurrentAction();
1.232 + Ear.Action a = CurrentAction();
1.233 if (a == null ||
1.234 //Action already at the bottom of the list
1.235 iTreeViewEvents.SelectedNode.Index == iTreeViewEvents.SelectedNode.Parent.Nodes.Count - 1)
1.236 @@ -2960,15 +2960,15 @@
1.237 }
1.238
1.239 //Swap actions in event's action list
1.240 - Event currentEvent = CurrentEvent();
1.241 + Ear.Event currentEvent = CurrentEvent();
1.242 int currentIndex = iTreeViewEvents.SelectedNode.Index;
1.243 - SharpLib.Ear.Action movingDown = currentEvent.Actions[currentIndex];
1.244 - SharpLib.Ear.Action movingUp = currentEvent.Actions[currentIndex + 1];
1.245 + Ear.Action movingDown = currentEvent.Actions[currentIndex];
1.246 + Ear.Action movingUp = currentEvent.Actions[currentIndex + 1];
1.247 currentEvent.Actions[currentIndex] = movingUp;
1.248 currentEvent.Actions[currentIndex + 1] = movingDown;
1.249
1.250 //Save and populate our tree again
1.251 - Properties.Settings.Default.Events = ManagerEventAction.Current;
1.252 + Properties.Settings.Default.Events = Ear.Manager.Current;
1.253 Properties.Settings.Default.Save();
1.254 PopulateEventsTreeView();
1.255 }
1.256 @@ -2981,7 +2981,7 @@
1.257 /// <param name="e"></param>
1.258 private void buttonEventTest_Click(object sender, EventArgs e)
1.259 {
1.260 - Event earEvent = CurrentEvent();
1.261 + Ear.Event earEvent = CurrentEvent();
1.262 if (earEvent != null)
1.263 {
1.264 earEvent.Test();
1.265 @@ -3013,7 +3013,7 @@
1.266 buttonEventEdit.Enabled =
1.267 CurrentEvent() != null;
1.268
1.269 - SharpLib.Ear.Action currentAction = CurrentAction();
1.270 + Ear.Action currentAction = CurrentAction();
1.271 //If an action is selected enable the following buttons
1.272 buttonActionTest.Enabled =
1.273 buttonActionDelete.Enabled =
1.274 @@ -3033,13 +3033,13 @@
1.275
1.276 private void buttonEventAdd_Click(object sender, EventArgs e)
1.277 {
1.278 - FormEditObject<SharpLib.Ear.Event> ea = new FormEditObject<SharpLib.Ear.Event>();
1.279 + FormEditObject<Ear.Event> ea = new FormEditObject<Ear.Event>();
1.280 ea.Text = "Add event";
1.281 DialogResult res = CodeProject.Dialog.DlgBox.ShowDialog(ea);
1.282 if (res == DialogResult.OK)
1.283 {
1.284 - ManagerEventAction.Current.Events.Add(ea.Object);
1.285 - Properties.Settings.Default.Events = ManagerEventAction.Current;
1.286 + Ear.Manager.Current.Events.Add(ea.Object);
1.287 + Properties.Settings.Default.Events = Ear.Manager.Current;
1.288 Properties.Settings.Default.Save();
1.289 PopulateEventsTreeView();
1.290 SelectEvent(ea.Object);
1.291 @@ -3048,29 +3048,29 @@
1.292
1.293 private void buttonEventDelete_Click(object sender, EventArgs e)
1.294 {
1.295 - SharpLib.Ear.Event currentEvent = CurrentEvent();
1.296 + Ear.Event currentEvent = CurrentEvent();
1.297 if (currentEvent == null)
1.298 {
1.299 //Must select action node
1.300 return;
1.301 }
1.302
1.303 - ManagerEventAction.Current.Events.Remove(currentEvent);
1.304 - Properties.Settings.Default.Events = ManagerEventAction.Current;
1.305 + Ear.Manager.Current.Events.Remove(currentEvent);
1.306 + Properties.Settings.Default.Events = Ear.Manager.Current;
1.307 Properties.Settings.Default.Save();
1.308 PopulateEventsTreeView();
1.309 }
1.310
1.311 private void buttonEventEdit_Click(object sender, EventArgs e)
1.312 {
1.313 - Event selectedEvent = CurrentEvent();
1.314 + Ear.Event selectedEvent = CurrentEvent();
1.315 if (selectedEvent == null)
1.316 {
1.317 //We did not find a corresponding event
1.318 return;
1.319 }
1.320
1.321 - FormEditObject<SharpLib.Ear.Event> ea = new FormEditObject<SharpLib.Ear.Event>();
1.322 + FormEditObject<Ear.Event> ea = new FormEditObject<Ear.Event>();
1.323 ea.Text = "Edit event";
1.324 ea.Object = selectedEvent;
1.325 int actionIndex = iTreeViewEvents.SelectedNode.Index;
1.326 @@ -3078,7 +3078,7 @@
1.327 if (res == DialogResult.OK)
1.328 {
1.329 //Save and rebuild our event tree view
1.330 - Properties.Settings.Default.Events = ManagerEventAction.Current;
1.331 + Properties.Settings.Default.Events = Ear.Manager.Current;
1.332 Properties.Settings.Default.Save();
1.333 PopulateEventsTreeView();
1.334 }