コード例 #1
0
ファイル: BuildExtensions.cs プロジェクト: lulzzz/Overseer-1
        /// <summary>
        /// Gets the run time of the specified <see cref="IBuild" />.
        /// </summary>
        /// <param name="build">The build.</param>
        /// <param name="currentTime">The current time.</param>
        /// <returns>The run time.</returns>
        public static TimeSpan?RunTime(this IBuild build, DateTime currentTime)
        {
            if (build.IsInProgress())
            {
                return(currentTime - build.StartTime);
            }

            if (build.IsFinished())
            {
                return(build.EndTime - build.StartTime);
            }

            return(null);
        }
コード例 #2
0
        private bool ShouldShowNotification(IProject project, IBuild build)
        {
            // Only show notifications for builds running after app start time.
            if (build.EndTime <= _appStartTime.Value)
            {
                return(false);
            }

            var id = string.Concat(project.Id, build.Id);

            if (build.IsInProgress())
            {
                if (_buildsInProgress.Contains(id))
                {
                    return(false);
                }

                _buildsInProgress.Add(id);

                return(true);
            }

            // ReSharper disable once InvertIf
            if (build.IsFinished())
            {
                if (_finishedBuilds.Contains(id))
                {
                    return(false);
                }

                _finishedBuilds.Add(id);

                return(true);
            }

            return(false);
        }