Example #1
0
        public void TestIntersect()
        {
            TimeNode tn;
            TimeNode tn1 = new TimeNode ();
            TimeNode tn2 = new TimeNode ();
            tn1.Start = new Time (1000);
            tn1.Stop = new Time (2000);

            /* Lower out bounds */
            tn2.Start = new Time (0);
            tn2.Stop = new Time (1000);
            Assert.IsNull (tn1.Intersect (tn2));

            /* Upper out bounds */
            tn2.Start = new Time (2000);
            tn2.Stop = new Time (2100);
            Assert.IsNull (tn1.Intersect (tn2));

            /* Intersection */
            tn2.Start = new Time (1500);
            tn2.Stop = new Time (2400);
            TimeNode tn3 = tn1.Intersect (tn2);
            Assert.AreEqual (1500, tn3.Start.MSeconds);
            Assert.AreEqual (2000, tn3.Stop.MSeconds);
        }
 protected virtual void OnTimeNodeChanged(TimeNode tNode, object val)
 {
     if (TimeNodeChanged != null)
     {
         TimeNodeChanged(tNode, val);
     }
 }
Example #3
0
 void HandleCameraDragged(MediaFile mediafile, TimeNode timenode)
 {
     // Start by pausing players
     Pause();
     // And update
     HandleCameraUpdate(camerasTimeline.SelectedCamera);
 }
Example #4
0
 protected virtual void OnTimeNodeChanged(TimeNode tNode, object val)
 {
     /* FIXME: Tricky, create a new handler for categories */
     if (tNode is Play && val is Time)
     {
         if (tNode != selectedTimeNode)
         {
             OnPlaySelected((Play)tNode);
         }
         Time pos = (Time)val;
         if (pos == tNode.Start)
         {
             player.UpdateSegmentStartTime(pos.MSeconds);
         }
         else
         {
             player.UpdateSegmentStopTime(pos.MSeconds);
         }
     }
     else if (tNode is Category)
     {
         mainWindow.UpdateCategories(openedProject.Categories);
     }
     filter.Update();
 }
Example #5
0
 private void EmitTimeNodeChanged(TimeNode tNode, object val)
 {
     if (TimeNodeChanged != null)
     {
         TimeNodeChanged(tNode, val);
     }
 }
Example #6
0
 protected void EmitTimeNodeChanged(TimeNode tNode)
 {
     if (TimeNodeChanged != null)
     {
         TimeNodeChanged(tNode, tNode.Name);
     }
 }
Example #7
0
        private static TimeProfile CreateDefaultProfile()
        {
            var result = new TimeProfile();

            var wakeUpTime = new TimeNode(TimeSpan.FromHours(7));
            wakeUpTime.Properties.Add(new NodeProperty(NodeProperty.Brightness, 20));
            wakeUpTime.Properties.Add(new NodeProperty(NodeProperty.ColorTemperature, 3300));
            result.Nodes.Add(wakeUpTime);

            var morning = new TimeNode(TimeSpan.FromHours(8));
            morning.Properties.Add(new NodeProperty(NodeProperty.Brightness, 80));
            morning.Properties.Add(new NodeProperty(NodeProperty.ColorTemperature, 6500));
            result.Nodes.Add(morning);

            var srsModeOver = new TimeNode(TimeSpan.FromHours(17));
            srsModeOver.Properties.Add(new NodeProperty(NodeProperty.Brightness, 80));
            srsModeOver.Properties.Add(new NodeProperty(NodeProperty.ColorTemperature, 6500));
            result.Nodes.Add(srsModeOver);

            var afterDinner = new TimeNode(TimeSpan.FromHours(19));
            afterDinner.Properties.Add(new NodeProperty(NodeProperty.Brightness, 40));
            afterDinner.Properties.Add(new NodeProperty(NodeProperty.ColorTemperature, 5000));
            result.Nodes.Add(afterDinner);

            var bedTime = new TimeNode(TimeSpan.FromHours(22));
            bedTime.Properties.Add(new NodeProperty(NodeProperty.Brightness, 20));
            bedTime.Properties.Add(new NodeProperty(NodeProperty.ColorTemperature, 3300));
            result.Nodes.Add(bedTime);

            return result;
        }
        public void TestItNow()
        {
            var originalProfile = new TimeProfile
                {
                    Name = "Test time profile"
                };
            var originalNode = new TimeNode(TimeSpan.FromHours(7));
            originalNode.Properties.Add(new NodeProperty(NodeProperty.Brightness, 20));
            originalNode.Properties.Add(new NodeProperty(NodeProperty.ColorTemperature, 3300));
            originalProfile.Nodes.Add(originalNode);

            var str = TimeProfileSerializer.Serialize(originalProfile);
            Assert.IsNotNull(str);

            var deserializedProfile = TimeProfileSerializer.Deserialize(str) as TimeProfile;
            Assert.IsNotNull(deserializedProfile);
            Assert.AreEqual(originalProfile.Name, deserializedProfile.Name);
            Assert.AreEqual(originalProfile.Nodes.Count, deserializedProfile.Nodes.Count);

            var deserializedNode = deserializedProfile.Nodes[0];
            Assert.AreEqual(originalNode.TimeOfDay, deserializedNode.TimeOfDay);

            var originalBrightnessProperty = originalNode.Properties.First(_ => _.Name == NodeProperty.Brightness);
            var deserializedBrightnessProperty = deserializedNode.Properties.First(_ => _.Name == NodeProperty.Brightness);

            Assert.AreEqual(originalBrightnessProperty.Name, deserializedBrightnessProperty.Name);
            Assert.AreEqual(originalBrightnessProperty.Value, deserializedBrightnessProperty.Value);

            var originalColorTemperatureProperty = originalNode.Properties.First(_ => _.Name == NodeProperty.Brightness);
            var deserializedColorTemperatureProperty = deserializedNode.Properties.First(_ => _.Name == NodeProperty.Brightness);

            Assert.AreEqual(originalColorTemperatureProperty.Name, deserializedColorTemperatureProperty.Name);
            Assert.AreEqual(originalColorTemperatureProperty.Value, deserializedColorTemperatureProperty.Value);
        }
