infobar errors
This commit is contained in:
@@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="ErrorInfoBar.Title" xml:space="preserve">
|
||||
<value>Error</value>
|
||||
</data>
|
||||
<data name="OptionBarDownloadAll.Label" xml:space="preserve">
|
||||
<value>Download all</value>
|
||||
</data>
|
||||
|
||||
@@ -23,13 +23,6 @@ namespace VDownload.Core.ViewModels.Home
|
||||
{
|
||||
#region ENUMS
|
||||
|
||||
public enum OptionBarMessageIconType
|
||||
{
|
||||
None,
|
||||
ProgressRing,
|
||||
Error
|
||||
}
|
||||
|
||||
public enum OptionBarContentType
|
||||
{
|
||||
None,
|
||||
@@ -80,6 +73,11 @@ namespace VDownload.Core.ViewModels.Home
|
||||
[ObservableProperty]
|
||||
private Type _mainContent;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _optionBarError;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _optionBarIsErrorOpened;
|
||||
|
||||
[ObservableProperty]
|
||||
private OptionBarContentType _optionBarContent;
|
||||
@@ -88,7 +86,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
private string _optionBarMessage;
|
||||
|
||||
[ObservableProperty]
|
||||
private OptionBarMessageIconType _optionBarMessageIcon;
|
||||
private bool _optionBarLoading;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _optionBarLoadSubscriptionButtonChecked;
|
||||
@@ -149,8 +147,10 @@ namespace VDownload.Core.ViewModels.Home
|
||||
MainContent = _downloadsView;
|
||||
|
||||
OptionBarContent = OptionBarContentType.None;
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.None;
|
||||
OptionBarLoading = false;
|
||||
OptionBarMessage = null;
|
||||
OptionBarError = null;
|
||||
OptionBarIsErrorOpened = true;
|
||||
OptionBarLoadSubscriptionButtonChecked = false;
|
||||
OptionBarVideoSearchButtonChecked = false;
|
||||
OptionBarPlaylistSearchButtonChecked = false;
|
||||
@@ -164,7 +164,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
public async Task LoadFromSubscription()
|
||||
{
|
||||
MainContent = _downloadsView;
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.None;
|
||||
OptionBarLoading = false;
|
||||
OptionBarMessage = null;
|
||||
|
||||
if (OptionBarLoadSubscriptionButtonChecked)
|
||||
@@ -174,7 +174,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
OptionBarPlaylistSearchButtonChecked = false;
|
||||
|
||||
OptionBarSearchNotPending = false;
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.ProgressRing;
|
||||
OptionBarLoading = true;
|
||||
OptionBarMessage = _stringResourcesService.HomeViewResources.Get("OptionBarMessageLoading");
|
||||
|
||||
SubscriptionsVideoList subList = new SubscriptionsVideoList { Name = _stringResourcesService.CommonResources.Get("SubscriptionVideoListName") };
|
||||
@@ -217,7 +217,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
}
|
||||
|
||||
OptionBarSearchNotPending = true;
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.None;
|
||||
OptionBarLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
public void VideoSearchShow()
|
||||
{
|
||||
OptionBarSearchNotPending = true;
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.None;
|
||||
OptionBarLoading = false;
|
||||
OptionBarMessage = null;
|
||||
MainContent = _downloadsView;
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
public void PlaylistSearchShow()
|
||||
{
|
||||
OptionBarSearchNotPending = true;
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.None;
|
||||
OptionBarLoading = false;
|
||||
OptionBarMessage = null;
|
||||
MainContent = _downloadsView;
|
||||
|
||||
@@ -265,7 +265,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
public async Task VideoSearchStart()
|
||||
{
|
||||
OptionBarSearchNotPending = false;
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.ProgressRing;
|
||||
OptionBarLoading = true;
|
||||
OptionBarMessage = _stringResourcesService.HomeViewResources.Get("OptionBarMessageLoading");
|
||||
|
||||
Video video;
|
||||
@@ -275,9 +275,10 @@ namespace VDownload.Core.ViewModels.Home
|
||||
}
|
||||
catch (MediaSearchException ex)
|
||||
{
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.Error;
|
||||
OptionBarMessage = _stringResourcesService.SearchResources.Get(ex.StringCode);
|
||||
OptionBarError = _stringResourcesService.SearchResources.Get(ex.StringCode);
|
||||
OptionBarSearchNotPending = true;
|
||||
OptionBarLoading = false;
|
||||
OptionBarMessage = null;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -286,7 +287,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
MainContent = _videoView;
|
||||
|
||||
OptionBarSearchNotPending = true;
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.None;
|
||||
OptionBarLoading = false;
|
||||
OptionBarMessage = null;
|
||||
}
|
||||
|
||||
@@ -294,7 +295,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
public async Task PlaylistSearchStart()
|
||||
{
|
||||
OptionBarSearchNotPending = false;
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.ProgressRing;
|
||||
OptionBarLoading = true;
|
||||
OptionBarMessage = _stringResourcesService.HomeViewResources.Get("OptionBarMessageLoading");
|
||||
|
||||
Playlist playlist;
|
||||
@@ -304,9 +305,10 @@ namespace VDownload.Core.ViewModels.Home
|
||||
}
|
||||
catch (MediaSearchException ex)
|
||||
{
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.Error;
|
||||
OptionBarMessage = _stringResourcesService.SearchResources.Get(ex.StringCode);
|
||||
OptionBarError = _stringResourcesService.SearchResources.Get(ex.StringCode);
|
||||
OptionBarSearchNotPending = true;
|
||||
OptionBarLoading = false;
|
||||
OptionBarMessage = null;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -315,7 +317,7 @@ namespace VDownload.Core.ViewModels.Home
|
||||
MainContent = _videoCollectionView;
|
||||
|
||||
OptionBarSearchNotPending = true;
|
||||
OptionBarMessageIcon = OptionBarMessageIconType.None;
|
||||
OptionBarLoading = false;
|
||||
OptionBarMessage = null;
|
||||
}
|
||||
|
||||
@@ -339,6 +341,13 @@ namespace VDownload.Core.ViewModels.Home
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void CloseError()
|
||||
{
|
||||
OptionBarError = null;
|
||||
OptionBarIsErrorOpened = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
@@ -25,130 +25,128 @@
|
||||
<Frame Content="{Binding MainContent, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ViewModelToViewConverter}}">
|
||||
|
||||
</Frame>
|
||||
<Grid Grid.Row="1"
|
||||
Background="{ThemeResource OptionBarBackgroundColor}"
|
||||
CornerRadius="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ctuc:UniformGrid Grid.Column="0"
|
||||
Rows="1"
|
||||
Margin="15,0,0,0">
|
||||
<ctuc:UniformGrid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
</ctuc:UniformGrid.RowDefinitions>
|
||||
<ctuc:UniformGrid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</ctuc:UniformGrid.ColumnDefinitions>
|
||||
<ctuc:SwitchPresenter Grid.Row="0"
|
||||
VerticalAlignment="Stretch"
|
||||
Margin="0,0,15,0"
|
||||
Value="{Binding OptionBarContent, Converter={StaticResource ObjectToStringConverter}}">
|
||||
<i:Interaction.Behaviors>
|
||||
<ic:DataTriggerBehavior Binding="{Binding OptionBarContent, Converter={StaticResource ObjectToStringConverter}}"
|
||||
ComparisonCondition="Equal"
|
||||
Value="None">
|
||||
<ic:ChangePropertyAction PropertyName="Visibility"
|
||||
Value="Collapsed"/>
|
||||
</ic:DataTriggerBehavior>
|
||||
<ic:DataTriggerBehavior Binding="{Binding OptionBarContent, Converter={StaticResource ObjectToStringConverter}}"
|
||||
ComparisonCondition="NotEqual"
|
||||
Value="None">
|
||||
<ic:ChangePropertyAction PropertyName="Visibility"
|
||||
Value="Visible"/>
|
||||
</ic:DataTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
<ctuc:Case Value="VideoSearch">
|
||||
<Grid ColumnSpacing="10"
|
||||
VerticalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarVideoSearchContentTextBox"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding OptionBarVideoSearchTBValue, Mode=TwoWay}"/>
|
||||
<Button x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarSearchButton"
|
||||
Grid.Column="1"
|
||||
IsEnabled="{Binding OptionBarSearchNotPending}"
|
||||
Command="{Binding VideoSearchStartCommand}"/>
|
||||
</Grid>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="PlaylistSearch">
|
||||
<Grid ColumnSpacing="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarPlaylistSearchContentTextBox"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding OptionBarPlaylistSearchTBValue, Mode=TwoWay}"/>
|
||||
<NumberBox x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarPlaylistSearchContentNumberBox"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
SmallChange="1"
|
||||
LargeChange="10"
|
||||
Value="{Binding OptionBarPlaylistSearchNBValue, Mode=TwoWay}"
|
||||
Minimum="0"/>
|
||||
<Button x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarSearchButton"
|
||||
Grid.Column="2"
|
||||
IsEnabled="{Binding OptionBarSearchNotPending}"
|
||||
Command="{Binding PlaylistSearchStartCommand}"/>
|
||||
</Grid>
|
||||
</ctuc:Case>
|
||||
</ctuc:SwitchPresenter>
|
||||
<StackPanel VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<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>
|
||||
<StackPanel Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<AppBarToggleButton x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarLoadSubscription"
|
||||
Icon="Favorite"
|
||||
IsEnabled="{Binding OptionBarSearchNotPending}"
|
||||
IsChecked="{Binding OptionBarLoadSubscriptionButtonChecked, Mode=TwoWay}"
|
||||
Command="{Binding LoadFromSubscriptionCommand}"/>
|
||||
<AppBarToggleButton x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarVideoSearch"
|
||||
Icon="Video"
|
||||
IsEnabled="{Binding OptionBarSearchNotPending}"
|
||||
IsChecked="{Binding OptionBarVideoSearchButtonChecked, Mode=TwoWay}"
|
||||
Command="{Binding VideoSearchShowCommand}"/>
|
||||
<AppBarToggleButton x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarPlaylistSearch"
|
||||
Icon="List"
|
||||
IsEnabled="{Binding OptionBarSearchNotPending}"
|
||||
IsChecked="{Binding OptionBarPlaylistSearchButtonChecked, Mode=TwoWay}"
|
||||
Command="{Binding PlaylistSearchShowCommand}"/>
|
||||
<AppBarSeparator/>
|
||||
<AppBarButton x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarDownloadAll"
|
||||
Icon="Download"
|
||||
Command="{Binding DownloadCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<ctuc:SwitchPresenter Grid.Row="1"
|
||||
Value="{Binding OptionBarError, Converter={StaticResource IsNotNullConverter}}">
|
||||
<ctuc:Case Value="False">
|
||||
<Grid Background="{ThemeResource OptionBarBackgroundColor}"
|
||||
CornerRadius="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ctuc:UniformGrid Grid.Column="0"
|
||||
Rows="1"
|
||||
Margin="15,0,0,0">
|
||||
<ctuc:UniformGrid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
</ctuc:UniformGrid.RowDefinitions>
|
||||
<ctuc:UniformGrid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</ctuc:UniformGrid.ColumnDefinitions>
|
||||
<ctuc:SwitchPresenter Grid.Row="0"
|
||||
VerticalAlignment="Stretch"
|
||||
Margin="0,0,15,0"
|
||||
Value="{Binding OptionBarContent, Converter={StaticResource ObjectToStringConverter}}">
|
||||
<i:Interaction.Behaviors>
|
||||
<ic:DataTriggerBehavior Binding="{Binding OptionBarContent, Converter={StaticResource ObjectToStringConverter}}"
|
||||
ComparisonCondition="Equal"
|
||||
Value="None">
|
||||
<ic:ChangePropertyAction PropertyName="Visibility"
|
||||
Value="Collapsed"/>
|
||||
</ic:DataTriggerBehavior>
|
||||
<ic:DataTriggerBehavior Binding="{Binding OptionBarContent, Converter={StaticResource ObjectToStringConverter}}"
|
||||
ComparisonCondition="NotEqual"
|
||||
Value="None">
|
||||
<ic:ChangePropertyAction PropertyName="Visibility"
|
||||
Value="Visible"/>
|
||||
</ic:DataTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
<ctuc:Case Value="VideoSearch">
|
||||
<Grid ColumnSpacing="10"
|
||||
VerticalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarVideoSearchContentTextBox"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding OptionBarVideoSearchTBValue, Mode=TwoWay}"/>
|
||||
<Button x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarSearchButton"
|
||||
Grid.Column="1"
|
||||
IsEnabled="{Binding OptionBarSearchNotPending}"
|
||||
Command="{Binding VideoSearchStartCommand}"/>
|
||||
</Grid>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="PlaylistSearch">
|
||||
<Grid ColumnSpacing="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarPlaylistSearchContentTextBox"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding OptionBarPlaylistSearchTBValue, Mode=TwoWay}"/>
|
||||
<NumberBox x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarPlaylistSearchContentNumberBox"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
SmallChange="1"
|
||||
LargeChange="10"
|
||||
Value="{Binding OptionBarPlaylistSearchNBValue, Mode=TwoWay}"
|
||||
Minimum="0"/>
|
||||
<Button x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarSearchButton"
|
||||
Grid.Column="2"
|
||||
IsEnabled="{Binding OptionBarSearchNotPending}"
|
||||
Command="{Binding PlaylistSearchStartCommand}"/>
|
||||
</Grid>
|
||||
</ctuc:Case>
|
||||
</ctuc:SwitchPresenter>
|
||||
<StackPanel VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<ProgressRing Width="20"
|
||||
Height="20"
|
||||
Margin="0,0,10,0"
|
||||
Visibility="{Binding OptionBarLoading, Converter={StaticResource BoolToVisibilityConverter}}"/>
|
||||
<TextBlock Text="{Binding OptionBarMessage}"/>
|
||||
</StackPanel>
|
||||
</ctuc:UniformGrid>
|
||||
<StackPanel Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<AppBarToggleButton x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarLoadSubscription"
|
||||
Icon="Favorite"
|
||||
IsEnabled="{Binding OptionBarSearchNotPending}"
|
||||
IsChecked="{Binding OptionBarLoadSubscriptionButtonChecked, Mode=TwoWay}"
|
||||
Command="{Binding LoadFromSubscriptionCommand}"/>
|
||||
<AppBarToggleButton x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarVideoSearch"
|
||||
Icon="Video"
|
||||
IsEnabled="{Binding OptionBarSearchNotPending}"
|
||||
IsChecked="{Binding OptionBarVideoSearchButtonChecked, Mode=TwoWay}"
|
||||
Command="{Binding VideoSearchShowCommand}"/>
|
||||
<AppBarToggleButton x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarPlaylistSearch"
|
||||
Icon="List"
|
||||
IsEnabled="{Binding OptionBarSearchNotPending}"
|
||||
IsChecked="{Binding OptionBarPlaylistSearchButtonChecked, Mode=TwoWay}"
|
||||
Command="{Binding PlaylistSearchShowCommand}"/>
|
||||
<AppBarSeparator/>
|
||||
<AppBarButton x:Uid="/VDownload.Core.Strings/HomeViewResources/OptionBarDownloadAll"
|
||||
Icon="Download"
|
||||
Command="{Binding DownloadCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ctuc:Case>
|
||||
<ctuc:Case Value="True">
|
||||
<InfoBar x:Uid="/VDownload.Core.Strings/HomeViewResources/ErrorInfoBar"
|
||||
Severity="Error"
|
||||
IsOpen="{Binding OptionBarIsErrorOpened, Mode=TwoWay}"
|
||||
Message="{Binding OptionBarError}"
|
||||
CloseButtonCommand="{Binding CloseErrorCommand}"/>
|
||||
</ctuc:Case>
|
||||
</ctuc:SwitchPresenter>
|
||||
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
<ctuc:Case Value="True">
|
||||
<InfoBar x:Uid="/VDownload.Core.Strings/SubscriptionsViewResources/ErrorInfoBar"
|
||||
Severity="Error"
|
||||
IsOpen="{Binding IsErrorOpened, Mode=TwoWay}"
|
||||
IsOpen="{Binding OptionBarIsErrorOpened, Mode=TwoWay}"
|
||||
Message="{Binding Error}"
|
||||
CloseButtonCommand="{Binding CloseErrorCommand}"/>
|
||||
</ctuc:Case>
|
||||
|
||||
Reference in New Issue
Block a user