Ejemplo n.º 1
0
        public void ShowMenu(Project project, Timer timer, Time time,
		                      TimerTimeline timertimeline)
        {
            this.timer = timer;
            this.time = time;
            this.project = project;
            this.timertimeline = timertimeline;
            delitem.Visible = project != null && timer != null;
            Popup ();
        }
Ejemplo n.º 2
0
        public void TestSerialization()
        {
            Timer timer = new Timer ();
            Utils.CheckSerialization (timer);

            timer.Name = "test";
            timer.Team = LongoMatch.Core.Common.TeamType.LOCAL;
            Timer timer2 = Utils.SerializeDeserialize (timer);
            Assert.AreEqual (timer.Name, timer2.Name);
            Assert.AreEqual (timer.Nodes, timer2.Nodes);
            Assert.AreEqual (timer.Team, timer2.Team);
        }
Ejemplo n.º 3
0
 public void TestCancelTimer()
 {
     Timer timer = new Timer { Name = "Test" };
     timer.Start (new Time (1000));
     timer.Stop (new Time (2000));
     timer.CancelCurrent ();
     Assert.AreEqual (1, timer.Nodes.Count);
     timer.Start (new Time (3000));
     Assert.AreEqual (2, timer.Nodes.Count);
     timer.CancelCurrent ();
     Assert.AreEqual (1, timer.Nodes.Count);
 }
Ejemplo n.º 4
0
        public void TestStartTimer()
        {
            Timer timer = new Timer { Name = "test" };

            timer.Start (new Time (1000));
            Assert.AreEqual (1, timer.Nodes.Count);
            Assert.AreEqual ("test", timer.Nodes [0].Name);
            Assert.AreEqual (1000, timer.Nodes [0].Start.MSeconds);
            Assert.IsNull (timer.Nodes [0].Stop);

            timer.Start (new Time (5000), "new");
            Assert.AreEqual (2, timer.Nodes.Count);
            /* Starting a time should stop the previous period */
            Assert.AreEqual (5000, timer.Nodes [0].Stop.MSeconds);
            Assert.AreEqual ("new", timer.Nodes [1].Name);
            Assert.AreEqual (5000, timer.Nodes [1].Start.MSeconds);
        }
Ejemplo n.º 5
0
 void HandleShowTimerMenuEvent(Timer timer, Time time)
 {
     if (!FixedPeriods)
         menu.ShowMenu (project, timer, time, camerasTimeline.PeriodsTimeline, camerasTimeline);
 }
Ejemplo n.º 6
0
 public void RemoveTimer(Timer timer)
 {
     TimerTimeNodeObject to = (TimerTimeNodeObject)nodes.FirstOrDefault (t => (t as TimerTimeNodeObject).Timer == timer);
     if (to != null) {
         RemoveObject (to, true);
     }
     if (timers.Contains (timer)) {
         timers.Remove (timer);
     }
     ReDraw ();
 }
Ejemplo n.º 7
0
 public bool HasTimer(Timer timer)
 {
     return timers.Contains (timer);
 }
Ejemplo n.º 8
0
 public void AddTimer(Timer timer, bool newtimer = true)
 {
     foreach (TimeNode tn in timer.Nodes) {
         AddTimeNode (timer, tn);
     }
     if (newtimer) {
         timers.Add (timer);
     }
     ReDraw ();
 }
Ejemplo n.º 9
0
 public void AddTimeNode(Timer t, TimeNode tn)
 {
     TimerTimeNodeObject to = new TimerTimeNodeObject (t, tn);
     to.OffsetY = OffsetY;
     to.Height = Height;
     to.SecondsPerPixel = SecondsPerPixel;
     to.MaxTime = maxTime;
     to.DraggingMode = DraggingMode;
     to.ShowName = ShowName;
     to.LineColor = LineColor;
     AddNode (to);
 }
Ejemplo n.º 10
0
 public void FilterTimer(Timer timer, bool visible)
 {
     if (visible) {
         if (!timersFilter.Contains (timer))
             timersFilter.Add (timer);
     } else {
         if (timersFilter.Contains (timer))
             timersFilter.Remove (timer);
     }
     Update ();
 }
Ejemplo n.º 11
0
 public TimerTimeNodeObject(Timer t, TimeNode tn)
     : base(tn)
 {
     Timer = t;
 }
Ejemplo n.º 12
0
 public void AddTimerNode(Timer timer, TimeNode tn)
 {
     TimerTimeline tl = Objects.OfType<TimerTimeline> ().FirstOrDefault (t => t.HasTimer (timer));
     if (tl != null) {
         tl.AddTimeNode (timer, tn);
         widget.ReDraw ();
     }
 }
Ejemplo n.º 13
0
 public void TestTotalTime()
 {
     Timer timer = new Timer { Name = "Test" };
     timer.Start (new Time (1000));
     timer.Stop (new Time (2000));
     Assert.AreEqual (1000, timer.TotalTime.MSeconds);
     timer.Start (new Time (3000));
     Assert.AreEqual (1000, timer.TotalTime.MSeconds);
     timer.Stop (new Time (4000));
     Assert.AreEqual (2000, timer.TotalTime.MSeconds);
 }
Ejemplo n.º 14
0
 public void TestStopTimer()
 {
     Timer timer = new Timer { Name = "Test" };
     timer.Start (new Time (1000));
     Assert.IsNull (timer.Nodes [0].Stop);
     timer.Stop (new Time (1200));
     Assert.AreEqual (1200, timer.Nodes [0].Stop.MSeconds);
 }