Example #9
0
 public void EmitTimeNodeChanged(TimeNode tn, Time time)
 {
     if (TimeNodeChanged != null)
     {
         TimeNodeChanged(tn, time);
     }
 }
Example #10
0
        private void BindEvents(MainWindow mainWindow, PlayerBin player)
        {
            /* Track loaded element */
            mainWindow.PlaySelectedEvent += (p) => { selectedTimeNode = p; };
            player.SegmentClosedEvent    += () => { selectedTimeNode = null; };

            /* Handle New/Open/Save playlist */
            mainWindow.OpenPlaylistEvent += OnOpenPlaylist;
            mainWindow.NewPlaylistEvent  += OnNewPlaylist;
            mainWindow.SavePlaylistEvent += OnSavePlaylist;

            /* Handle Add/Select/Rate events from other widgets */
            mainWindow.PlayListNodeAddedEvent    += OnPlayListNodeAdded;
            mainWindow.PlayListNodeSelectedEvent += LoadPlaylistPlay;
            mainWindow.ApplyRateEvent            += (p) => { p.Rate = player.Rate; };

            /* Handle Next/Prev from the player */
            player.Next += () => { Next(); };
            player.Prev += () => {
                if (selectedTimeNode is PlayListPlay)
                {
                    Prev();
                }
            };
        }
Example #11
0
    public void AddEvent(float time, TimeNode.Method timeEvent, bool continuity)
    {
        TimeNode t = new TimeNode(time, timeEvent, continuity);

        t.Id = TimeNodeList.Count;
        TimeNodeList.Add(t);
    }
Example #12
0
        protected override void SelectionMoved(Selection sel)
        {
            if (sel.Drawable is CameraObject)
            {
                if (CameraDragged != null)
                {
                    CameraObject co = sel.Drawable as CameraObject;
                    // Adjust offset
                    co.MediaFile.Offset = new Time(-co.TimeNode.Start.MSeconds);
                    // And notify
                    CameraDragged(co.MediaFile, co.TimeNode);
                }
            }
            else
            {
                if (TimeNodeChanged != null)
                {
                    Time     moveTime;
                    TimeNode tn = (sel.Drawable as TimeNodeObject).TimeNode;

                    if (sel.Position == SelectionPosition.Right)
                    {
                        moveTime = tn.Stop;
                    }
                    else
                    {
                        moveTime = tn.Start;
                    }
                    TimeNodeChanged(tn, moveTime);
                }
            }
        }
Example #13
0
 void HandleTimeNodeChanged(TimeNode tn, object val)
 {
     if (TimeNodeChanged != null)
     {
         TimeNodeChanged(tn, val);
     }
 }
