diff --git a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SearchResources.resw b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SearchResources.resw new file mode 100644 index 0000000..a9da29a --- /dev/null +++ b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SearchResources.resw @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Playlist is empty + + + Invalid url. Url cannot be empty. + + + Invalid url. Url does not match any of supported source. + + + Invalid url. Twitch channel not found. + + + Twitch authentication error. Not authenticated to Twitch. + + + Twitch authentication error. Authentication token is invalid. + + + Invalid url. Url does not match any of supported source's media types. + + \ No newline at end of file diff --git a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs index c6b8fcc..2a32d43 100644 --- a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs +++ b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs @@ -19,6 +19,13 @@ namespace VDownload.Core.ViewModels.Home { #region ENUMS + public enum OptionBarMessageIconType + { + None, + ProgressRing, + Error + } + public enum OptionBarContentType { None, @@ -75,7 +82,7 @@ namespace VDownload.Core.ViewModels.Home private string _optionBarMessage; [ObservableProperty] - private bool _optionBarLoading; + private OptionBarMessageIconType _optionBarMessageIcon; [ObservableProperty] private bool _optionBarVideoSearchButtonChecked; @@ -131,6 +138,7 @@ namespace VDownload.Core.ViewModels.Home MainContent = _downloadsView; OptionBarContent = OptionBarContentType.None; + OptionBarMessageIcon = OptionBarMessageIconType.None; OptionBarMessage = null; OptionBarVideoSearchButtonChecked = false; OptionBarPlaylistSearchButtonChecked = false; @@ -156,6 +164,9 @@ namespace VDownload.Core.ViewModels.Home [RelayCommand] public void VideoSearchShow() { + OptionBarSearchNotPending = true; + OptionBarMessageIcon = OptionBarMessageIconType.None; + OptionBarMessage = null; MainContent = _downloadsView; if (OptionBarContent != OptionBarContentType.VideoSearch) @@ -172,6 +183,9 @@ namespace VDownload.Core.ViewModels.Home [RelayCommand] public void PlaylistSearchShow() { + OptionBarSearchNotPending = true; + OptionBarMessageIcon = OptionBarMessageIconType.None; + OptionBarMessage = null; MainContent = _downloadsView; if (OptionBarContent != OptionBarContentType.PlaylistSearch) @@ -189,7 +203,7 @@ namespace VDownload.Core.ViewModels.Home public async Task VideoSearchStart() { OptionBarSearchNotPending = false; - OptionBarLoading = true; + OptionBarMessageIcon = OptionBarMessageIconType.ProgressRing; OptionBarMessage = _stringResourcesService.HomeViewResources.Get("OptionBarMessageLoading"); Video video; @@ -199,8 +213,8 @@ namespace VDownload.Core.ViewModels.Home } catch (MediaSearchException ex) { - OptionBarLoading = false; - OptionBarMessage = ex.Message; + OptionBarMessageIcon = OptionBarMessageIconType.Error; + OptionBarMessage = _stringResourcesService.SearchResources.Get(ex.StringCode); OptionBarSearchNotPending = true; return; } @@ -210,7 +224,7 @@ namespace VDownload.Core.ViewModels.Home MainContent = _videoView; OptionBarSearchNotPending = true; - OptionBarLoading = false; + OptionBarMessageIcon = OptionBarMessageIconType.None; OptionBarMessage = null; } @@ -218,7 +232,7 @@ namespace VDownload.Core.ViewModels.Home public async Task PlaylistSearchStart() { OptionBarSearchNotPending = false; - OptionBarLoading = true; + OptionBarMessageIcon = OptionBarMessageIconType.ProgressRing; OptionBarMessage = _stringResourcesService.HomeViewResources.Get("OptionBarMessageLoading"); Playlist playlist; @@ -228,8 +242,8 @@ namespace VDownload.Core.ViewModels.Home } catch (MediaSearchException ex) { - OptionBarLoading = false; - OptionBarMessage = ex.Message; + OptionBarMessageIcon = OptionBarMessageIconType.Error; + OptionBarMessage = _stringResourcesService.SearchResources.Get(ex.StringCode); OptionBarSearchNotPending = true; return; } @@ -239,7 +253,7 @@ namespace VDownload.Core.ViewModels.Home MainContent = _playlistView; OptionBarSearchNotPending = true; - OptionBarLoading = false; + OptionBarMessageIcon = OptionBarMessageIconType.None; OptionBarMessage = null; } diff --git a/VDownload.Core/VDownload.Core.Views/Home/HomeView.xaml b/VDownload.Core/VDownload.Core.Views/Home/HomeView.xaml index aaf06cf..55aa37b 100644 --- a/VDownload.Core/VDownload.Core.Views/Home/HomeView.xaml +++ b/VDownload.Core/VDownload.Core.Views/Home/HomeView.xaml @@ -106,10 +106,24 @@ - + + 20 + 0,0,10,0 + + + + + + + + + + diff --git a/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs b/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs index 062e9ce..5fe0549 100644 --- a/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs +++ b/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs @@ -12,6 +12,7 @@ namespace VDownload.Services.UI.StringResources StringResources HomeDownloadsViewResources { get; } StringResources AuthenticationViewResources { get; } StringResources NotificationsResources { get; } + StringResources SearchResources { get; } } @@ -35,6 +36,7 @@ namespace VDownload.Services.UI.StringResources public StringResources HomeDownloadsViewResources { get; protected set; } public StringResources AuthenticationViewResources { get; protected set; } public StringResources NotificationsResources { get; protected set; } + public StringResources SearchResources { get; protected set; } #endregion @@ -53,6 +55,7 @@ namespace VDownload.Services.UI.StringResources HomeDownloadsViewResources = BuildResource("HomeDownloadsViewResources"); AuthenticationViewResources = BuildResource("AuthenticationViewResources"); NotificationsResources = BuildResource("NotificationsResources"); + SearchResources = BuildResource("SearchResources"); } #endregion diff --git a/VDownload.Sources/VDownload.Sources.Common/ISourceSearchService.cs b/VDownload.Sources/VDownload.Sources.Common/ISourceSearchService.cs deleted file mode 100644 index 8a26080..0000000 --- a/VDownload.Sources/VDownload.Sources.Common/ISourceSearchService.cs +++ /dev/null @@ -1,10 +0,0 @@ -using VDownload.Models; - -namespace VDownload.Sources.Common -{ - public interface ISourceSearchService - { - Task