[longomatch] Update lineup after a editing a substitution



commit 47c321bbc16523aa243ce8236e558b69d50743fa
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Feb 6 16:05:36 2015 +0100

    Update lineup after a editing a substitution

 LongoMatch.Core/Common/EventsBroker.cs          |    8 ++++++++
 LongoMatch.Core/Handlers/Handlers.cs            |    2 ++
 LongoMatch.GUI/Gui/Component/CodingWidget.cs    |   19 +++++++++++++++++++
 LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs |    1 +
 4 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Core/Common/EventsBroker.cs b/LongoMatch.Core/Common/EventsBroker.cs
index 98fd46b..bb7bb8d 100644
--- a/LongoMatch.Core/Common/EventsBroker.cs
+++ b/LongoMatch.Core/Common/EventsBroker.cs
@@ -35,6 +35,7 @@ namespace LongoMatch.Core.Common
                public event DeleteEventsHandler EventsDeletedEvent;
                public event LoadEventHandler LoadEventEvent;
                public event EventLoadedHandler EventLoadedEvent;
+               public event EventEditedHandler EventEditedEvent;
                public event TimerNodeAddedHandler TimerNodeAddedEvent;
                public event MoveEventHandler MoveToEventTypeEvent;
                public event TimeNodeChangedHandler TimeNodeChanged;
@@ -123,6 +124,13 @@ namespace LongoMatch.Core.Common
                        if (EventLoadedEvent != null)
                                EventLoadedEvent (play);
                }
+
+               public void EmitEventEdited (TimelineEvent play)
+               {
+                       if (EventEditedEvent != null) {
+                               EventEditedEvent (play);
+                       }
+               }
                
                public void EmitSnapshotSeries(TimelineEvent play)
                {
diff --git a/LongoMatch.Core/Handlers/Handlers.cs b/LongoMatch.Core/Handlers/Handlers.cs
index d7ab3d8..d7d1654 100644
--- a/LongoMatch.Core/Handlers/Handlers.cs
+++ b/LongoMatch.Core/Handlers/Handlers.cs
@@ -52,6 +52,8 @@ namespace LongoMatch.Core.Handlers
        public delegate void TagEventHandler (TimelineEvent evt);
        /* Change the Play's category */
        public delegate void MoveEventHandler (TimelineEvent play,EventType eventType);
+       /* An event was edited */
+       public delegate void EventEditedHandler (TimelineEvent play);
        /* Duplicate play */
        public delegate void DuplicateEventsHandler (List<TimelineEvent> events);
        /* Emited when the dashboard is edited and might have new EventTypes */
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index d31f62f..f320ca7 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -76,7 +76,9 @@ namespace LongoMatch.Gui.Component
                        Config.EventsBroker.PlayerTick += HandleTick;
                        Config.EventsBroker.CapturerTick += HandleCapturerTick;
                        Config.EventsBroker.EventLoadedEvent += HandlePlayLoaded;
+                       Config.EventsBroker.EventsDeletedEvent += HandleEventsDeletedEvent;
                        Config.EventsBroker.TimerNodeAddedEvent += HandleTimerNodeAddedEvent;
+                       Config.EventsBroker.EventEditedEvent += HandleEventEdited;;
                        LongoMatch.Gui.Helpers.Misc.SetFocus (this, false);
                        
                        buttonswidget.Mode = TagMode.Free;
@@ -102,6 +104,8 @@ namespace LongoMatch.Gui.Component
                        Config.EventsBroker.CapturerTick -= HandleCapturerTick;
                        Config.EventsBroker.EventLoadedEvent -= HandlePlayLoaded;
                        Config.EventsBroker.TimerNodeAddedEvent -= HandleTimerNodeAddedEvent;
+                       Config.EventsBroker.EventEditedEvent -= HandleEventEdited;
+                       Config.EventsBroker.EventsDeletedEvent += HandleEventsDeletedEvent;
                        buttonswidget.Destroy ();
                        timeline.Destroy ();
                        playspositionviewer1.Destroy ();
@@ -359,6 +363,21 @@ namespace LongoMatch.Gui.Component
                {
                        timeline.AddTimerNode (timer, tn);
                }
+               
+               void HandleEventEdited (TimelineEvent play)
+               {
+                       if (play is SubstitutionEvent) {
+                               teamtagger.Reload ();
+                       }
+               }
+               
+               void HandleEventsDeletedEvent (List<TimelineEvent> events)
+               {
+                       if (events.Count (e => e is SubstitutionEvent) != 0) {
+                               teamtagger.Reload ();
+                       }
+               }
+
        }
 }
 
diff --git a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
index 8a08ab1..a58391e 100644
--- a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
+++ b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
@@ -160,6 +160,7 @@ namespace LongoMatch.Gui.Component
                        if (!Enumerable.SequenceEqual (players, SelectedPlay.Players)) {
                                Config.EventsBroker.EmitTeamTagsChanged ();
                        }
+                       Config.EventsBroker.EmitEventEdited (SelectedPlay);
                }
 
                protected void OnFilterUpdated ()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]