Example #14
0
 private void LoadPlaylistPlay(PlayListPlay play)
 {
     StartClock();
     player.SetPlayListElement(play.MediaFile.FilePath, play.Start.MSeconds,
                               play.Stop.MSeconds, play.Rate, playlist.HasNext());
     selectedTimeNode = play;
 }
Example #15
0
        /// <summary>
        /// Update logic
        /// </summary>
        public override void update()
        {
            CswNbtMetaDataNodeType TimeNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Unit (Time)" );
            if( null != TimeNT )
            {
                foreach( CswNbtObjClassUnitOfMeasure TimeNode in TimeNT.getNodes( false, false ) )
                {
                    if( "Months" == TimeNode.Name.Text )
                    {
                        //According to Google, 1 month = 30.4368 days (based on averages, I'm assuming)
                        TimeNode.ConversionFactor.Base = 3.285496;
                        TimeNode.ConversionFactor.Exponent = -2;
                        TimeNode.postChanges( false );
                    }
                }
            }

            CswNbtMetaDataObjectClass MaterialOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MaterialClass );
            foreach( CswNbtMetaDataNodeType MaterialNt in MaterialOc.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp SpecificGravityNtp = MaterialNt.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterial.PropertyName.SpecificGravity );
                if( null != SpecificGravityNtp )
                {
                    SpecificGravityNtp.Attribute1 = CswConvert.ToDbVal( true ).ToString();
                }
            }
        }
Example #16
0
 public void TestDuration()
 {
     TimeNode tn = new TimeNode ();
     tn.Start = new Time (1000);
     tn.Stop = new Time (2000);
     Assert.AreEqual (tn.Duration, tn.Stop - tn.Start);
 }
Example #17
0
        private void ConnectSignals()
        {
            /* Adding Handlers for each event */

            /* Connect tagging related events */
            mainWindow.NewTagEvent        += OnNewTag;
            mainWindow.NewTagStartEvent   += OnNewPlayStart;
            mainWindow.NewTagStopEvent    += OnNewPlayStop;
            mainWindow.NewTagAtFrameEvent += OnNewTagAtFrame;
            mainWindow.TimeNodeChanged    += OnTimeNodeChanged;
            mainWindow.PlaysDeletedEvent  += OnPlaysDeleted;
            mainWindow.PlaySelectedEvent  += OnPlaySelected;

            /* Connect playlist events */
            mainWindow.PlayListNodeSelectedEvent += (tn) => { selectedTimeNode = tn; };
            /* Connect tags events */
            mainWindow.TagPlayEvent += OnTagPlay;

            /* Connect SnapshotSeries events */
            mainWindow.SnapshotSeriesEvent += OnSnapshotSeries;

            /* Connect player events */
            player.Prev += OnPrev;
            player.SegmentClosedEvent += OnSegmentClosedEvent;
            player.DrawFrame          += OnDrawFrame;
        }
        public TimeNode getParallelNode()
        {
            int      dist     = 0;
            TimeNode tempNode = this;

            while (!tempNode.isHead())
            {
                tempNode = tempNode.parent;
                dist++;
            }
            if (tempNode.parent == null)
            {
                return(null);
            }
            else
            {
                tempNode = tempNode.parent;
                dist++;
                while (dist > 0)
                {
                    tempNode = tempNode.child;
                    if (tempNode == null)
                    {
                        return(null);
                    }
                }
                return(tempNode);
            }
        }
Example #19
0
 protected void EmitTimeNodeChanged(TimeNode tn, object o)
 {
     if (TimeNodeChanged != null)
     {
         TimeNodeChanged(tn, o);
     }
 }
Example #20
0
 private void _DiscoverIntentsFromEffects()
 {
     // For each effect in the in-effect list for the context...
     //Parallel.ForEach(_currentEffects, effectNode =>
     foreach (var effectNode in CurrentEffects)
     {
         var           layer = GetLayerForNode(effectNode);
         TimeSpan      effectRelativeTime = _currentTime - effectNode.StartTime;
         EffectIntents effectIntents      = effectNode.Effect.Render();
         if (effectIntents == null)
         {
             continue;
         }
         foreach (var effectIntent in effectIntents)
         {
             foreach (IIntentNode intentNode in effectIntent.Value)
             {
                 if (TimeNode.IntersectsInclusively(intentNode, effectRelativeTime))
                 {
                     IIntentState intentState = intentNode.CreateIntentState(effectRelativeTime - intentNode.StartTime,
                                                                             layer);
                     _elementStateBuilder.AddElementState(effectIntent.Key, intentState);
                 }
             }
         }
     }
 }
