diff --git a/FoxTube.Background/BackgroundProcessor.cs b/FoxTube.Background/BackgroundProcessor.cs index 8f44e93..2552676 100644 --- a/FoxTube.Background/BackgroundProcessor.cs +++ b/FoxTube.Background/BackgroundProcessor.cs @@ -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) + { + + } } } diff --git a/FoxTube/Pages/General.xaml b/FoxTube/Pages/General.xaml index dddae99..0c05b62 100644 --- a/FoxTube/Pages/General.xaml +++ b/FoxTube/Pages/General.xaml @@ -21,12 +21,11 @@ - - - - - - + + + + + diff --git a/FoxTube/Pages/General.xaml.cs b/FoxTube/Pages/General.xaml.cs index 096082f..7ec2d44 100644 --- a/FoxTube/Pages/General.xaml.cs +++ b/FoxTube/Pages/General.xaml.cs @@ -30,9 +30,8 @@ namespace FoxTube language.SelectedIndex = (int)settings.Values["language"]; quality.SelectedIndex = (int)settings.Values["quality"]; + notifications.IsOn = (bool)settings.Values["notifications"]; newVideo.IsChecked = (bool)settings.Values["newVideoNotification"]; - newComment.IsChecked = (bool)settings.Values["newCommentNotification"]; - newPost.IsChecked = (bool)settings.Values["newPostNotification"]; messages.IsChecked = (bool)settings.Values["newmessagesNotification"]; mobileWarning.IsOn = (bool)settings.Values["moblieWarning"]; @@ -56,15 +55,17 @@ namespace FoxTube private void notification_IsEnabledChanged(object sender, RoutedEventArgs e) { + if (notifications.IsOn) + { + settings.Values["notificaitons"] = true; + + newVideo.IsEnabled = false; + messages.IsEnabled = false; + } + if ((bool)settings.Values["newVideoNotification"] != newVideo.IsChecked) settings.Values["newVideoNotification"] = newVideo.IsChecked; - if ((bool)settings.Values["newPostNotification"] != newPost.IsChecked) - settings.Values["newPostNotification"] = newPost.IsChecked; - - if ((bool)settings.Values["newCommentNotification"] != newComment.IsChecked) - settings.Values["newCommentNotification"] = newComment.IsChecked; - if ((bool)settings.Values["newmessagesNotification"] != messages.IsChecked) settings.Values["newmessagesNotification"] = messages.IsChecked; diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs index f7e14da..9a62887 100644 --- a/FoxTube/Pages/MainPage.xaml.cs +++ b/FoxTube/Pages/MainPage.xaml.cs @@ -73,10 +73,8 @@ namespace FoxTube if (settings.Values["newVideoNotification"] == null) settings.Values.Add("newVideoNotification", true); - if (settings.Values["newCommentNotification"] == null) - settings.Values.Add("newCommentNotification", true); - if (settings.Values["newPostNotification"] == null) - settings.Values.Add("newPostNotification", true); + if (settings.Values["notifications"] == null) + settings.Values.Add("notifications", true); if (settings.Values["newmessagesNotification"] == null) settings.Values.Add("newmessagesNotification", true);