From 0dd6513257b60a744c042c93dae13b663e436d06 Mon Sep 17 00:00:00 2001 From: Michael Gordeev Date: Fri, 14 Dec 2018 22:44:02 +0300 Subject: [PATCH] #221: Fixed --- FoxTube/Controls/DownloadItem.xaml.cs | 3 ++- FoxTube/Pages/MainPage.xaml.cs | 8 ++++--- FoxTube/Pages/SettingsPages/Inbox.xaml.cs | 26 +++++++---------------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/FoxTube/Controls/DownloadItem.xaml.cs b/FoxTube/Controls/DownloadItem.xaml.cs index dde2a8f..1fb5fa5 100644 --- a/FoxTube/Controls/DownloadItem.xaml.cs +++ b/FoxTube/Controls/DownloadItem.xaml.cs @@ -16,6 +16,7 @@ using Windows.Storage.Pickers; using Windows.UI.Notifications; using Microsoft.Toolkit.Uwp.Notifications; using System.Diagnostics; +using System.Threading.Tasks; namespace FoxTube.Controls { @@ -70,7 +71,7 @@ namespace FoxTube.Controls donePanel.Visibility = Visibility.Visible; } - async void Download(MediaStreamInfo info, Video meta, string q) + async Task Download(MediaStreamInfo info, Video meta, string q) { InProgress = true; Container = new DownloadItemContainer(); diff --git a/FoxTube/Pages/MainPage.xaml.cs b/FoxTube/Pages/MainPage.xaml.cs index d7bc969..b6af323 100644 --- a/FoxTube/Pages/MainPage.xaml.cs +++ b/FoxTube/Pages/MainPage.xaml.cs @@ -416,14 +416,16 @@ namespace FoxTube } else { - nav.CompactModeThresholdWidth = 641; nav.ExpandedModeThresholdWidth = 1008; nav.Margin = new Thickness(0); - nav.OpenPaneLength = 300; - nav.CompactPaneLength = 40; if (videoPlaceholder.Content != null && nav.IsPaneOpen) nav.IsPaneOpen = false; + else + { + nav.OpenPaneLength = 300; + nav.CompactPaneLength = 40; + } SetTitleBar(); } } diff --git a/FoxTube/Pages/SettingsPages/Inbox.xaml.cs b/FoxTube/Pages/SettingsPages/Inbox.xaml.cs index 06dce6f..b4eb1a0 100644 --- a/FoxTube/Pages/SettingsPages/Inbox.xaml.cs +++ b/FoxTube/Pages/SettingsPages/Inbox.xaml.cs @@ -27,7 +27,6 @@ namespace FoxTube.Pages.SettingsPages /// public sealed partial class Inbox : Page { - List backup = new List(); List items = new List(); public Inbox() { @@ -57,43 +56,34 @@ namespace FoxTube.Pages.SettingsPages )); items.OrderBy(item => item.TimeStamp); - - foreach (InboxItem i in items) - backup.Add(i); } catch { } - list.ItemsSource = items; + items.ForEach(i => list.Items.Add(i)); } private void filter_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { - items.Clear(); - list.ItemsSource = null; + list.Items.Clear(); switch (filter.SelectedIndex) { case 0: - foreach (InboxItem i in backup) - items.Add(i); + items.ForEach(i => list.Items.Add(i)); break; case 1: - foreach (InboxItem i in backup) - if(i.Type == InboxItemType.Default) - items.Add(i); + List messages = items.FindAll(i => i.Type == InboxItemType.Default); + messages.ForEach(i => list.Items.Add(i)); break; case 2: - foreach (InboxItem i in backup) - if (i.Type == InboxItemType.PatchNote) - items.Add(i); + List notes = items.FindAll(i => i.Type == InboxItemType.PatchNote); + notes.ForEach(i => list.Items.Add(i)); break; } - - list.ItemsSource = items; } catch(NullReferenceException) { } } @@ -144,7 +134,7 @@ namespace FoxTube.Pages.SettingsPages string id = arg.Split('&')[1]; InboxItem item = items.Find(x => x.Id == id); if(item != null) - list.SelectedIndex = items.IndexOf(item); + list.SelectedItem = item; } } }