Example #21
0
        public TimeNodeView(TimeNode underlyingNode)
        {
            UnderlyingNode = underlyingNode;
            CopyFrom(underlyingNode);

            PropertyChanged += TimeNodeView_PropertyChanged;
        }
Example #22
0
        override protected bool OnButtonPressEvent(Gdk.EventButton evnt)
        {
            TreePath[] paths = Selection.GetSelectedRows();

            if (Misc.RightButtonClicked(evnt))
            {
                // We don't want to unselect the play when several
                // plays are selected and we clik the right button
                // For multiedition
                if (paths.Length <= 1)
                {
                    base.OnButtonPressEvent(evnt);
                    paths = Selection.GetSelectedRows();
                }

                if (paths.Length == 1)
                {
                    TimeNode selectedTimeNode = GetValueFromPath(paths [0]) as TimeNode;
                    if (selectedTimeNode is TimelineEvent)
                    {
                        ShowMenu();
                    }
                }
                else if (paths.Length > 1)
                {
                    ShowMenu();
                }
            }
            else
            {
                GetPathAtPos((int)evnt.X, (int)evnt.Y, out pathClicked);
                base.OnButtonPressEvent(evnt);
            }
            return(true);
        }
Example #23
0
        public void TestIntersect()
        {
            TimeNode tn;
            TimeNode tn1 = new TimeNode();
            TimeNode tn2 = new TimeNode();

            tn1.Start = new Time(1000);
            tn1.Stop  = new Time(2000);

            /* Lower out bounds */
            tn2.Start = new Time(0);
            tn2.Stop  = new Time(1000);
            Assert.IsNull(tn1.Intersect(tn2));

            /* Upper out bounds */
            tn2.Start = new Time(2000);
            tn2.Stop  = new Time(2100);
            Assert.IsNull(tn1.Intersect(tn2));

            /* Intersection */
            tn2.Start = new Time(1500);
            tn2.Stop  = new Time(2400);
            TimeNode tn3 = tn1.Intersect(tn2);

            Assert.AreEqual(1500, tn3.Start.MSeconds);
            Assert.AreEqual(2000, tn3.Stop.MSeconds);
        }
Example #24
0
        public void TestDuration()
        {
            TimeNode tn = new TimeNode();

            tn.Start = new Time(1000);
            tn.Stop  = new Time(2000);
            Assert.AreEqual(tn.Duration, tn.Stop - tn.Start);
        }
Example #25
0
 void HandlePlayChanged(TimeNode tNode, Time time)
 {
     if (tNode is TimelineEvent)
     {
         LoadPlay(tNode as TimelineEvent, time, false);
         filter.Update();
     }
 }
Example #26
0
 public void UpdateSelectedPlay(Play play)
 {
     selectedTimeNode          = play;
     timeline.SelectedTimeNode = play;
     postagger.LoadPlay(play, false);
     SetTagsBoxVisibility(true);
     notes.Play = play;
 }
Example #27
0
        /// <summary>
        /// Periods segments have moved, adjust main camera position to segment boundaries
        /// </summary>
        void HandleTimeNodeChanged(TimeNode tNode, object val)
        {
            Time time = val as Time;

            Pause();
            // Don't try to be accurate here. We are looking for period starts
            Seek(time, false);
        }
Example #28
0
 protected virtual void OnPlaySelected(Play play)
 {
     Log.Debug("Play selected: " + play);
     selectedTimeNode = play;
     player.SetStartStop(play.Start.MSeconds, play.Stop.MSeconds);
     drawingManager.Play = play;
     mainWindow.UpdateSelectedPlay(play);
 }
Example #29
0
            internal DisposableWatch(WatchTree watchTree, TimeNode node)
            {
                _watchTree = watchTree;
                _node      = node;

                _watchTree._watches.Push(this);

                Start();
            }
Example #30
0
 public TimeNodeObject(TimeNode node)
 {
     TimeNode       = node;
     SelectionMode  = NodeSelectionMode.All;
     DraggingMode   = NodeDraggingMode.All;
     LineColor      = Config.Style.PaletteBackgroundLight;
     Height         = StyleConf.TimelineCategoryHeight;
     StrictClipping = true;
 }
