InvokeSetAudio() public method

public InvokeSetAudio ( SirenOfShame.Lib.Device.AudioPattern audioPattern, int duration ) : void
audioPattern SirenOfShame.Lib.Device.AudioPattern
duration int
return void
Beispiel #1
0
        public void FireEvent(RulesEngine rulesEngine, BuildStatusEnum? previousStatus, BuildStatus buildStatus)
        {
            var newlyBroken = buildStatus.IsNewlyBroken(previousStatus);
            var newlyFixed = buildStatus.IsNewlyFixed(previousStatus);

            string message = null;
            string okText = null;
            if (newlyBroken)
            {
                message = "Build newly broken by " + buildStatus.RequestedBy;
                okText = "Rats";
            }
            if (newlyFixed)
            {
                message = "Build is passing again";
                okText = "Yayy!";
            }
            if (buildStatus.BuildStatusEnum == BuildStatusEnum.InProgress)
            {
                message = "Build triggered by " + buildStatus.RequestedBy;
                okText = "Ok, whatever";
            }
            if (buildStatus.BuildStatusEnum == BuildStatusEnum.Broken && !newlyBroken)
            {
                message = "Build still broken";
                okText = "Rats";
            }
            if (buildStatus.BuildStatusEnum == BuildStatusEnum.Working && !newlyFixed)
            {
                message = "Build passed";
                okText = "Yayy!";
            }
            message += " for " + buildStatus.Name;
            if (buildStatus.BuildStatusEnum == BuildStatusEnum.InProgress && !string.IsNullOrEmpty(buildStatus.Comment))
            {
                message += "\r\n" + buildStatus.Comment;
            }

            if (AlertType == AlertType.TrayAlert && !(previousStatus == null && buildStatus.BuildStatusEnum == BuildStatusEnum.Working))
            {
                rulesEngine.InvokeTrayNotify(buildStatus.BuildStatusEnum == BuildStatusEnum.Broken ? ToolTipIcon.Error : ToolTipIcon.Info, string.Format("Build {0}", buildStatus.BuildStatusDescription), message);
            }

            if (LedPattern != null)
            {
                rulesEngine.InvokeSetLights(LedPattern, LightsDuration);
            }
            
            if (AudioPattern != null)
            {
                rulesEngine.InvokeSetAudio(AudioPattern, AudioDuration);
            }
            if (AlertType == AlertType.ModalDialog)
            {
                rulesEngine.InvokeModalDialog(message, okText);
            }

            if (!string.IsNullOrEmpty(WindowsAudioLocation) && previousStatus != null)
            {
                rulesEngine.InvokePlayWindowsAudio(WindowsAudioLocation);
            }
        }
Beispiel #2
0
        public void FireAnyUntilBuildPassesEvents(RulesEngine rulesEngine, BuildStatus buildStatus, BuildStatusEnum? previousStatus)
        {
            bool newlyFixed = buildStatus.BuildStatusEnum == BuildStatusEnum.Working && previousStatus != null && previousStatus != BuildStatusEnum.Working;

            if (PlayAudio && PlayAudioUntilBuildPasses && newlyFixed)
            {
                rulesEngine.InvokeSetAudio(null, null);
            }
            if (PlayLights && PlayLightsUntilBuildPasses && newlyFixed)
            {
                rulesEngine.InvokeSetLights(null, null);
            }
        }