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
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,7 +213,7 @@ namespace VDownload.Core.ViewModels.Home
}
catch (MediaSearchException ex)
{
OptionBarLoading = false;
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,7 +242,7 @@ namespace VDownload.Core.ViewModels.Home
}
catch (MediaSearchException ex)
{
OptionBarLoading = false;
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;
}

View File

@@ -106,10 +106,24 @@
</ctuc:SwitchPresenter>
<StackPanel VerticalAlignment="Center"
Orientation="Horizontal">
<ProgressRing Width="20"
Height="20"
Margin="0,0,10,0"
Visibility="{Binding OptionBarLoading, Converter={StaticResource BoolToVisibilityConverter}}"/>
<StackPanel.Resources>
<x:Double x:Key="IconSize">20</x:Double>
<Thickness x:Key="IconMargin">0,0,10,0</Thickness>
</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}"/>
</StackPanel>
</ctuc:UniformGrid>

View File

@@ -14,6 +14,7 @@
<ResourceDictionary Source="Dictionaries/Images/ImagesSources.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesOther.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesBaseView.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesHomeView.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesHomeDownloadsView.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesHomePlaylistView.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\ViewDark.png" />
<Content Remove="Assets\HomeVideoView\ViewLight.png" />
<Content Remove="Assets\HomeView\Error.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-24.png" />
@@ -144,6 +145,7 @@
<None Remove="Dictionaries\Images\ImagesHomeDownloadsView.xaml" />
<None Remove="Dictionaries\Images\ImagesHomePlaylistView.xaml" />
<None Remove="Dictionaries\Images\ImagesHomeVideoView.xaml" />
<None Remove="Dictionaries\Images\ImagesHomeView.xaml" />
<None Remove="Dictionaries\Images\ImagesLogo.xaml" />
<None Remove="Dictionaries\Images\ImagesOther.xaml" />
<None Remove="Dictionaries\Images\ImagesSources.xaml" />
@@ -398,6 +400,9 @@
<None Update="Assets\HomeVideoView\ViewLight.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\HomeView\Error.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Assets\Logo\Logo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@@ -407,6 +412,9 @@
<None Update="configuration.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Page Update="Dictionaries\Images\ImagesHomeView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Dictionaries\Images\ImagesOther.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>