Example #31
0
        public void RemoveNode(TimeNode node)
        {
            TimeNodeObject to;

            to = nodes.FirstOrDefault(n => n.TimeNode == node);
            if (to != null)
            {
                RemoveObject(to, true);
            }
        }
Example #32
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();
            }
        }
Example #33
0
        override protected bool OnButtonPressEvent(Gdk.EventButton evnt)
        {
            TreePath[] paths = Selection.GetSelectedRows();

            if (Misc.RightButtonClicked(evnt))
            {
                // We don't want to unselect the play when several
                // plays are selected and we clik the right button
                // For multiedition
                if (paths.Length <= 1)
                {
                    base.OnButtonPressEvent(evnt);
                    paths = Selection.GetSelectedRows();
                }

                if (paths.Length == 1)
                {
                    TimeNode selectedTimeNode = GetValueFromPath(paths [0]) as TimeNode;

                    if (selectedTimeNode != null)
                    {
                        ShowMenu();
                    }
                    else
                    {
                        EventType eventType = GetValueFromPath(paths [0]) as EventType;
                        SetupSortMenu(eventType.SortMethod);
                        categoriesMenu.Popup();
                    }
                }
                else if (paths.Length > 1)
                {
                    ShowMenu();
                }
                return(true);
            }
            else if ((evnt.Type == Gdk.EventType.ButtonPress) && (evnt.Button == 1))
            {
                base.OnButtonPressEvent(evnt);
                paths = Selection.GetSelectedRows();
                if (paths.Length == 1 && GetValueFromPath(paths [0]) is EventType)
                {
                    dragging    = true;
                    catClicked  = true;
                    dragStarted = false;
                    startX      = (int)evnt.X;
                    startY      = (int)evnt.Y;
                }
                return(true);
            }
            else
            {
                return(base.OnButtonPressEvent(evnt));
            }
        }
Example #34
0
 public void EmitTimeNodeStoppedEvent(TimeNode node, TimerButton btn, List <DashboardButton> from)
 {
     if (TimeNodeStoppedEvent != null)
     {
         if (from == null)
         {
             from = new List <DashboardButton> ();
         }
         TimeNodeStoppedEvent(node, btn, from);
     }
 }
Example #35
0
        public void TestJoin()
        {
            TimeNode tn;
            TimeNode tn1 = new TimeNode ();
            TimeNode tn2 = new TimeNode ();
            tn1.Start = new Time (1000);
            tn1.Stop = new Time (2000);

            /* Lower outbound join */
            tn2.Start = new Time (0);
            tn2.Stop = new Time (900);
            Assert.IsNull (tn1.Join (tn2));

            /* Upper limit join */
            tn2.Start = new Time (2100);
            tn2.Stop = new Time (3000);
            Assert.IsNull (tn1.Join (tn2));

            /* Lower limit join */
            tn2.Start = new Time (0);
            tn2.Stop = new Time (1000);
            tn = tn1.Join (tn2);
            Assert.AreEqual (tn.Start, tn2.Start);
            Assert.AreEqual (tn.Stop, tn1.Stop);

            /* Upper limit join */
            tn2.Start = new Time (2000);
            tn2.Stop = new Time (2100);
            tn = tn1.Join (tn2);
            Assert.AreEqual (tn.Start, tn1.Start);
            Assert.AreEqual (tn.Stop, tn2.Stop);

            /* Upper Join */
            tn2.Start = new Time (1900);
            tn = tn1.Join (tn2);
            Assert.AreEqual (tn.Start, tn1.Start);
            Assert.AreEqual (tn.Stop, tn2.Stop);

            /* Lower Join */
            tn2.Start = new Time (500);
            tn2.Stop = new Time (1500);
            tn = tn1.Join (tn2);
            Assert.AreEqual (tn.Start, tn2.Start);
            Assert.AreEqual (tn.Stop, tn1.Stop);

            /* Whole Join */
            tn2.Start = new Time (500);
            tn2.Stop = new Time (2500);
            tn = tn1.Join (tn2);
            Assert.AreEqual (tn.Start, tn2.Start);
            Assert.AreEqual (tn.Stop, tn2.Stop);
        }
Example #36
0
        public DisposableWatch Start(string name = "")
        {
            if (!Enabled)
                return null;

            CurrentDepth++;
            CurrentNode = new TimeNode(CurrentNode, name);
            CurrentNode.Parent?.Children.Add(CurrentNode);

            if (CurrentDepth == 0)
                _results.Add(DateTime.Now, CurrentNode);

            return new DisposableWatch(this, CurrentNode);
        }
