2020-10-24 22:05:35 +00:00
|
|
|
using Gee;
|
|
|
|
using Dino.Entities;
|
2021-02-18 09:24:53 +00:00
|
|
|
using Dino.Plugins.WindowsNotification.Vapi;
|
2020-10-24 22:05:35 +00:00
|
|
|
|
|
|
|
namespace Dino.Plugins.WindowsNotification {
|
|
|
|
public class Plugin : RootInterface, Object {
|
|
|
|
|
2021-02-18 09:24:53 +00:00
|
|
|
private static string AUMID = "org.dino.Dino";
|
|
|
|
|
|
|
|
public int m { get; set; }
|
|
|
|
|
2020-10-24 22:05:35 +00:00
|
|
|
public void registered(Dino.Application app) {
|
2021-02-21 20:03:24 +00:00
|
|
|
if (!winrt.InitApartment())
|
2021-03-26 11:22:55 +00:00
|
|
|
{
|
2021-02-18 09:24:53 +00:00
|
|
|
// log error, return
|
2020-10-24 22:30:57 +00:00
|
|
|
}
|
2021-03-26 11:22:55 +00:00
|
|
|
|
2021-02-18 09:24:53 +00:00
|
|
|
if (!Win32Api.SetAppModelID(AUMID))
|
|
|
|
{
|
|
|
|
// log error, return
|
|
|
|
}
|
2021-03-26 11:22:55 +00:00
|
|
|
|
2021-02-18 09:24:53 +00:00
|
|
|
if (!ShortcutCreator.TryCreateShortcut(AUMID))
|
2021-03-26 11:22:55 +00:00
|
|
|
{
|
2021-02-18 09:24:53 +00:00
|
|
|
// log error, return
|
2021-03-26 11:22:55 +00:00
|
|
|
}
|
|
|
|
|
2021-02-18 09:24:53 +00:00
|
|
|
{
|
2021-02-22 10:41:39 +00:00
|
|
|
var notifier = new winrt.Windows.UI.Notifications.ToastNotifier(AUMID);
|
2021-02-21 20:03:24 +00:00
|
|
|
var m = new winrt.Windows.UI.Notifications.ToastNotification("Test");
|
2021-02-22 09:18:53 +00:00
|
|
|
var token = m.Activated((c, d) => {
|
2021-02-21 20:03:24 +00:00
|
|
|
var i = 2;
|
|
|
|
});
|
2021-02-23 10:08:56 +00:00
|
|
|
m.RemoveActivated(token);
|
2021-02-18 09:24:53 +00:00
|
|
|
|
2021-02-21 20:03:24 +00:00
|
|
|
var h = m.ExpiresOnReboot;
|
|
|
|
m.ExpiresOnReboot = false;
|
2021-02-18 09:24:53 +00:00
|
|
|
|
2021-02-21 20:03:24 +00:00
|
|
|
var a = m.Tag;
|
|
|
|
m.Tag = "a";
|
|
|
|
|
|
|
|
a = m.Group;
|
|
|
|
m.Group = "a";
|
2021-02-22 10:41:39 +00:00
|
|
|
|
|
|
|
notifier.Show(m);
|
2021-02-21 20:03:24 +00:00
|
|
|
}
|
2021-02-18 09:24:53 +00:00
|
|
|
|
|
|
|
// var provider = new WindowsNotificationProvider(app, Win32Api.SupportsModernNotifications());
|
|
|
|
// app.stream_interactor.get_module(NotificationEvents.IDENTITY).register_notification_provider(provider);
|
2020-10-24 22:05:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void shutdown() {
|
2020-10-25 11:07:31 +00:00
|
|
|
}
|
2020-10-24 22:05:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|