Archived
1
0

Development of background project 1

This commit is contained in:
Michael Gordeev
2018-07-15 11:04:57 +03:00
parent 9163fcf2ae
commit 9b13f8b95b
4 changed files with 36 additions and 23 deletions
+20 -5
View File
@@ -89,26 +89,41 @@ namespace FoxTube.Background
ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
ApplicationName = "FoxTube"
}).Activities.List("snippet");
request.PublishedAfter = lastCheck;
request.ChannelId = s;
request.MaxResults = 10;
var response = await request.ExecuteAsync();
if(response.Items.Count > 0)
foreach (Activity a in response.Items)
{
if(a.Snippet.Type == "upload")
}
}
}
void CheckAnnouncements()
string CheckAnnouncements()
{
XmlDocument doc = new XmlDocument();
doc.Load(XmlReader.Create("http://foxgame.hol.es/ftp.xml"));
if ((XmlConvert.ToDateTime((doc["posts"].FirstChild as XmlElement).GetAttribute("time"), XmlDateTimeSerializationMode.Utc) - lastCheck).TotalSeconds > 0)
Notifications.Add(new Notification(NotificationType.Internal,
if ((XmlConvert.ToDateTime((doc["posts"].FirstChild as XmlElement).GetAttribute("time"), XmlDateTimeSerializationMode.Utc) - lastCheck.ToUniversalTime()).TotalSeconds > 0)
Add(new Notification(NotificationType.Internal,
doc["posts"].FirstChild["notificationHeader"].InnerText,
doc["posts"].FirstChild["content"].InnerText,
XmlConvert.ToDateTime((doc["posts"].FirstChild as XmlElement).GetAttribute("time"),
XmlDateTimeSerializationMode.Local), (doc["posts"].FirstChild as XmlElement).GetAttribute("image")));
if ((bool)settings.Values["newmessagesNotification"] == true)
SendNotification(Notifications.Last());
return doc.InnerXml;
}
void SendNotification(Notification notification)
{
ToastNotificationManager.CreateToastNotifier().Show(notification.GetToast(0));
}
void Add(Notification notification)
{
}
}
}