Beispiel #1
0
        public void Notify(NotificationType type, string notification, string nickname, string phonetic, NotifyPriority priority)
        {
            if (Muted)
            {
                return;
            }

            lock (notifications)
            {
                IEnumerable <INotifier> notifiers;
                if (this.notifications.TryGetValues(type, out notifiers))
                {
                    foreach (var n in notifiers)
                    {
                        n.Notify(type, String.Format(notification, nickname), priority);
                    }
                }
            }

            if (SpeechReceiver != null)
            {
                lock (speechNotifiers)
                {
                    IEnumerable <ITextToSpeech> speakers;
                    if (this.speechNotifiers.TryGetValues(type, out speakers))
                    {
                        foreach (var n in speakers)
                        {
                            SpeechReceiver.Receive(n.AudioSource, n.GetSpeech(String.Format(notification, (!phonetic.IsNullOrWhitespace()) ? phonetic : nickname)));
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void Notify(NotificationType type, string notification, NotifyPriority priority)
        {
            if (Muted)
            {
                return;
            }

            lock (notifications)
            {
                IEnumerable <INotifier> notifiers;
                if (this.notifications.TryGetValues(type, out notifiers))
                {
                    foreach (var n in notifiers)
                    {
                        n.Notify(type, notification, priority);
                    }
                }
            }

            if (SpeechReceiver != null)
            {
                lock (speechNotifiers)
                {
                    IEnumerable <ITextToSpeech> speakers;
                    if (this.speechNotifiers.TryGetValues(type, out speakers))
                    {
                        foreach (var n in speakers)
                        {
                            SpeechReceiver.Receive(n.AudioSource, n.GetSpeech(notification));
                        }
                    }
                }
            }
        }