Пример #1
0
        public void SetSignalLight(LastBuildsStatus buildsStatus, bool?enableFlashing = true, byte brightness = 5)
        {
            var isBuildInProgress = buildsStatus.AggregatedBuildStatus.Equals(AggregatedBuildStatus.InProgress);

            if (buildsStatus.AggregatedBuildStatus.Equals(AggregatedBuildStatus.None))
            {
                _signalLightController.TurnOffAll();
            }
            else
            {
                _signalLightController.TurnOffAll();

                var flash = enableFlashing.HasValue && enableFlashing.Value && isBuildInProgress;

                switch (buildsStatus.AggregatedBuildResult)
                {
                case AggregatedBuildResult.Failed:
                    _signalLightController.TurnOnColor(SignalLightColor.Red, brightness, flash);
                    break;

                case AggregatedBuildResult.PartiallySucceeded:
                    _signalLightController.TurnOnColor(SignalLightColor.Orange, brightness, flash);
                    break;

                case AggregatedBuildResult.Succeeded:
                    _signalLightController.TurnOnColor(SignalLightColor.Green, brightness, flash);
                    break;

                case AggregatedBuildResult.None:
                    _signalLightController.TurnOffAll();
                    break;
                }
            }
        }
Пример #2
0
 private void StopLighthouse()
 {
     Task.Run(() =>
     {
         _signalLightController?.TurnOffAll();
         _buildsWatcher?.Stop();
     });
 }