search error icon added

This commit is contained in:
2024-03-03 19:00:38 +01:00
Unverified
parent c3724921f3
commit f4a9735558
6 changed files with 54 additions and 11 deletions

View File

@@ -19,6 +19,13 @@ namespace VDownload.Core.ViewModels.Home
{ {
#region ENUMS #region ENUMS
public enum OptionBarMessageIconType
{
None,
ProgressRing,
Error
}
public enum OptionBarContentType public enum OptionBarContentType
{ {
None, None,
@@ -75,7 +82,7 @@ namespace VDownload.Core.ViewModels.Home
private string _optionBarMessage; private string _optionBarMessage;
[ObservableProperty] [ObservableProperty]
private bool _optionBarLoading; private OptionBarMessageIconType _optionBarMessageIcon;
[ObservableProperty] [ObservableProperty]
private bool _optionBarVideoSearchButtonChecked; private bool _optionBarVideoSearchButtonChecked;
@@ -131,6 +138,7 @@ namespace VDownload.Core.ViewModels.Home
MainContent = _downloadsView; MainContent = _downloadsView;
OptionBarContent = OptionBarContentType.None; OptionBarContent = OptionBarContentType.None;
OptionBarMessageIcon = OptionBarMessageIconType.None;
OptionBarMessage = null; OptionBarMessage = null;
OptionBarVideoSearchButtonChecked = false; OptionBarVideoSearchButtonChecked = false;
OptionBarPlaylistSearchButtonChecked = false; OptionBarPlaylistSearchButtonChecked = false;
@@ -156,6 +164,9 @@ namespace VDownload.Core.ViewModels.Home
[RelayCommand] [RelayCommand]
public void VideoSearchShow() public void VideoSearchShow()
{ {
OptionBarSearchNotPending = true;
OptionBarMessageIcon = OptionBarMessageIconType.None;
OptionBarMessage = null;
MainContent = _downloadsView; MainContent = _downloadsView;
if (OptionBarContent != OptionBarContentType.VideoSearch) if (OptionBarContent != OptionBarContentType.VideoSearch)
@@ -172,6 +183,9 @@ namespace VDownload.Core.ViewModels.Home
[RelayCommand] [RelayCommand]
public void PlaylistSearchShow() public void PlaylistSearchShow()
{ {
OptionBarSearchNotPending = true;
OptionBarMessageIcon = OptionBarMessageIconType.None;
OptionBarMessage = null;
MainContent = _downloadsView; MainContent = _downloadsView;
if (OptionBarContent != OptionBarContentType.PlaylistSearch) if (OptionBarContent != OptionBarContentType.PlaylistSearch)
@@ -189,7 +203,7 @@ namespace VDownload.Core.ViewModels.Home
public async Task VideoSearchStart() public async Task VideoSearchStart()
{ {
OptionBarSearchNotPending = false; OptionBarSearchNotPending = false;
OptionBarLoading = true; OptionBarMessageIcon = OptionBarMessageIconType.ProgressRing;
OptionBarMessage = _stringResourcesService.HomeViewResources.Get("OptionBarMessageLoading"); OptionBarMessage = _stringResourcesService.HomeViewResources.Get("OptionBarMessageLoading");
Video video; Video video;
@@ -199,7 +213,7 @@ namespace VDownload.Core.ViewModels.Home
} }
catch (MediaSearchException ex) catch (MediaSearchException ex)
{ {
OptionBarLoading = false; OptionBarMessageIcon = OptionBarMessageIconType.Error;
OptionBarMessage = _stringResourcesService.SearchResources.Get(ex.StringCode); OptionBarMessage = _stringResourcesService.SearchResources.Get(ex.StringCode);
OptionBarSearchNotPending = true; OptionBarSearchNotPending = true;
return; return;
@@ -210,7 +224,7 @@ namespace VDownload.Core.ViewModels.Home
MainContent = _videoView; MainContent = _videoView;
OptionBarSearchNotPending = true; OptionBarSearchNotPending = true;
OptionBarLoading = false; OptionBarMessageIcon = OptionBarMessageIconType.None;
OptionBarMessage = null; OptionBarMessage = null;
} }
@@ -218,7 +232,7 @@ namespace VDownload.Core.ViewModels.Home
public async Task PlaylistSearchStart() public async Task PlaylistSearchStart()
{ {
OptionBarSearchNotPending = false; OptionBarSearchNotPending = false;
OptionBarLoading = true; OptionBarMessageIcon = OptionBarMessageIconType.ProgressRing;
OptionBarMessage = _stringResourcesService.HomeViewResources.Get("OptionBarMessageLoading"); OptionBarMessage = _stringResourcesService.HomeViewResources.Get("OptionBarMessageLoading");
Playlist playlist; Playlist playlist;
@@ -228,7 +242,7 @@ namespace VDownload.Core.ViewModels.Home
} }
catch (MediaSearchException ex) catch (MediaSearchException ex)
{ {
OptionBarLoading = false; OptionBarMessageIcon = OptionBarMessageIconType.Error;
OptionBarMessage = _stringResourcesService.SearchResources.Get(ex.StringCode); OptionBarMessage = _stringResourcesService.SearchResources.Get(ex.StringCode);
OptionBarSearchNotPending = true; OptionBarSearchNotPending = true;
return; return;
@@ -239,7 +253,7 @@ namespace VDownload.Core.ViewModels.Home
MainContent = _playlistView; MainContent = _playlistView;
OptionBarSearchNotPending = true; OptionBarSearchNotPending = true;
OptionBarLoading = false; OptionBarMessageIcon = OptionBarMessageIconType.None;
OptionBarMessage = null; OptionBarMessage = null;
} }

View File

@@ -106,10 +106,24 @@
</ctuc:SwitchPresenter> </ctuc:SwitchPresenter>
<StackPanel VerticalAlignment="Center" <StackPanel VerticalAlignment="Center"
Orientation="Horizontal"> Orientation="Horizontal">
<ProgressRing Width="20" <StackPanel.Resources>
Height="20" <x:Double x:Key="IconSize">20</x:Double>
Margin="0,0,10,0" <Thickness x:Key="IconMargin">0,0,10,0</Thickness>
Visibility="{Binding OptionBarLoading, Converter={StaticResource BoolToVisibilityConverter}}"/> </StackPanel.Resources>
<ctuc:SwitchPresenter Value="{Binding OptionBarMessageIcon, Converter={StaticResource ObjectToStringConverter}}">
<ctuc:Case Value="None"/>
<ctuc:Case Value="ProgressRing">
<ProgressRing Width="{StaticResource IconSize}"
Height="{StaticResource IconSize}"
Margin="{StaticResource IconMargin}"/>
</ctuc:Case>
<ctuc:Case Value="Error">
<Image Width="{StaticResource IconSize}"
Height="{StaticResource IconSize}"
Margin="{StaticResource IconMargin}"
Source="{StaticResource ImageHomeViewError}"/>
</ctuc:Case>
</ctuc:SwitchPresenter>
<TextBlock Text="{Binding OptionBarMessage}"/> <TextBlock Text="{Binding OptionBarMessage}"/>
</StackPanel> </StackPanel>
</ctuc:UniformGrid> </ctuc:UniformGrid>

View File

@@ -14,6 +14,7 @@
<ResourceDictionary Source="Dictionaries/Images/ImagesSources.xaml"/> <ResourceDictionary Source="Dictionaries/Images/ImagesSources.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesOther.xaml"/> <ResourceDictionary Source="Dictionaries/Images/ImagesOther.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesBaseView.xaml"/> <ResourceDictionary Source="Dictionaries/Images/ImagesBaseView.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesHomeView.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesHomeDownloadsView.xaml"/> <ResourceDictionary Source="Dictionaries/Images/ImagesHomeDownloadsView.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesHomePlaylistView.xaml"/> <ResourceDictionary Source="Dictionaries/Images/ImagesHomePlaylistView.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesHomeVideoView.xaml"/> <ResourceDictionary Source="Dictionaries/Images/ImagesHomeVideoView.xaml"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:String x:Key="ImageHomeViewError">/Assets/HomeView/Error.png</x:String>
</ResourceDictionary>

View File

@@ -84,6 +84,7 @@
<Content Remove="Assets\HomeVideoView\TrimLight.png" /> <Content Remove="Assets\HomeVideoView\TrimLight.png" />
<Content Remove="Assets\HomeVideoView\ViewDark.png" /> <Content Remove="Assets\HomeVideoView\ViewDark.png" />
<Content Remove="Assets\HomeVideoView\ViewLight.png" /> <Content Remove="Assets\HomeVideoView\ViewLight.png" />
<Content Remove="Assets\HomeView\Error.png" />
<Content Remove="Assets\Logo\Logo.png" /> <Content Remove="Assets\Logo\Logo.png" />
<Content Remove="Assets\Logo\Square44x44Logo.altform-lightunplated_targetsize-16.png" /> <Content Remove="Assets\Logo\Square44x44Logo.altform-lightunplated_targetsize-16.png" />
<Content Remove="Assets\Logo\Square44x44Logo.altform-lightunplated_targetsize-24.png" /> <Content Remove="Assets\Logo\Square44x44Logo.altform-lightunplated_targetsize-24.png" />
@@ -144,6 +145,7 @@
<None Remove="Dictionaries\Images\ImagesHomeDownloadsView.xaml" /> <None Remove="Dictionaries\Images\ImagesHomeDownloadsView.xaml" />
<None Remove="Dictionaries\Images\ImagesHomePlaylistView.xaml" /> <None Remove="Dictionaries\Images\ImagesHomePlaylistView.xaml" />
<None Remove="Dictionaries\Images\ImagesHomeVideoView.xaml" /> <None Remove="Dictionaries\Images\ImagesHomeVideoView.xaml" />
<None Remove="Dictionaries\Images\ImagesHomeView.xaml" />
<None Remove="Dictionaries\Images\ImagesLogo.xaml" /> <None Remove="Dictionaries\Images\ImagesLogo.xaml" />
<None Remove="Dictionaries\Images\ImagesOther.xaml" /> <None Remove="Dictionaries\Images\ImagesOther.xaml" />
<None Remove="Dictionaries\Images\ImagesSources.xaml" /> <None Remove="Dictionaries\Images\ImagesSources.xaml" />
@@ -398,6 +400,9 @@
<None Update="Assets\HomeVideoView\ViewLight.png"> <None Update="Assets\HomeVideoView\ViewLight.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="Assets\HomeView\Error.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Logo\Logo.png"> <None Update="Assets\Logo\Logo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
@@ -407,6 +412,9 @@
<None Update="configuration.json"> <None Update="configuration.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<Page Update="Dictionaries\Images\ImagesHomeView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Dictionaries\Images\ImagesOther.xaml"> <Page Update="Dictionaries\Images\ImagesOther.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>