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)
{
}
}
}
+5 -6
View File
@@ -21,12 +21,11 @@
<ComboBoxItem Content="240p"/>
<ComboBoxItem Content="144p"/>
</ComboBox>
<TextBlock Text="Notifications"/>
<CheckBox Content="New video" Name="newVideo" Click="notification_IsEnabledChanged"/>
<CheckBox Content="New post" Name="newPost" Click="notification_IsEnabledChanged"/>
<CheckBox Content="New commentary" Name="newComment" Click="notification_IsEnabledChanged"/>
<CheckBox Content="What's new posts" Visibility="Collapsed" Click="notification_IsEnabledChanged"/>
<CheckBox Content="Developer's messages" Name="messages" Margin="0,0,0,10" Click="notification_IsEnabledChanged"/>
<ToggleSwitch OnContent="Notifications" OffContent="Notifications" Name="notifications" Toggled="notification_IsEnabledChanged"/>
<StackPanel Margin="25,0,0,0">
<CheckBox IsEnabled="False" Content="Subscriptions' uploads" Name="newVideo" Click="notification_IsEnabledChanged"/>
<CheckBox IsEnabled="False" Content="Developer's messages" Name="messages" Margin="0,0,0,10" Click="notification_IsEnabledChanged"/>
</StackPanel>
<ToggleSwitch OnContent="Notify when playing on mobile data" OffContent="Notify when playing on mobile data" Name="mobileWarning" Toggled="notification_IsEnabledChanged"/>
<ToggleSwitch OnContent="Play videos automatically" OffContent="Play videos automatically" Name="autoplay" Margin="0,0,0,10" Toggled="notification_IsEnabledChanged"/>
<ComboBox Header="Language" MinWidth="250" Name="language" SelectionChanged="language_SelectionChanged">
+9 -8
View File
@@ -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;
+2 -4
View File
@@ -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);