Exemple #1
0
        public ITaskTimer StartTask(string name, ITaskTimer parentTaskTimer)
        {
            var taskTimer = new TaskTimer
            {
                Id = Guid.NewGuid(),
                Name = name,
                StartedTime = DateTime.Now,
                Disposer = DisposeTaskTimer,
                Parent = parentTaskTimer,
            };

            if (parentTaskTimer != null)
            {
                parentTaskTimer.AddChild(taskTimer);
            }

            return taskTimer;
        }
Exemple #2
0
        private void DisposeTaskTimer(TaskTimer taskTimer)
        {
            if (taskTimer.IsDisposed)
            {
                // No need to do anything at all!
                return;
            }

            taskTimer.StopedTime = DateTime.Now;
            if (taskTimer.Parent != null)
            {
                return;
            }

            var stringBuilder = new StringBuilder();
            RenderTaskTimer(taskTimer, stringBuilder, 0);
            Information(stringBuilder.ToString());
        }