Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
308 lines (274 sloc) 15.3 KB
<!--
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The MIT License (MIT)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-->
<Page x:Class="RssReader.Views.FeedView"
NavigationCacheMode="Required"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:RssReader.Views"
xmlns:common="using:RssReader.Common"
xmlns:controls="using:RssReader.Controls"
xmlns:vm="using:RssReader.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="ArticleItemViewTemplate"
x:DataType="vm:ArticleViewModel">
<Grid>
<Grid>
<StackPanel Background="{ThemeResource Background60WhiteBrush}">
<Grid Padding="12,12,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0"
Text="{x:Bind PublishedDateFormatted}"
TextWrapping="NoWrap"
Foreground="{ThemeResource Foreground100SalmonBrush}"
Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Grid.Row="1"
Margin="0,10,0,0"
Text="{x:Bind Title}"
TextWrapping="Wrap"
MaxLines="2"
TextTrimming="CharacterEllipsis"
Foreground="{ThemeResource Foreground100BlackBrush}"
Style="{StaticResource SubtitleTextBlockStyle}" />
<TextBlock Grid.Row="2"
Margin="0,4,0,12"
Text="{x:Bind Summary}"
TextWrapping="Wrap"
MaxLines="2"
TextTrimming="CharacterEllipsis"
Foreground="{ThemeResource Foreground100BlackBrush}"
Style="{StaticResource BodyTextBlockStyle}" />
</Grid>
<Rectangle x:Name="BorderBottom"
Grid.Row="2"
Height="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Fill="{ThemeResource Border20SalmonBrush}" />
</StackPanel>
</Grid>
<ToggleButton Content="&#xE1CE;"
Click="{x:Bind SyncFavoritesFeed}"
IsChecked="{x:Bind IsStarred, Mode=TwoWay}"
IsThreeState="False"
HorizontalAlignment="Right"
Style="{StaticResource ToggleFavorite}" />
</Grid>
</DataTemplate>
</Page.Resources>
<Grid Background="{ThemeResource Background100CloudBrush}"
Padding="0,0,0,12">
<!--Bad feed content-->
<Grid x:Name="FeedErrorMessage"
x:DeferLoadStrategy="Lazy"
Visibility="{x:Bind ViewModel.CurrentFeed.IsInErrorAndEmpty, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="96" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Background="{ThemeResource Background100PastelOrangeBrush}"
HorizontalAlignment="Stretch">
<Image Width="140"
Height="96"
Source="ms-appx:///Assets/icon_feederror1.png"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Grid>
<TextBlock Grid.Row="1"
Margin="24,12"
Text="Oh no! It looks like this feed is down."
TextWrapping="Wrap"
Foreground="{ThemeResource Foreground100CrimsonBrush}"
Style="{ThemeResource SubtitleTextBlockStyle}" />
<Rectangle Grid.Row="2"
Margin="24,0.333,24,0"
Height="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Fill="{ThemeResource Border100PaleRoseBrush}" />
<TextBlock Grid.Row="3"
Margin="24,24,24,12"
Text="You should try refreshing it. Either the feed's server is down or your connection to the internet isn't working. Sorry, friend! :("
TextWrapping="Wrap"
Foreground="{ThemeResource Foreground100DimGrayBrush}"
Style="{ThemeResource BodyTextBlockStyle}" />
<Grid Grid.Row="4"
Margin="24,24">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button x:Name="RefreshFeed"
Grid.Column="0"
Content="Refresh"
Click="{x:Bind ViewModel.RefreshCurrentFeed}"
Style="{StaticResource ButtonStyle2}"
Width="120"
HorizontalAlignment="Left" />
<Button x:Name="RemoveFeed"
Grid.Column="1"
Content="Remove"
Click="{x:Bind ViewModel.RemoveBadFeed}"
Style="{StaticResource ButtonStyle2}"
HorizontalAlignment="Right"
Width="120"
Margin="20,0,0,0" />
</Grid>
</Grid>
<!--Feed-is-empty content-->
<Grid Visibility="{x:Bind ViewModel.CurrentFeed.IsEmpty, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
<!--Favorites-is-empty content-->
<Grid x:Name="FavoritesIsEmptyMessage"
x:DeferLoadStrategy="Lazy"
Visibility="{x:Bind ViewModel.CurrentFeed.IsFavoritesFeed, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="96" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Background="{ThemeResource Background100OceanGrayBrush}"
HorizontalAlignment="Stretch">
<Image Width="140"
Height="96"
Source="ms-appx:///Assets/icon_nofavs.png"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Grid>
<TextBlock Grid.Row="1"
Margin="24,12"
Text="No favorites yet!"
TextWrapping="Wrap"
Foreground="{ThemeResource Foreground100CrimsonBrush}"
Style="{ThemeResource SubtitleTextBlockStyle}" />
<Rectangle Grid.Row="2"
Margin="24,0.333,24,0"
Height="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Fill="{ThemeResource Border100PaleRoseBrush}" />
<TextBlock Grid.Row="3"
Margin="24,24,24,12"
Text="You can favorite an article by clicking or tapping the star. When you're ready to remove it, simply click or tap the star again."
TextWrapping="Wrap"
Foreground="{ThemeResource Foreground100DimGrayBrush}"
Style="{ThemeResource BodyTextBlockStyle}" />
</Grid>
<!--Non-favorites-is-empty (not yet loaded) content-->
<Grid Visibility="{x:Bind ViewModel.CurrentFeed.IsNotFavoritesOrInError, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<controls:PageHeader>
<controls:PageHeader.HeaderContent>
<TextBlock Text="{x:Bind ViewModel.CurrentFeed.Name, Mode=OneWay}"
HorizontalAlignment="Left"
TextWrapping="NoWrap"
TextTrimming="CharacterEllipsis"
Foreground="{ThemeResource Foreground100CrimsonBrush}"
Style="{ThemeResource SubtitleTextBlockStyle}" />
</controls:PageHeader.HeaderContent>
</controls:PageHeader>
<Rectangle Margin="24,0.333,24,0"
Height="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Fill="{ThemeResource Border100PaleRoseBrush}" />
<ProgressBar Grid.Row="1"
Margin="24,8"
IsIndeterminate="True"
Style="{ThemeResource ProgressBarStyle1}" />
</Grid>
</Grid>
<!--Normal feed view content-->
<Grid x:Name="NormalFeedView"
x:DeferLoadStrategy="Lazy"
Visibility="{x:Bind ViewModel.CurrentFeed.IsNotEmpty, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="3" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<controls:PageHeader>
<controls:PageHeader.HeaderContent>
<TextBlock Text="{x:Bind ViewModel.CurrentFeed.Name, Mode=OneWay}"
HorizontalAlignment="Left"
TextWrapping="NoWrap"
TextTrimming="CharacterEllipsis"
Foreground="{ThemeResource Foreground100CrimsonBrush}"
Style="{ThemeResource SubtitleTextBlockStyle}" />
</controls:PageHeader.HeaderContent>
</controls:PageHeader>
<!--Feed-refresh error state content-->
<Grid Grid.Row="1"
Tapped="{x:Bind ViewModel.RefreshCurrentFeed}"
Background="{ThemeResource Background100PastelOrangeBrush}"
Visibility="{x:Bind ViewModel.CurrentFeed.IsInErrorAndNotEmpty, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
<SymbolIcon Symbol="Clock"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="20,10,5,10" />
<TextBlock Text="{x:Bind ViewModel.CurrentFeed.FeedDownMessage, Mode=OneWay}"
TextWrapping="WrapWholeWords"
HorizontalAlignment="Left"
Margin="48,10,12,10" />
</Grid>
<Rectangle Visibility="{x:Bind ViewModel.CurrentFeed.IsInErrorAndNotEmpty, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}, ConverterParameter=Reverse}"
Margin="24,0.333,24,0"
Grid.Row="2"
Height="1"
HorizontalAlignment="Stretch"
Fill="{ThemeResource Border100PaleRoseBrush}" />
<ProgressBar Visibility="{x:Bind ViewModel.CurrentFeed.IsLoadingAndNotEmpty, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"
Margin="24,1,24,0"
Grid.Row="2"
IsIndeterminate="True"
Style="{ThemeResource ProgressBarStyle1}" />
<controls:NavMenuListView x:Name="ArticlesListView"
Grid.Row="3"
Padding="12,0"
ItemsSource="{x:Bind ViewModel.CurrentFeed.ArticlesAsObject, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.CurrentArticleAsObject, Mode=OneWay}"
CanReorderItems="{x:Bind ViewModel.IsCurrentFeedFavoritesFeed, Mode=OneWay}"
AllowDrop="True"
IsSwipeEnabled="True"
IsItemClickEnabled="True"
ItemInvoked="ArticlesListView_ItemInvoked"
ItemContainerStyle="{StaticResource FeedView}"
ItemTemplate="{StaticResource ArticleItemViewTemplate}"
Visibility="{x:Bind ViewModel.CurrentFeed.IsEmpty, Mode=OneWay, ConverterParameter=Reverse, Converter={StaticResource BooleanToVisibilityConverter}}" />
</Grid>
</Grid>
</Page>