private void UpdateCurrentIcon()
        {
            if (CacheStatus == BuildCacheStatus.Loading)
            {
                CurrentIcon = IconProvider.LoadingIcon;
            }
            else if (CacheStatus == BuildCacheStatus.NotConfigured)
            {
                CurrentIcon = IconProvider.SettingsIcon;
            }
            else if (CacheStatus == BuildCacheStatus.Operational)
            {
                if (!BuildsStatus.Any())
                {
                    return;
                }

                var relevantBuilds = new List <IBuild>();
                foreach (var buildStatus in BuildsStatus)
                {
                    var lastFinishedBuild = buildStatus.AllBuildItems.LastOrDefault(a => a.Build.Status != BuildStatus.Running && a.Build.Status != BuildStatus.Queued);
                    if (lastFinishedBuild != null)
                    {
                        relevantBuilds.Add(lastFinishedBuild.Build);
                    }
                }

                if (relevantBuilds.All(a => a.Status == BuildStatus.Succeeded))
                {
                    CurrentIcon = IconProvider.GetIconForBuildStatus(BuildStatus.Succeeded);
                    return;
                }

                if (relevantBuilds.Any(a => a.Status == BuildStatus.PartiallySucceeded))
                {
                    CurrentIcon = IconProvider.GetIconForBuildStatus(BuildStatus.PartiallySucceeded);
                    return;
                }

                if (relevantBuilds.Any(a => a.Status == BuildStatus.Failed))
                {
                    CurrentIcon = IconProvider.GetIconForBuildStatus(BuildStatus.Failed);
                }
            }
        }
Esempio n. 2
0
        public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            var enumValue = EnumHelper.GetEnumValueFromObject <BuildStatus>(value);

            return(new Uri(IconProvider.GetIconForBuildStatus(enumValue)));
        }