[longomatch] Make the button itself inform about the new node
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Make the button itself inform about the new node
- Date: Fri, 17 Apr 2015 16:26:32 +0000 (UTC)
commit 9f2b1800604aa665ca2664d5369bd14132b6d23b
Author: Jorge Zapata <jorgeluis zapata gmail com>
Date: Tue Apr 14 13:10:54 2015 +0200
Make the button itself inform about the new node
This make it possible to generate nodes programatically instead
of relying on the UI for that
LongoMatch.Core/Store/DashboardButton.cs | 38 ++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Core/Store/DashboardButton.cs b/LongoMatch.Core/Store/DashboardButton.cs
index fe104b1..60090c2 100644
--- a/LongoMatch.Core/Store/DashboardButton.cs
+++ b/LongoMatch.Core/Store/DashboardButton.cs
@@ -178,9 +178,12 @@ namespace LongoMatch.Core.Store
[Serializable]
public class TimerButton: DashboardButton
{
+ TimeNode currentNode;
+
public TimerButton ()
{
BackgroundColor = StyleConf.ButtonTimerColor;
+ currentNode = null;
}
public Timer Timer {
@@ -198,6 +201,41 @@ namespace LongoMatch.Core.Store
}
}
}
+
+ public void Start (Time start) {
+ if (currentNode != null)
+ return;
+
+ if (Timer != null) {
+ currentNode = Timer.Start (start);
+ }
+ }
+
+ public void Stop (Time stop) {
+ if (currentNode == null)
+ return;
+
+ if (Timer != null) {
+ Timer.Stop (stop);
+ Config.EventsBroker.EmitTimerNodeAddedEvent (this, currentNode);
+ currentNode = null;
+ }
+ }
+
+ public void Cancel () {
+ if (currentNode == null)
+ return;
+ if (Timer != null) {
+ Timer.CancelCurrent ();
+ currentNode = null;
+ }
+ }
+
+ public Time StartTime {
+ get {
+ return currentNode == null ? null : currentNode.Start;
+ }
+ }
}
[Serializable]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]