Development of background project 1
This commit is contained in:
@@ -89,26 +89,41 @@ namespace FoxTube.Background
|
|||||||
ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
|
ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
|
||||||
ApplicationName = "FoxTube"
|
ApplicationName = "FoxTube"
|
||||||
}).Activities.List("snippet");
|
}).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();
|
XmlDocument doc = new XmlDocument();
|
||||||
doc.Load(XmlReader.Create("http://foxgame.hol.es/ftp.xml"));
|
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)
|
if ((XmlConvert.ToDateTime((doc["posts"].FirstChild as XmlElement).GetAttribute("time"), XmlDateTimeSerializationMode.Utc) - lastCheck.ToUniversalTime()).TotalSeconds > 0)
|
||||||
Notifications.Add(new Notification(NotificationType.Internal,
|
Add(new Notification(NotificationType.Internal,
|
||||||
doc["posts"].FirstChild["notificationHeader"].InnerText,
|
doc["posts"].FirstChild["notificationHeader"].InnerText,
|
||||||
doc["posts"].FirstChild["content"].InnerText,
|
doc["posts"].FirstChild["content"].InnerText,
|
||||||
XmlConvert.ToDateTime((doc["posts"].FirstChild as XmlElement).GetAttribute("time"),
|
XmlConvert.ToDateTime((doc["posts"].FirstChild as XmlElement).GetAttribute("time"),
|
||||||
XmlDateTimeSerializationMode.Local), (doc["posts"].FirstChild as XmlElement).GetAttribute("image")));
|
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)
|
void SendNotification(Notification notification)
|
||||||
{
|
{
|
||||||
ToastNotificationManager.CreateToastNotifier().Show(notification.GetToast(0));
|
ToastNotificationManager.CreateToastNotifier().Show(notification.GetToast(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Add(Notification notification)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,12 +21,11 @@
|
|||||||
<ComboBoxItem Content="240p"/>
|
<ComboBoxItem Content="240p"/>
|
||||||
<ComboBoxItem Content="144p"/>
|
<ComboBoxItem Content="144p"/>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<TextBlock Text="Notifications"/>
|
<ToggleSwitch OnContent="Notifications" OffContent="Notifications" Name="notifications" Toggled="notification_IsEnabledChanged"/>
|
||||||
<CheckBox Content="New video" Name="newVideo" Click="notification_IsEnabledChanged"/>
|
<StackPanel Margin="25,0,0,0">
|
||||||
<CheckBox Content="New post" Name="newPost" Click="notification_IsEnabledChanged"/>
|
<CheckBox IsEnabled="False" Content="Subscriptions' uploads" Name="newVideo" Click="notification_IsEnabledChanged"/>
|
||||||
<CheckBox Content="New commentary" Name="newComment" Click="notification_IsEnabledChanged"/>
|
<CheckBox IsEnabled="False" Content="Developer's messages" Name="messages" Margin="0,0,0,10" Click="notification_IsEnabledChanged"/>
|
||||||
<CheckBox Content="What's new posts" Visibility="Collapsed" Click="notification_IsEnabledChanged"/>
|
</StackPanel>
|
||||||
<CheckBox Content="Developer's messages" Name="messages" Margin="0,0,0,10" Click="notification_IsEnabledChanged"/>
|
|
||||||
<ToggleSwitch OnContent="Notify when playing on mobile data" OffContent="Notify when playing on mobile data" Name="mobileWarning" Toggled="notification_IsEnabledChanged"/>
|
<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"/>
|
<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">
|
<ComboBox Header="Language" MinWidth="250" Name="language" SelectionChanged="language_SelectionChanged">
|
||||||
|
|||||||
@@ -30,9 +30,8 @@ namespace FoxTube
|
|||||||
language.SelectedIndex = (int)settings.Values["language"];
|
language.SelectedIndex = (int)settings.Values["language"];
|
||||||
quality.SelectedIndex = (int)settings.Values["quality"];
|
quality.SelectedIndex = (int)settings.Values["quality"];
|
||||||
|
|
||||||
|
notifications.IsOn = (bool)settings.Values["notifications"];
|
||||||
newVideo.IsChecked = (bool)settings.Values["newVideoNotification"];
|
newVideo.IsChecked = (bool)settings.Values["newVideoNotification"];
|
||||||
newComment.IsChecked = (bool)settings.Values["newCommentNotification"];
|
|
||||||
newPost.IsChecked = (bool)settings.Values["newPostNotification"];
|
|
||||||
messages.IsChecked = (bool)settings.Values["newmessagesNotification"];
|
messages.IsChecked = (bool)settings.Values["newmessagesNotification"];
|
||||||
|
|
||||||
mobileWarning.IsOn = (bool)settings.Values["moblieWarning"];
|
mobileWarning.IsOn = (bool)settings.Values["moblieWarning"];
|
||||||
@@ -56,15 +55,17 @@ namespace FoxTube
|
|||||||
|
|
||||||
private void notification_IsEnabledChanged(object sender, RoutedEventArgs e)
|
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)
|
if ((bool)settings.Values["newVideoNotification"] != newVideo.IsChecked)
|
||||||
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)
|
if ((bool)settings.Values["newmessagesNotification"] != messages.IsChecked)
|
||||||
settings.Values["newmessagesNotification"] = messages.IsChecked;
|
settings.Values["newmessagesNotification"] = messages.IsChecked;
|
||||||
|
|
||||||
|
|||||||
@@ -73,10 +73,8 @@ namespace FoxTube
|
|||||||
|
|
||||||
if (settings.Values["newVideoNotification"] == null)
|
if (settings.Values["newVideoNotification"] == null)
|
||||||
settings.Values.Add("newVideoNotification", true);
|
settings.Values.Add("newVideoNotification", true);
|
||||||
if (settings.Values["newCommentNotification"] == null)
|
if (settings.Values["notifications"] == null)
|
||||||
settings.Values.Add("newCommentNotification", true);
|
settings.Values.Add("notifications", true);
|
||||||
if (settings.Values["newPostNotification"] == null)
|
|
||||||
settings.Values.Add("newPostNotification", true);
|
|
||||||
if (settings.Values["newmessagesNotification"] == null)
|
if (settings.Values["newmessagesNotification"] == null)
|
||||||
settings.Values.Add("newmessagesNotification", true);
|
settings.Values.Add("newmessagesNotification", true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user