<Window
    x:Class="Translumo.MVVM.Views.ChatWindowView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
    xmlns:common="clr-namespace:Translumo.MVVM.Common"
    xmlns:controls="clr-namespace:Translumo.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:tb="http://www.hardcodet.net/taskbar"
    Title="{StaticResource ApplicationName}"
    Width="550"
    Height="250"
    HorizontalAlignment="Stretch"
    VerticalAlignment="Stretch"
    Activated="Window_Activated"
    AllowsTransparency="True"
    BorderThickness="0"
    Deactivated="Window_Deactivated"
    ResizeMode="CanResizeWithGrip"
    ShowInTaskbar="False"
    SourceInitialized="Window_SourceInitialized"
    Visibility="{Binding ChatWindowIsVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}"
    WindowStyle="None"
    mc:Ignorable="d">
    <Window.Resources>
        <SolidColorBrush x:Key="brushFontColor" Color="{Binding Model.Configuration.FontColor}" />
        <common:BoldFontConverter x:Key="boldFontConverter" />
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
    </Window.Resources>
    <Window.Background>
        <SolidColorBrush Opacity="{Binding Model.Configuration.BackgroundOpacity}" Color="{Binding Model.Configuration.BackgroundColor}" />
    </Window.Background>
    <b:Interaction.Triggers>
        <b:EventTrigger EventName="Loaded">
            <b:InvokeCommandAction Command="{Binding LoadedCommand}" />
        </b:EventTrigger>
    </b:Interaction.Triggers>

    <Grid>
        <controls:TrayControl ChatOpeningCommand="{Binding ShowHideChatCommand}" SettingsOpeningCommand="{Binding ShowHideSettingsCommand}" />
        <RichTextBox
            x:Name="rtbChat"
            Padding="10"
            Background="#03000000"
            BorderThickness="0,0,0,0"
            Focusable="false"
            FontSize="15"
            IsReadOnly="True"
            MouseDown="rtbChat_MouseDown">
            <FlowDocument />
        </RichTextBox>
        <TextBlock
            Name="fontTextBlockInstance"
            LineHeight="{Binding Model.Configuration.LineSpacing}"
            TextAlignment="{Binding Model.Configuration.TextAlignment}"
            Visibility="Collapsed">
            <Run
                Name="fontRunInstance"
                FontSize="{Binding Model.Configuration.FontSize}"
                FontWeight="{Binding Model.Configuration.FontBold, Converter={StaticResource boldFontConverter}}"
                Foreground="{StaticResource brushFontColor}" />
            <Run
                Name="fontRunErrorInstance"
                FontSize="14"
                Foreground="{StaticResource ErrorBrush}" />
            <Run
                Name="fontRunInfoInstance"
                FontSize="14"
                FontStyle="Italic"
                Foreground="{StaticResource PrimaryHueMidBrush}" />
        </TextBlock>
    </Grid>
</Window>
