76 lines
2.1 KiB
C#
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...");
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|