diff --git a/FoxTube/About.xaml b/FoxTube/About.xaml
deleted file mode 100644
index 027b245..0000000
--- a/FoxTube/About.xaml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/FoxTube/About.xaml.cs b/FoxTube/About.xaml.cs
deleted file mode 100644
index 7916765..0000000
--- a/FoxTube/About.xaml.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.ApplicationModel;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Controls.Primitives;
-using Windows.UI.Xaml.Data;
-using Windows.UI.Xaml.Input;
-using Windows.UI.Xaml.Media;
-using Windows.UI.Xaml.Navigation;
-
-// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
-
-namespace FoxTube
-{
- ///
- /// An empty page that can be used on its own or navigated to within a Frame.
- ///
- public sealed partial class About : Page
- {
- PackageVersion ver = Package.Current.Id.Version;
- public About()
- {
- this.InitializeComponent();
- version.Text = string.Format("{0}.{1}.{2}" , ver.Major, ver.Minor, ver.Build);
- }
- }
-}
diff --git a/FoxTube/Channel.xaml b/FoxTube/Channel.xaml
index 8f2aab1..e70757d 100644
--- a/FoxTube/Channel.xaml
+++ b/FoxTube/Channel.xaml
@@ -31,17 +31,12 @@
FontFamily="Segoe MDL2 Assets" Content="" FontSize="20" FocusVisualSecondaryBrush="#66FFFFFF" FocusVisualPrimaryBrush="White" Foreground="White"/>
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
@@ -58,10 +53,7 @@
-
-
-
-
+
@@ -141,8 +133,9 @@
-
-
+
+
+
diff --git a/FoxTube/Channel.xaml.cs b/FoxTube/Channel.xaml.cs
index 4f170f1..09f6785 100644
--- a/FoxTube/Channel.xaml.cs
+++ b/FoxTube/Channel.xaml.cs
@@ -17,6 +17,7 @@ using Google.Apis.Services;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;
using Windows.UI.Xaml.Media.Imaging;
+using Windows.UI.Text;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
@@ -29,6 +30,7 @@ namespace FoxTube
{
public string channelId;
public Google.Apis.YouTube.v3.Data.Channel item;
+ VideoGrid videoGrid = new VideoGrid();
public Channel()
{
this.InitializeComponent();
@@ -43,11 +45,7 @@ namespace FoxTube
{
channelId = id;
- YouTubeService ytService = new YouTubeService(new BaseClientService.Initializer()
- {
- ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
- ApplicationName = this.GetType().ToString()
- });
+ YouTubeService ytService = SecretsVault.YoutubeService;
ChannelsResource.ListRequest request = ytService.Channels.List("snippet,contentDetails,statistics,brandingSettings");
request.Id = id;
@@ -67,6 +65,22 @@ namespace FoxTube
registration.Text = item.Snippet.PublishedAt.ToString();
searchChannel.Text = item.Snippet.Title;
+
+ SearchResource.ListRequest request2 = ytService.Search.List("snippet");
+ request2.ChannelId = id;
+ request2.Type = "video";
+ request2.Order = SearchResource.ListRequest.OrderEnum.Date;
+ request2.MaxResults = 48;
+
+ SearchListResponse response2 = await request2.ExecuteAsync();
+
+ videos.Children.Add(videoGrid);
+
+ foreach(Google.Apis.YouTube.v3.Data.SearchResult vid in response2.Items)
+ {
+ VideoCard vCard = new VideoCard(vid.Id.VideoId);
+ videoGrid.AddCards(vCard);
+ }
}
private void toVideos_Click(object sender, RoutedEventArgs e)
@@ -74,43 +88,16 @@ namespace FoxTube
content.SelectedIndex = 0;
}
- private async void toPlaylists_Click(object sender, RoutedEventArgs e)
+ private void toPlaylists_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 1;
-
- if(playlists.Children.Count == 0)
- {
- YouTubeService ytService = new YouTubeService(new BaseClientService.Initializer()
- {
- ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
- ApplicationName = this.GetType().ToString()
- });
-
- PlaylistsResource.ListRequest request = ytService.Playlists.List("snippet,contentDetails");
- request.MaxResults = 25;
- request.ChannelId = channelId;
- PlaylistListResponse response = await request.ExecuteAsync();
-
- foreach (Playlist playlist in response.Items)
- {
- PlaylistCardWide playlistCard = new PlaylistCardWide(playlist.Id, true);
- playlists.Children.Add(playlistCard);
- }
-
- playlistRing.IsActive = false;
- playlistPane.Visibility = Visibility.Visible;
- }
}
private async void searchButton_Click(object sender, RoutedEventArgs e)
{
content.SelectedIndex = 3;
- YouTubeService ytService = new YouTubeService(new BaseClientService.Initializer()
- {
- ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
- ApplicationName = this.GetType().ToString()
- });
+ YouTubeService ytService = SecretsVault.YoutubeService;
var searchListRequest = ytService.Search.List("snippet");
searchListRequest.Q = searchField.Text;
@@ -147,5 +134,39 @@ namespace FoxTube
break;
}
}
+
+ private async void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ toVideos.FontWeight = FontWeights.Normal;
+ toPlaylists.FontWeight = FontWeights.Normal;
+ toAbout.FontWeight = FontWeights.Normal;
+ if (content.SelectedIndex == 0)
+ toVideos.FontWeight = FontWeights.Bold;
+ else if (content.SelectedIndex == 1)
+ {
+ toPlaylists.FontWeight = FontWeights.Bold;
+
+ if (playlists.Children.Count == 0)
+ {
+ YouTubeService ytService = SecretsVault.YoutubeService;
+
+ PlaylistsResource.ListRequest request = ytService.Playlists.List("snippet,contentDetails");
+ request.MaxResults = 25;
+ request.ChannelId = channelId;
+ PlaylistListResponse response = await request.ExecuteAsync();
+
+ foreach (Playlist playlist in response.Items)
+ {
+ PlaylistCardWide playlistCard = new PlaylistCardWide(playlist.Id, true);
+ playlists.Children.Add(playlistCard);
+ }
+
+ playlistRing.IsActive = false;
+ playlistPane.Visibility = Visibility.Visible;
+ }
+ }
+ else if (content.SelectedIndex == 2)
+ toAbout.FontWeight = FontWeights.Bold;
+ }
}
}
diff --git a/FoxTube/Feedback.xaml b/FoxTube/Feedback.xaml
index 2f115e4..d67317f 100644
--- a/FoxTube/Feedback.xaml
+++ b/FoxTube/Feedback.xaml
@@ -28,11 +28,20 @@
+
+
+
+
+
+
+
+
+
-
+
@@ -43,7 +52,7 @@
-
+
diff --git a/FoxTube/Feedback.xaml.cs b/FoxTube/Feedback.xaml.cs
index 72ae9a6..6f7952b 100644
--- a/FoxTube/Feedback.xaml.cs
+++ b/FoxTube/Feedback.xaml.cs
@@ -29,6 +29,7 @@ namespace FoxTube
///
public sealed partial class Feedback : Page
{
+ string debugData = "";
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public Feedback()
{
@@ -83,7 +84,7 @@ namespace FoxTube
msg.To.Add("foxgameofficial+foxtube@gmail.com");
msg.From = new MailAddress("foxgameofficial+foxtube@gmail.com");
msg.Subject = "FoxTube feedback";
- msg.Body = string.Format("Type: {0}\nTime: {1}\n\nTitle:\n{2}\n\nDetails:\n{3}", Type(), DateTime.Now, subject.Text, details.Text);
+ msg.Body = string.Format("Type: {0}\nTime: {1}\n\nTitle:\n{2}\n\nDetails:\n{3}\n\nResponse e-mail: {4}\n\nException details:\n{5}", Type(), DateTime.Now, subject.Text, details.Text, email.Text, debugData);
subject.IsEnabled = false;
details.IsEnabled = false;
@@ -127,6 +128,27 @@ namespace FoxTube
subject.Background = new SolidColorBrush();
}
+ private void emailToggle_Click(object sender, RoutedEventArgs e)
+ {
+ email.IsEnabled = (bool)emailToggle.IsChecked;
+ }
+
+ public void PreDefine(bool isProblem, string meta)
+ {
+ if (isProblem)
+ {
+ promblemRadio.IsChecked = true;
+ suggestionRadio.IsChecked = false;
+ }
+ else
+ {
+ promblemRadio.IsChecked = false;
+ suggestionRadio.IsChecked = true;
+ }
+ debugData = meta;
+ debugAttached.Visibility = Visibility.Visible;
+ }
+
/*
private void feedbackSubmit_Click(object sender, EventArgs e)
diff --git a/FoxTube/FoxTube.csproj b/FoxTube/FoxTube.csproj
index fa88bd9..d4d595a 100644
--- a/FoxTube/FoxTube.csproj
+++ b/FoxTube/FoxTube.csproj
@@ -11,13 +11,14 @@
FoxTube
en-US
UAP
- 10.0.16299.0
+ 10.0.17134.0
10.0.16299.0
14
512
{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
true
FoxTube_TemporaryKey.pfx
+ 965BA230AF9DB31698CAE7A94DE7CA256841AEE0
true
@@ -92,9 +93,6 @@
PackageReference
-
- About.xaml
-
App.xaml
@@ -113,6 +111,9 @@
Home.xaml
+
+ LoadingPage.xaml
+
MainPage.xaml
@@ -124,6 +125,7 @@
Search.xaml
+
Settings.xaml
@@ -213,10 +215,6 @@
MSBuild:Compile
Designer
-
- Designer
- MSBuild:Compile
-
Designer
MSBuild:Compile
@@ -237,6 +235,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
MSBuild:Compile
Designer
@@ -300,6 +302,9 @@
2.2.0
+
+ 4.3.1
+
diff --git a/FoxTube/Home.xaml b/FoxTube/Home.xaml
index 512678e..dc7ccca 100644
--- a/FoxTube/Home.xaml
+++ b/FoxTube/Home.xaml
@@ -9,7 +9,7 @@
-
+
@@ -19,6 +19,17 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FoxTube/LoadingPage.xaml b/FoxTube/LoadingPage.xaml
new file mode 100644
index 0000000..afbbcf0
--- /dev/null
+++ b/FoxTube/LoadingPage.xaml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FoxTube/LoadingPage.xaml.cs b/FoxTube/LoadingPage.xaml.cs
new file mode 100644
index 0000000..44018c3
--- /dev/null
+++ b/FoxTube/LoadingPage.xaml.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Data;
+using Windows.UI.Xaml.Input;
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Navigation;
+
+// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
+
+namespace FoxTube
+{
+ ///
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ ///
+ public sealed partial class LoadingPage : Page
+ {
+ public LoadingPage()
+ {
+ this.InitializeComponent();
+ }
+
+ public void Error(string exceptionId, string details, bool isWifiTrouble = false)
+ {
+ ring.IsActive = false;
+ trouble.Visibility = Visibility.Collapsed;
+ wifiTrouble.Visibility = Visibility.Collapsed;
+
+ if(isWifiTrouble)
+ {
+ wifiException.Text = exceptionId;
+ wifiMessage.Text = details;
+
+ wifiTrouble.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ exception.Text = exceptionId;
+ message.Text = details;
+
+ trouble.Visibility = Visibility.Visible;
+ }
+ }
+
+ private async void openWifi_Click(object sender, RoutedEventArgs e)
+ {
+ await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:network"));
+ }
+
+ private async void openTroubleshoot_Click(object sender, RoutedEventArgs e)
+ {
+ await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:troubleshoot"));
+ }
+
+ private void feedback_Click(object sender, RoutedEventArgs e)
+ {
+ Frame root = Window.Current.Content as Frame;
+ MainPage main = root.Content as MainPage;
+ main.PreDefineFeedback(true, string.Format("Exception:\n{0}\n\nMessage:\n{1}", exception, message));
+ }
+ }
+}
diff --git a/FoxTube/MainPage.xaml b/FoxTube/MainPage.xaml
index 89c6458..56eee16 100644
--- a/FoxTube/MainPage.xaml
+++ b/FoxTube/MainPage.xaml
@@ -23,6 +23,7 @@
+
-
+
+
@@ -56,10 +60,10 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- -->
-
+
diff --git a/FoxTube/Settings.xaml.cs b/FoxTube/Settings.xaml.cs
index d58f0b3..f92743b 100644
--- a/FoxTube/Settings.xaml.cs
+++ b/FoxTube/Settings.xaml.cs
@@ -3,8 +3,11 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
+using Windows.ApplicationModel;
using Windows.Foundation;
using Windows.Foundation.Collections;
+using Windows.Storage;
+using Windows.UI.Text;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
@@ -22,47 +25,108 @@ namespace FoxTube
///
public sealed partial class Settings : Page
{
- public Frame content;
+ ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
+ PackageVersion ver = Package.Current.Id.Version;
+ public Pivot pivot;
+ public Feedback fb;
public Settings()
{
this.InitializeComponent();
- settingsContent.Navigate(typeof(General));
- content = settingsContent;
+ version.Text = string.Format("{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build);
+ pivot = content;
+ fb = feedbackHub.Content as Feedback;
+
+ language.SelectedIndex = (int)settings.Values["language"];
+ quality.SelectedIndex = (int)settings.Values["quality"];
+
+ 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"];
+ autoplay.IsOn = (bool)settings.Values["videoAutoplay"];
}
- private void General_Click(object sender, RoutedEventArgs e)
+ private void language_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- settingsContent.Navigate(typeof(General));
+ if ((int)settings.Values["language"] != language.SelectedIndex)
+ {
+ settings.Values["language"] = language.SelectedIndex;
+ restartNote.Visibility = Visibility.Visible;
+ }
}
- private void Personalization_Click(object sender, RoutedEventArgs e)
+ private void quality_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
-
+ if ((int)settings.Values["quality"] != quality.SelectedIndex)
+ settings.Values["quality"] = quality.SelectedIndex;
}
- private void Account_Click(object sender, RoutedEventArgs e)
+ private void notification_IsEnabledChanged(object sender, RoutedEventArgs e)
{
+ 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;
+
+ if ((bool)settings.Values["moblieWarning"] != mobileWarning.IsOn)
+ settings.Values["moblieWarning"] = mobileWarning.IsOn;
+
+ if ((bool)settings.Values["videoAutoplay"] != autoplay.IsOn)
+ settings.Values["videoAutoplay"] = autoplay.IsOn;
}
- private void About_Click(object sender, RoutedEventArgs e)
+ private void toGeneral_Click(object sender, RoutedEventArgs e)
{
- settingsContent.Navigate(typeof(About));
+ content.SelectedIndex = 0;
}
- private void Beta_Click(object sender, RoutedEventArgs e)
+ private void toFeedback_Click(object sender, RoutedEventArgs e)
{
-
+ content.SelectedIndex = 2;
}
- private void Translate_Click(object sender, RoutedEventArgs e)
+ private void toTranslate_Click(object sender, RoutedEventArgs e)
{
- settingsContent.Navigate(typeof(Translate));
+ content.SelectedIndex = 4;
}
- private void Feedback_Click(object sender, RoutedEventArgs e)
+ private void content_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- settingsContent.Navigate(typeof(Feedback));
+ toGeneral.FontWeight = FontWeights.Normal;
+ toAccount.FontWeight = FontWeights.Normal;
+ toFeedback.FontWeight = FontWeights.Normal;
+ toAbout.FontWeight = FontWeights.Normal;
+ toTranslate.FontWeight = FontWeights.Normal;
+
+ if (content.SelectedIndex == 0)
+ toGeneral.FontWeight = FontWeights.Bold;
+ else if (content.SelectedIndex == 1)
+ toAccount.FontWeight = FontWeights.Bold;
+ else if (content.SelectedIndex == 2)
+ toFeedback.FontWeight = FontWeights.Bold;
+ else if (content.SelectedIndex == 3)
+ toAbout.FontWeight = FontWeights.Bold;
+ else if (content.SelectedIndex == 4)
+ toTranslate.FontWeight = FontWeights.Bold;
+ }
+
+ private void toAccount_Click(object sender, RoutedEventArgs e)
+ {
+ content.SelectedIndex = 1;
+ }
+
+ private void toAbout_Click(object sender, RoutedEventArgs e)
+ {
+ content.SelectedIndex = 3;
}
}
}
diff --git a/FoxTube/Translate.xaml b/FoxTube/Translate.xaml
index 2b63168..4f9c1e3 100644
--- a/FoxTube/Translate.xaml
+++ b/FoxTube/Translate.xaml
@@ -10,20 +10,45 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
diff --git a/FoxTube/Translate.xaml.cs b/FoxTube/Translate.xaml.cs
index 4de25bc..174a29e 100644
--- a/FoxTube/Translate.xaml.cs
+++ b/FoxTube/Translate.xaml.cs
@@ -13,6 +13,11 @@ using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
+using Windows.Storage.Pickers;
+using Windows.Storage;
+using System.Net.Mail;
+using System.Net;
+using Windows.UI.Popups;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
@@ -23,13 +28,98 @@ namespace FoxTube
///
public sealed partial class Translate : Page
{
-
+ ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
+ int selectedLanguage;
public Translate()
{
this.InitializeComponent();
foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
- LangList.Items.Add(culture);
- LangList.SelectedIndex = 0;
+ LangList.Items.Add(culture.DisplayName);
+ }
+
+ private async void export_Click(object sender, RoutedEventArgs e)
+ {
+ FileSavePicker picker = new FileSavePicker();
+ picker.CommitButtonText = "Export";
+ picker.DefaultFileExtension = ".xml";
+ picker.SuggestedFileName = "foxtube_langpack_" + CultureInfo.GetCultures(CultureTypes.AllCultures)[selectedLanguage];
+ picker.SuggestedStartLocation = PickerLocationId.Desktop;
+ picker.FileTypeChoices.Add("Language pack scheme", new List() { ".xml" });
+
+ StorageFile file = await picker.PickSaveFileAsync();
+ if(file != null)
+ await FileIO.WriteTextAsync(file, GetPackage(selectedLanguage));
+ }
+
+ private void LangList_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ selectedLanguage = LangList.SelectedIndex;
+
+ greenResult.Visibility = Visibility.Collapsed;
+ denied.Visibility = Visibility.Collapsed;
+
+ if (settings.Values[CultureInfo.GetCultures(CultureTypes.AllCultures)[selectedLanguage] + "_sent"] == null)
+ {
+ export.IsEnabled = true;
+ upload.IsEnabled = true;
+ submitNotification.Visibility = Visibility.Visible;
+ }
+ else
+ {
+ export.IsEnabled = false;
+ upload.IsEnabled = false;
+ denied.Visibility = Visibility.Visible;
+ }
+ }
+
+ private async void upload_Click(object sender, RoutedEventArgs e)
+ {
+ FileOpenPicker picker = new FileOpenPicker()
+ {
+ CommitButtonText = "Upload",
+ SuggestedStartLocation = PickerLocationId.Desktop
+ };
+ picker.FileTypeFilter.Clear();
+ picker.FileTypeFilter.Add(".xml");
+
+ StorageFile file = await picker.PickSingleFileAsync();
+ if (file != null)
+ {
+ MailMessage msg = new MailMessage();
+ msg.To.Add("foxgameofficial+foxtube@gmail.com");
+ msg.From = new MailAddress("foxgameofficial+foxtube@gmail.com");
+ msg.Subject = "FoxTube language pack contribution";
+ msg.Body = string.Format("Language: {0}\nLanguage code: {1}", CultureInfo.GetCultures(CultureTypes.AllCultures)[selectedLanguage].EnglishName, CultureInfo.GetCultures(CultureTypes.AllCultures)[selectedLanguage]);
+ msg.Attachments.Add(new Attachment(file.Path));
+
+ SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
+ client.EnableSsl = true;
+ client.Credentials = new NetworkCredential(SecretsVault.Email, SecretsVault.Password);
+
+ upload.IsEnabled = false;
+ export.IsEnabled = false;
+ uploadingProgress.Visibility = Visibility.Visible;
+ try
+ {
+ client.Send(msg);
+ greenResult.Visibility = Visibility.Visible;
+ submitNotification.Visibility = Visibility.Collapsed;
+ settings.Values.Add(CultureInfo.GetCultures(CultureTypes.AllCultures)[selectedLanguage] + "_sent", true);
+ }
+ catch
+ {
+ MessageDialog message = new MessageDialog("We was unable to send your feedback due to connection problems or internal server error. Please, try again later.", "Failed to send your feedback");
+ await message.ShowAsync();
+ export.IsEnabled = true;
+ upload.IsEnabled = true;
+ }
+ uploadingProgress.Visibility = Visibility.Collapsed;
+ }
+ }
+
+ public string GetPackage(int cultureIndex)
+ {
+ return "langpack";
}
}
}
diff --git a/FoxTube/VideoCard.xaml b/FoxTube/VideoCard.xaml
index 8fa9b8e..8a52291 100644
--- a/FoxTube/VideoCard.xaml
+++ b/FoxTube/VideoCard.xaml
@@ -19,11 +19,11 @@
-
+
-
+
-
+
@@ -46,13 +46,13 @@
-
+
-
-
+
+
-
+
diff --git a/FoxTube/VideoCard.xaml.cs b/FoxTube/VideoCard.xaml.cs
index b95d87a..99d63f4 100644
--- a/FoxTube/VideoCard.xaml.cs
+++ b/FoxTube/VideoCard.xaml.cs
@@ -14,20 +14,60 @@ using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
+using Google.Apis.Services;
+using Google.Apis.YouTube.v3;
+using Google.Apis.YouTube.v3.Data;
+using Windows.UI.Xaml.Media.Imaging;
+using System.Xml;
+
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
namespace FoxTube
{
public sealed partial class VideoCard : UserControl
{
- public VideoCard()
+ public string channeId;
+ public VideoCard(string id)
{
this.InitializeComponent();
+ Initialize(id);
}
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
{
Height = e.NewSize.Width * 0.75;
}
+
+ public async void Initialize(string id)
+ {
+ YouTubeService ytService = SecretsVault.YoutubeService;
+
+ VideosResource.ListRequest request = ytService.Videos.List("snippet,contentDetails,statistics");
+ request.Id = id;
+ VideoListResponse response = await request.ExecuteAsync();
+
+ var item = response.Items[0];
+
+ channeId = id;
+
+ title.Text = item.Snippet.Title;
+ views.Text = string.Format("{0} views", item.Statistics.ViewCount);
+
+ TimeSpan duration = XmlConvert.ToTimeSpan(item.ContentDetails.Duration);
+
+ info.Text = string.Format("{0}:{1}:{2} | {3}", duration.Hours, duration.Minutes, duration.Seconds, item.Snippet.PublishedAt);
+ thumbnail.Source = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url));
+ if (item.Snippet.LiveBroadcastContent == "live")
+ liveTag.Visibility = Visibility.Visible;
+
+ var request1 = ytService.Channels.List("snippet,contentDetails,statistics");
+ request1.Id = item.Snippet.ChannelId;
+ ChannelListResponse response1 = await request1.ExecuteAsync();
+
+ var item1 = response1.Items[0];
+
+ avatar.ProfilePicture = new BitmapImage(new Uri(item1.Snippet.Thumbnails.Medium.Url));
+ channelName.Text = item1.Snippet.Title;
+ }
}
}
diff --git a/FoxTube/VideoCardWide.xaml.cs b/FoxTube/VideoCardWide.xaml.cs
index db9f516..1437220 100644
--- a/FoxTube/VideoCardWide.xaml.cs
+++ b/FoxTube/VideoCardWide.xaml.cs
@@ -20,6 +20,7 @@ using Google.Apis.YouTube.v3.Data;
using System.Threading.Tasks;
using System.Threading;
using Google.Apis.Util.Store;
+using System.Xml;
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
@@ -36,11 +37,7 @@ namespace FoxTube
public async void Initialize(string id)
{
- YouTubeService ytService = new YouTubeService(new BaseClientService.Initializer()
- {
- ApiKey = "AIzaSyBgHrCnrlzlVmk0cJKL8RqP9Y8x6XSuk_0",
- ApplicationName = this.GetType().ToString()
- });
+ YouTubeService ytService = SecretsVault.YoutubeService;
VideosResource.ListRequest request = ytService.Videos.List("snippet,contentDetails,statistics");
request.Id = id;
@@ -51,7 +48,10 @@ namespace FoxTube
channeId = id;
title.Text = item.Snippet.Title;
- info.Text = string.Format("{0} | {1} | {2} views", item.ContentDetails.Duration, item.Snippet.PublishedAt, item.Statistics.ViewCount);
+
+ TimeSpan duration = XmlConvert.ToTimeSpan(item.ContentDetails.Duration);
+
+ info.Text = string.Format("{0}:{1}:{2} | {3} | {4} views", duration.Hours, duration.Minutes, duration.Seconds, item.ContentDetails.Duration, item.Snippet.PublishedAt, item.Statistics.ViewCount);
thumbnail.Source = new BitmapImage(new Uri(item.Snippet.Thumbnails.Medium.Url));
if (item.Snippet.LiveBroadcastContent == "live")
liveTag.Visibility = Visibility.Visible;
@@ -65,7 +65,6 @@ namespace FoxTube
avatar.ProfilePicture = new BitmapImage(new Uri(item1.Snippet.Thumbnails.Medium.Url));
channelName.Text = item1.Snippet.Title;
channelSubs.Text = string.Format("{0} subscribers", item1.Statistics.SubscriberCount);
- channelLink.NavigateUri = new Uri("https://www.youtube.com/channel/" + item.Snippet.ChannelId);
}
private void channelLink_Click(object sender, RoutedEventArgs e)
diff --git a/FoxTube/VideoGrid.xaml b/FoxTube/VideoGrid.xaml
index 95b3402..c13b1c6 100644
--- a/FoxTube/VideoGrid.xaml
+++ b/FoxTube/VideoGrid.xaml
@@ -14,42 +14,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/FoxTube/VideoGrid.xaml.cs b/FoxTube/VideoGrid.xaml.cs
index 6676467..d8e512e 100644
--- a/FoxTube/VideoGrid.xaml.cs
+++ b/FoxTube/VideoGrid.xaml.cs
@@ -31,8 +31,11 @@ namespace FoxTube
public VideoGrid()
{
this.InitializeComponent();
- for (int k = 0; k < 25; k++)
- cards.Add(new VideoCard());
+ }
+
+ public void AddCards(VideoCard vCard)
+ {
+ cards.Add(vCard);
}
void SetColumns(int num)
@@ -47,7 +50,6 @@ namespace FoxTube
col1.Children.Clear();
col2.Children.Clear();
col3.Children.Clear();
- col4.Children.Clear();
for (int k = 0; k < cards.Count; k += num)
col0.Children.Add(cards[k]);
@@ -63,69 +65,14 @@ namespace FoxTube
{
for (int k = 3; k < cards.Count; k += num)
col3.Children.Add(cards[k]);
- if(num == 5)
- {
- for (int k = 4; k < cards.Count; k += num)
- col4.Children.Add(cards[k]);
- }
}
}
}
-
- /*switch(num)
- {
- case 1:
- foreach (VideoCard card in cards)
- col0.Children.Add(card);
- break;
-
- case 2:
- for (int k = 0; k < cards.Count; k += 2)
- col0.Children.Add(cards[k]);
- for (int k = 1; k < cards.Count; k += 2)
- col1.Children.Add(cards[k]);
- break;
-
- case 3:
- for (int k = 0; k < cards.Count; k += 3)
- col0.Children.Add(cards[k]);
- for (int k = 1; k < cards.Count; k += 3)
- col1.Children.Add(cards[k]);
- for (int k = 2; k < cards.Count; k += 3)
- col2.Children.Add(cards[k]);
- break;
-
- case 4:
- for (int k = 0; k < cards.Count; k += 4)
- col0.Children.Add(cards[k]);
- for (int k = 1; k < cards.Count; k += 4)
- col1.Children.Add(cards[k]);
- for (int k = 2; k < cards.Count; k += 4)
- col2.Children.Add(cards[k]);
- for (int k = 3; k < cards.Count; k += 4)
- col3.Children.Add(cards[k]);
- break;
-
- case 5:
- for (int k = 0; k < cards.Count; k += 5)
- col0.Children.Add(cards[k]);
- for (int k = 1; k < cards.Count; k += 5)
- col1.Children.Add(cards[k]);
- for (int k = 2; k < cards.Count; k += 5)
- col2.Children.Add(cards[k]);
- for (int k = 3; k < cards.Count; k += 5)
- col3.Children.Add(cards[k]);
- for (int k = 4; k < cards.Count; k += 5)
- col4.Children.Add(cards[k]);
- break;
- }*/
}
private void grid_SizeChanged(object sender, SizeChangedEventArgs e)
{
- if (e.NewSize.Width >= 1500 && cols != 5)
- SetColumns(5);
- else if (e.NewSize.Width >= 1000 && e.NewSize.Width < 1500 && cols != 4)
+ if (e.NewSize.Width >= 1000 && cols != 4)
SetColumns(4);
else if (e.NewSize.Width >= 800 && e.NewSize.Width < 1000 && cols != 3)
SetColumns(3);
diff --git a/FoxTube/VideoPlayer.xaml b/FoxTube/VideoPlayer.xaml
index e139fa7..c6da2c3 100644
--- a/FoxTube/VideoPlayer.xaml
+++ b/FoxTube/VideoPlayer.xaml
@@ -120,7 +120,17 @@
-
+
+
+
+
+
+
+
+
+
+
+