Skip to content

Commit

Permalink
Merge pull request chocolatey#743 from gep13/feature/chocolateyGH-742
Browse files Browse the repository at this point in the history
(chocolateyGH-742) Add message when PreventPreload is used
  • Loading branch information
gep13 authored Apr 4, 2020
2 parents 03ac9f3 + dc9fa0c commit 99c4425
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public sealed class RemoteSourceViewModel : Screen, ISourceViewModelBase
private readonly IMapper _mapper;
private int _currentPage = 1;
private bool _hasLoaded;
private bool _shouldShowPreventPreloadMessage;
private bool _includeAllVersions;
private bool _includePrerelease;
private bool _matchWord;
Expand Down Expand Up @@ -80,6 +81,12 @@ public RemoteSourceViewModel(
_eventAggregator.Subscribe(this);
}

public bool ShowShouldPreventPreloadMessage
{
get { return _shouldShowPreventPreloadMessage; }
set { this.SetPropertyValue(ref _shouldShowPreventPreloadMessage, value); }
}

public ListViewMode ListViewMode
{
get { return _listViewMode; }
Expand Down Expand Up @@ -223,11 +230,13 @@ public async Task LoadPackages()

if (!_hasLoaded && _configService.GetAppConfiguration().PreventPreload)
{
ShowShouldPreventPreloadMessage = true;
_hasLoaded = true;
return;
}

_hasLoaded = false;
ShowShouldPreventPreloadMessage = false;

var sort = SortSelection == Resources.RemoteSourceViewModel_SortSelectionPopularity ? "DownloadCount" : "Title";

Expand Down
36 changes: 29 additions & 7 deletions Source/ChocolateyGui.Common.Windows/Views/RemoteSourceView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,33 @@
Style="{DynamicResource PaginationButtonStyle}"/>
</Grid>

<ListView Grid.Row="1" x:Name="Packages" ItemsSource="{Binding Packages, Mode=OneWay}"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.IsDeferredScrollingEnabled="False"
MouseDoubleClick="Packages_OnMouseDoubleClick" />
<Grid Grid.Row="1">
<ListView x:Name="Packages" ItemsSource="{Binding Packages, Mode=OneWay}"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.IsDeferredScrollingEnabled="False"
MouseDoubleClick="Packages_OnMouseDoubleClick" />

<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"
Visibility="{Binding ShowShouldPreventPreloadMessage, Converter={StaticResource BoolToVis}}">
<iconPacks:PackIconOcticons Kind="Search" Width="72" Height="72" Foreground="{DynamicResource MahApps.Brushes.AccentBase}" HorizontalAlignment="Center" Margin="20" />
<TextBlock Text="{x:Static properties:Resources.RemoteSourceView_PreventPreloadNoResults}"
HorizontalAlignment="Center"
FontSize="28"
Margin="10"
TextWrapping="Wrap"/>
<TextBlock Text="{x:Static properties:Resources.RemoteSourceView_PreventPreloadHeading}"
HorizontalAlignment="Center"
FontSize="22"
Margin="5"
TextWrapping="Wrap"/>
<TextBlock Text="{x:Static properties:Resources.RemoteSourceView_PreventPreloadSubHeading}"
HorizontalAlignment="Center"
FontSize="20"
Margin="5"
TextWrapping="Wrap"/>
</StackPanel>
</Grid>
</Grid>
</UserControl>
</UserControl>
29 changes: 28 additions & 1 deletion Source/ChocolateyGui.Common/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Source/ChocolateyGui.Common/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -946,4 +946,13 @@ Normal:
<data name="SettingsView_TogglePackageDownloadCountDescription" xml:space="preserve">
<value>Allows control over whether package download count is displayed on remote source views.</value>
</data>
<data name="RemoteSourceView_PreventPreloadHeading" xml:space="preserve">
<value>The Prevent Preload feature is currently enabled.</value>
</data>
<data name="RemoteSourceView_PreventPreloadNoResults" xml:space="preserve">
<value>No results yet...</value>
</data>
<data name="RemoteSourceView_PreventPreloadSubHeading" xml:space="preserve">
<value>Please search for a package using the search box above.</value>
</data>
</root>

0 comments on commit 99c4425

Please sign in to comment.