Fixing EAR event edition.
authorStephaneLenclud
Sun, 21 Aug 2016 16:30:58 +0200
changeset 2480220cb84df58
parent 247 afdbe76ab03b
child 249 cadc4e4302c6
Fixing EAR event edition.
EAR HID event now displays 'Press a key' if not valid.
Server/Events/EventHid.cs
Server/FormMain.cs
     1.1 --- a/Server/Events/EventHid.cs	Sun Aug 21 16:11:40 2016 +0200
     1.2 +++ b/Server/Events/EventHid.cs	Sun Aug 21 16:30:58 2016 +0200
     1.3 @@ -85,6 +85,12 @@
     1.4          {
     1.5              string brief = Name + ": ";
     1.6  
     1.7 +            if (!IsValid())
     1.8 +            {
     1.9 +                brief += "Press a key";
    1.10 +                return brief;
    1.11 +            }
    1.12 +
    1.13              if (IsKeyboard)
    1.14              {
    1.15                  brief += Key.ToString();
     2.1 --- a/Server/FormMain.cs	Sun Aug 21 16:11:40 2016 +0200
     2.2 +++ b/Server/FormMain.cs	Sun Aug 21 16:30:58 2016 +0200
     2.3 @@ -2932,10 +2932,14 @@
     2.4              FormEditObject<Ear.Event> ea = new FormEditObject<Ear.Event>();
     2.5              ea.Text = "Edit event";
     2.6              ea.Object = selectedEvent;
     2.7 -            int actionIndex = iTreeViewEvents.SelectedNode.Index;
     2.8 +            int index = iTreeViewEvents.SelectedNode.Index;
     2.9              DialogResult res = CodeProject.Dialog.DlgBox.ShowDialog(ea);
    2.10              if (res == DialogResult.OK)
    2.11 -            {
    2.12 +            {                
    2.13 +                //Make sure we keep the same actions as before
    2.14 +                ea.Object.Actions = Properties.Settings.Default.EarManager.Events[index].Actions;
    2.15 +                //Update our event
    2.16 +                Properties.Settings.Default.EarManager.Events[index] = ea.Object;
    2.17                  //Save and rebuild our event tree view
    2.18                  Properties.Settings.Default.Save();
    2.19                  PopulateEventsTreeView();