[longomatch] Don't create timers timenode until it's ended
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Don't create timers timenode until it's ended
- Date: Tue, 28 Oct 2014 09:50:52 +0000 (UTC)
commit 135070adb63c7b80520a3d8ba8865f7e98fbc909
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue Oct 21 23:50:51 2014 +0200
Don't create timers timenode until it's ended
LongoMatch.Drawing/CanvasObjects/TimerObject.cs | 30 ++++++++++------------
1 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObjects/TimerObject.cs b/LongoMatch.Drawing/CanvasObjects/TimerObject.cs
index 3d9e5ba..e4373e3 100644
--- a/LongoMatch.Drawing/CanvasObjects/TimerObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/TimerObject.cs
@@ -54,11 +54,10 @@ namespace LongoMatch.Drawing.CanvasObjects
set {
bool update = false;
- if (CurrentTimeNode != null) {
- if (value < CurrentTimeNode.Start) {
- Button.Timer.CancelTimer ();
+ if (StartTime != null) {
+ if (value < StartTime) {
+ StartTime = null;
Active = false;
- CurrentTimeNode = null;
}
}
if (value != null && currentTime != null &&
@@ -66,7 +65,7 @@ namespace LongoMatch.Drawing.CanvasObjects
update = true;
}
currentTime = value;
- if (update && CurrentTimeNode != null) {
+ if (update && StartTime != null) {
ReDraw ();
}
}
@@ -75,17 +74,17 @@ namespace LongoMatch.Drawing.CanvasObjects
}
}
- TimeNode CurrentTimeNode {
+ Time StartTime {
get;
set;
}
Time PartialTime {
get {
- if (CurrentTimeNode == null) {
+ if (Start == null) {
return new Time (0);
} else {
- return CurrentTime - CurrentTimeNode.Start;
+ return CurrentTime - StartTime;
}
}
}
@@ -97,18 +96,17 @@ namespace LongoMatch.Drawing.CanvasObjects
public override void ClickReleased ()
{
- TimeNode tn;
-
base.ClickReleased ();
- tn = CurrentTimeNode;
- if (tn == null) {
+ if (StartTime == null) {
Log.Debug ("Start timer at " + CurrentTime.ToMSecondsString ());
- CurrentTimeNode = Button.Timer.StartTimer (CurrentTime);
+ StartTime = CurrentTime;
} else {
Log.Debug ("Stop timer at " + CurrentTime.ToMSecondsString ());
- Button.Timer.StopTimer (CurrentTime);
- tn.Stop = CurrentTime;
- CurrentTimeNode = null;
+ if (StartTime.MSeconds != CurrentTime.MSeconds) {
+ Button.Timer.StartTimer (StartTime);
+ Button.Timer.StopTimer (CurrentTime);
+ }
+ StartTime = null;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]