<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="Borepin.View.ConnectionStateView"
             xmlns:converters="clr-namespace:Borepin.Converter"
             xmlns:resource_text="clr-namespace:Borepin.Resources.Text">
    <ContentView.Resources>
        <ResourceDictionary>
            <converters:AllTrueBoolConverter x:Key="AllTrueBoolConverter"/>
            <converters:InvertBoolConverter x:Key="InvertBoolConverter"/>
        </ResourceDictionary>
    </ContentView.Resources>
    <ContentView.Content>
        <StackLayout>
            <StackLayout IsVisible="{Binding IsBusy}">
                <ActivityIndicator IsRunning="{Binding IsBusy}"></ActivityIndicator>
            </StackLayout>

            <StackLayout>
                <StackLayout.IsVisible>
                    <MultiBinding Converter="{StaticResource AllTrueBoolConverter}">
                        <Binding Path="IsBusy" Converter="{StaticResource InvertBoolConverter}"/>
                        <Binding Path="IsConnected" Converter="{StaticResource InvertBoolConverter}"/>
                    </MultiBinding>
                </StackLayout.IsVisible>
                <Label Text="{x:Static resource_text:TextResource.ConnectionStatus_NoConnection}"/>
                <Label Text="{x:Static resource_text:TextResource.ConnectionStatus_Connecting}" IsVisible="{Binding IsConnecting}"/>
                <Label Text="{x:Static resource_text:TextResource.ConnectionStatus_NotConnected}" IsVisible="{Binding IsConnecting, Converter={StaticResource InvertBoolConverter}}"/>
            </StackLayout>
        </StackLayout>
    </ContentView.Content>
</ContentView>