Example #37
0
 public TimeNode[] GetTimeRates()
 {
     var res = new TimeNode[_removeButtons.Count];
     for (int i = 0; i < _removeButtons.Count; ++i)
     {
         res[i] = new TimeNode();
         res[i].dayNum = _dayComboBoxes[i].SelectedIndex;
         res[i].hours = _timeControls[i].Value.Hour;
         res[i].minutes = _timeControls[i].Value.Minute;
         res[i].seconds = _timeControls[i].Value.Second;
         res[i].rateNum = _rateComboBoxes[i].SelectedIndex;
         res[i].everyDay = _everyDayCheckBoces[i].Checked;
     }
     return res;
 }
        public static object Interpolate(DateTime time, TimeNode currentNode, TimeNode nextNode, string propertyName)
        {
            var currentProperty = currentNode.Properties.First(prop => prop.Name == propertyName);
            var nextProperty = nextNode.Properties.First(prop => prop.Name == propertyName);

            var currentValue = currentProperty.Value;
            var nextValue = nextProperty.Value;

            if (currentValue == null) return null;
            if (nextValue == null) return null;

            if (currentValue.GetType() != nextValue.GetType()) return null;

            var relTime = TimeUtil.GetRelativeTime(time);
            var percentage = GetRelTimePercentage(relTime, currentNode.TimeOfDay, nextNode.TimeOfDay);

            return Interpolate(currentValue, nextValue, percentage);
        }
Example #39
0
 public bool Equal(TimeNode b)
 {
     return dayNum == b.dayNum && hours == b.hours && minutes == b.minutes && seconds == b.seconds &&
            rateNum == b.rateNum && everyDay == b.everyDay;
 }
Example #40
0
 public void TestMove()
 {
     TimeNode tn = new TimeNode ();
     tn.Start = new Time (1000);
     tn.EventTime = new Time (1500);
     tn.Stop = new Time (2000);
     tn.Move (new Time (100));
     Assert.AreEqual (tn.Start.MSeconds, 1100);
     Assert.AreEqual (tn.EventTime.MSeconds, 1600);
     Assert.AreEqual (tn.Stop.MSeconds, 2100);
 }
Example #41
0
        public void TestSerialization()
        {
            TimeNode tn = new TimeNode ();

            Utils.CheckSerialization (tn);

            tn.Start = new Time (1000);
            tn.Stop = new Time (2000);
            tn.Name = "Test";
            tn.Rate = 2.0f;

            Utils.CheckSerialization (tn);

            TimeNode newtn = Utils.SerializeDeserialize (tn);
            Assert.AreEqual (tn.Start, newtn.Start);
            Assert.AreEqual (tn.Stop, newtn.Stop);
            Assert.AreEqual (tn.Name, newtn.Name);
            Assert.AreEqual (tn.Rate, newtn.Rate);
        }
Example #42
0
 public void TestUpdateEventTime()
 {
     TimeNode tn = new TimeNode ();
     tn.Start = new Time (1000);
     tn.Stop = new Time (2000);
     Assert.AreEqual (tn.EventTime, tn.Start);
     tn.EventTime = new Time (1500);
     Assert.AreEqual (tn.EventTime.MSeconds, 1500);
     /* EventTime is updated to match the time node boundaries */
     tn.Stop = new Time (1400);
     Assert.AreEqual (tn.EventTime, tn.Stop);
     tn.Start = new Time (1405);
     Assert.AreEqual (tn.EventTime, tn.Start);
 }
Example #43
0
            internal DisposableWatch(WatchTree watchTree, TimeNode node)
            {
                _watchTree = watchTree;
                _node = node;

                _watchTree._watches.Push(this);

                Start();
            }
Example #44
0
 public TimeNode(TimeNode parent, string name)
 {
     Parent = parent;
     Name = name;
     Children = new List<TimeNode>();
 }
Example #45
0
            private void WriteSnapshotRecursive(TextWriter streamWriter, TimeNode node, int depth, ref int count)
            {
                count++;

                string tabs = "";
                for (int i = 0; i < depth; i++)
                    tabs += "\t";

                streamWriter.WriteLine($"{count};{tabs}|-- {node.Name};{node.TimeSpan.TotalMilliseconds.ToString("F3")};{depth}");

                foreach (TimeNode child in node.Children)
                    WriteSnapshotRecursive(streamWriter, child, depth + 1, ref count);
            }