SoraV2Utils/SoraV2Utils_Service/Notification.cs
krjan02 26cde137c9
Some checks failed
Build and Relase / build-release (push) Failing after 38s
Build and Relase / create-release (push) Failing after 10s
Initial commit (1.0.0)
2025-01-13 16:27:29 +01:00

76 lines
2.1 KiB
C#

using EasyPipes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace SoraV2Utils_Service
{
public interface IToastNotification
{
void SendToastNotification(string xml, string title);
}
public class Notification
{
public static void SingleLine(string line1)
{
var client = new Client("SoraV2UtilsNotifcation");
var service = client.GetServiceProxy<IToastNotification>();
string xml = @"
<toast>
<visual>
<binding template='ToastImageAndText01'>
<text id='1'>{0}</text>
</binding>
</visual>
<audio src='ms-winsoundevent:Notification.Default' />
</toast>";
xml = String.Format(xml, line1);
try
{
service.SendToastNotification(xml, "SoraV2 Utils");
}
catch (System.TimeoutException)
{
ServiceLogger.Instance.Log("SoraV2Utils_Agent is not responding...");
}
}
public static void TwoLine(string line1, string line2)
{
var client = new Client("SoraV2UtilsNotifcation");
var service = client.GetServiceProxy<IToastNotification>();
string xml = @"
<toast>
<visual>
<binding template='ToastImageAndText02'>
<text id='1'>{0}</text>
<text id='2'>{1}</text>
</binding>
</visual>
<audio src='ms-winsoundevent:Notification.Default' />
</toast>";
xml = String.Format(xml, line1, line2);
try
{
service.SendToastNotification(xml, "SoraV2 Utils");
}
catch (System.TimeoutException)
{
ServiceLogger.Instance.Log("SoraV2Utils_Agent is not responding...");
}
}
}
}