<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
    x:Class="was.droidtransfer.features.messaging.ux.MessageContentAudioDataTemplate"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:was.droidtransfer.features.messaging.ux"
    xmlns:data="using:was.droidtransfer.features.messaging.data"
    xmlns:featurebase="using:was.droidtransfer.features.controls"
    xmlns:converters="using:was.droidtransfer.features.messaging.converters"
    xmlns:commonConverters="using:was.droidtransfer.features.converters">
    <converters:MessageContentToIsSupportedConverter x:Key="MessageContentToIsSupportedConverter" />
    <converters:MessageContentToUnsupportedTextConverter x:Key="MessageContentToUnsupportedTextConverter" />
    <commonConverters:ValueToVisibilityConverter x:Key="ValueToVisibilityConverter" />
    <DataTemplate x:Key="MessageContentAudioDataTemplate" x:DataType="data:IMessageContent">
        <Grid Padding="0" CornerRadius="6">
            <Grid Visibility="{Binding Converter={StaticResource MessageContentToIsSupportedConverter}}" Width="400" Height="100">
                <Grid PointerEntered="_grid_PointerEntered" PointerExited="_grid_PointerExited" Padding="0" Width="400" MaxWidth="400" Visibility="{Binding FilePath, ElementName=audioFileViewer, Converter={StaticResource ValueToVisibilityConverter}}">
                    <featurebase:AudioFileViewerUserControl x:Name="audioFileViewer" DataContextChanged="_audioFileViewerControl_DataContextChanged"  Width="400" Height="100" Loaded="_audioFileViewerControl_Loaded" Unloaded="_audioFileViewerControl_Unoaded">
                        <featurebase:AudioFileViewerUserControl.ContextFlyout>
                            <MenuFlyout>
                                <MenuFlyoutItem x:Uid="MenuFlyoutSaveToPC" Text="Save to PC" Click="_saveToPC_Click" Tag="{x:Bind}">
                                    <MenuFlyoutItem.Icon>
                                        <FontIcon Glyph="&#xE78C;"/>
                                    </MenuFlyoutItem.Icon>
                                </MenuFlyoutItem>
                            </MenuFlyout>
                        </featurebase:AudioFileViewerUserControl.ContextFlyout>
                    </featurebase:AudioFileViewerUserControl>
                    <Border x:Name="borderControls" Visibility="Collapsed" HorizontalAlignment="Right" VerticalAlignment="Top" Background="{ThemeResource TextFillColorInverse}" Padding="3" Margin="10,10,10,10" CornerRadius="6">
                        <StackPanel Orientation="Horizontal">
                            <Button Click="_saveToPCButton_Click" BorderThickness="0" Background="Transparent" CornerRadius="4,0,0,4" Foreground="{ThemeResource TextFillColorPrimary}" Tag="{x:Bind}">
                                <FontIcon Glyph="&#xE78C;" />
                                <ToolTipService.ToolTip>
                                    <ToolTip x:Uid="SaveToPCToolTip" Content="Save to PC" />
                                </ToolTipService.ToolTip>
                            </Button>
                        </StackPanel>
                    </Border>
                </Grid>
                <Border x:Name="borderPlaceholder" Background="#FF000000" Visibility="{Binding FilePath, ElementName=audioFileViewer, Converter={StaticResource ValueToVisibilityConverter}, ConverterParameter='invert'}" Height="250" VerticalAlignment="Top" Width="400"  Loaded="_borderPlaceholder_Loaded" Unloaded="_borderPlaceholder_Unloaded"/>
            </Grid>
            <Border BorderThickness="4,0,0,0" BorderBrush="{ThemeResource SystemErrorTextColor}" HorizontalAlignment="Stretch" Padding="8,2,4,8" Background="{ThemeResource TextFillColorInverseBrush}" CornerRadius="0,4,4,0" Visibility="{Binding Converter={StaticResource MessageContentToIsSupportedConverter}, ConverterParameter='invert'}" Margin="0,0,0,4">
                <StackPanel Spacing="5">
                    <TextBlock Style="{ThemeResource BodyStrongTextBlockStyle}" Text="{Binding Converter={StaticResource MessageContentToUnsupportedTextConverter}}" Padding="0" Margin="0" Foreground="{ThemeResource SystemErrorTextColor}" />
                    <TextBlock x:Uid="TextBlockUnsupportedAudioDescription" TextWrapping="Wrap" Text="XX This audio format cannot be previewed but can be saved to your PC." Padding="0" Margin="0" />
                    <Button x:Uid="ButtonUnsupportedSaveToPC" Margin="0,10,0,0" Content="XX Save to PC" Click="_saveToPCButton_Click" />
                </StackPanel>
            </Border>
        </Grid>
    </DataTemplate>
</ResourceDictionary>
