2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-01 16:33:43 -04:00

ready for testing

This commit is contained in:
Xjph
2024-01-21 13:35:03 -03:30
parent d99a190869
commit 97e981bae2
92 changed files with 3061 additions and 1186 deletions

View File

@ -1,5 +1,6 @@
using Observatory.Framework;
using Observatory.UI;
using System;
namespace Observatory.NativeNotification
{
@ -21,6 +22,11 @@ namespace Observatory.NativeNotification
notification.FormClosed += NotifyWindow_Closed;
foreach(var notificationForm in notifications)
{
notificationForm.Value.AdjustOffset(true);
}
notifications.Add(notificationGuid, notification);
notification.Show();
});
@ -34,6 +40,11 @@ namespace Observatory.NativeNotification
{
var currentNotification = (NotificationForm)sender;
foreach (var notification in notifications.Where(n => n.Value.CreationTime < currentNotification.CreationTime))
{
notification.Value.AdjustOffset(false);
}
if (notifications.ContainsKey(currentNotification.Guid))
{
notifications.Remove(currentNotification.Guid);

View File

@ -10,7 +10,7 @@ namespace Observatory.NativeNotification
{
public class NativeVoice
{
private Queue<NotificationArgs> notificationEvents;
private readonly Queue<NotificationArgs> notificationEvents;
private bool processing;
public NativeVoice()
@ -83,20 +83,24 @@ namespace Observatory.NativeNotification
processing = false;
}
private string AddVoiceToSsml(string ssml, string voiceName)
private static string AddVoiceToSsml(string ssml, string voiceName)
{
XmlDocument ssmlDoc = new();
ssmlDoc.LoadXml(ssml);
var ssmlNamespace = ssmlDoc.DocumentElement.NamespaceURI;
var ssmlNamespace = ssmlDoc.DocumentElement?.NamespaceURI;
XmlNamespaceManager ssmlNs = new(ssmlDoc.NameTable);
ssmlNs.AddNamespace("ssml", ssmlNamespace);
ssmlNs.AddNamespace("ssml", ssmlNamespace ?? string.Empty);
var voiceNode = ssmlDoc.SelectSingleNode("/ssml:speak/ssml:voice", ssmlNs);
voiceNode.Attributes.GetNamedItem("name").Value = voiceName;
var voiceNameNode = voiceNode?.Attributes?.GetNamedItem("name");
if (voiceNameNode != null)
{
voiceNameNode.Value = voiceName;
}
return ssmlDoc.OuterXml;
}
}