<featurebase:FeaturePage
    x:Class="was.touchcopy.features.voicemail.VoiceMailPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:featurebase="using:was.touchcopy.features"
    xmlns:local="using:was.touchcopy.features.voicemail"
    xmlns:converters="using:was.touchcopy.features.voicemail.converters"
    xmlns:dialogs="using:was.touchcopy.features.dialogs"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DataContext="{d:DesignInstance Type=local:VoiceMailPage}"
    >
    <Page.Resources>
        <ResourceDictionary>
            <converters:VoiceMailGroupToFontIconGlyphConverter x:Key="VoiceMailGroupToFontIconGlyphConverter" />
        </ResourceDictionary>
    </Page.Resources>
    <Grid>
        <Grid x:Name="gridVoicemailDisplay">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Border Style="{ThemeResource PageHeaderBorderStyle}">
                <Grid>
                    <CommandBar Style="{ThemeResource PageHeaderCommandBarStyle}">
                        <featurebase:CopyProgressAppBarUserController x:Name="copyProgressUserControl" Visibility="Collapsed" OnCancelTapped="CopyProgressUserControl_OnCancelTapped" MaxWidth="350"/>
                        <AppBarButton x:Name="appBarButtonSaveToPC" x:Uid="AppBarButtonSaveToPC" Icon="SaveLocal" Label="XX Save to PC" Style="{ThemeResource AppBarButtonStyle}" Click="SaveToPCAppBarButton_Click"  IsEnabled="{x:Bind IsExportAvailable, Mode=OneWay}" />
                        <AppBarSeparator/>
                        <AppBarButton x:Name="appBarButtonFilterDates" x:Uid="AppBarButtonFilterDates" Label="XX Filter Dates" Style="{ThemeResource AppBarButtonStyle}" Click="AppBarButtonFilterDates_Click">
                            <AppBarButton.Content>
                                <FontIcon Glyph="&#xE787;" Foreground="{ThemeResource AccentFillColorDefaultBrush}"/>
                            </AppBarButton.Content>
                        </AppBarButton>
                    </CommandBar>
                    <TextBlock Text="{Binding PageTitle}" Style="{ThemeResource PageHeaderTitleStyle}"/>
                </Grid>
            </Border>
            <SplitView Grid.Row="1" Style="{ThemeResource FeatureSplitViewStyle}">
                <SplitView.Pane>
                    <Grid Margin="0,10,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TextBox x:Name="textBoxVoiceMailFilter" x:Uid="VoiceMailFilterTextBox" Margin="10,5" PlaceholderText="XX Search Voice Mail" 
                             TextChanged="TextBoxVoiceMailFilter_TextChanged" />
                        <ListView x:Name="listViewGroups" Grid.Row="1" SelectionMode="Single" ItemsSource="{x:Bind Groups, Mode=OneWay}" SelectionChanged="ListViewGroups_SelectionChanged"
                              RightTapped="ListViewGroups_RightTapped">
                            <ListView.ItemTemplate>
                                <DataTemplate>
                                    <Grid ColumnSpacing="8">
                                        <Grid.ContextFlyout>
                                            <MenuFlyout>
                                                <MenuFlyoutItem x:Uid="MenuFlyoutSaveSenderToPC" Text="XX Save to PC" Icon="SaveLocal" Click="MenuFlyoutSaveSenderToPC_Click" />
                                                <MenuFlyoutSeparator />
                                                <MenuFlyoutItem x:Uid="MenuFlyoutSortSendersByName" Text="XX Sort by Name" Tag="0" Click="MenuFlyoutApplySort_Click">
                                                    <MenuFlyoutItem.Icon>
                                                        <FontIcon Glyph="&#xE84B;" />
                                                    </MenuFlyoutItem.Icon>
                                                </MenuFlyoutItem>
                                                <MenuFlyoutItem x:Uid="MenuFlyoutSortSendersByLatest" Text="XX Sort by Latest" Tag="1" Click="MenuFlyoutApplySort_Click">
                                                    <MenuFlyoutItem.Icon>
                                                        <FontIcon Glyph="&#xE787;" />
                                                    </MenuFlyoutItem.Icon>
                                                </MenuFlyoutItem>
                                            </MenuFlyout>
                                        </Grid.ContextFlyout>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="auto" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <FontIcon Glyph="{Binding Converter={StaticResource VoiceMailGroupToFontIconGlyphConverter}}" />
                                        <TextBlock Grid.Column="1" Text="{Binding Title}" TextTrimming="CharacterEllipsis" />
                                    </Grid>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>
                    </Grid>
                </SplitView.Pane>
                <Grid Margin="10,0,0,0" x:Name="gridContent">
                    <local:VoiceMailContentPage x:Name="contentPage" Group="{Binding SelectedItem, ElementName=listViewGroups}"
                                             SearchFilter="{Binding Text, ElementName=textBoxVoiceMailFilter, Mode=OneWay}"
                                             DateFilterOptions="{x:Bind DateFilterOptions, Mode=OneWay}"
                                             SaveToPCRequested="VoiceMailContentPage_SaveToPCRequested"
                                             ClearFilterRequested="VoiceMailContentPage_ClearFilterRequested" />
                </Grid>
            </SplitView>
            <dialogs:DateFilterContentDialog x:Name="dialogDateFilter"  />
        </Grid>
        <Grid x:Name="gridNoVisualVoicemail" Visibility="Collapsed">
            <Grid.RowDefinitions>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" MaxWidth="600" Spacing="10">
                <FontIcon Glyph="&#xE9A9;" HorizontalAlignment="Center" Margin="0,0,0,10" FontSize="48" />
                <TextBlock x:Uid="TextBlockNoVisualVoiceMailTitle" Text="XX No Visual Voice Mail found!" Style="{ThemeResource TitleTextBlockStyle}" TextAlignment="Center" TextWrapping="Wrap" />
                <TextBlock x:Name="TextBlockNoVoiceMailDescription" Text="XX --" TextWrapping="Wrap" Margin="0,10,0,0" />
                <HyperlinkButton x:Uid="ButtonViewVisualVoiceMailNetworks" Content="XX Click here to view networks that support Visual Voice Mail..." HorizontalAlignment="Center" Margin="0,20,0,0" NavigateUri="https://support.apple.com/en-gb/HT204039" />
            </StackPanel>
        </Grid>
    </Grid>
</featurebase:FeaturePage>
