<!--
    Software-Disclaimer Deutsch

    Bezeichnung/Dateiname (mit Version): Demo2 (1.4.0)
    Funktion: Die hiervorliegende Software soll in einfacher Form die Funktionsweise und Umgang mit einem OPC-Server inkl. Turck RFID HF/UHF erklären.

    Die hier vorliegende Software wird unentgeltlich und nur in dem verfügbaren Zustand bereitgestellt.
    Jedwede Haftung ist auf Fälle von Vorsatz und grober Fahrlässigkeit beschränkt. TURCK übernimmt keinerlei Gewährleistung, insbesondere nicht für Eignung und Funktionsfähigkeit. Die Software darf nur für die jeweils vorgesehene Hardware verwendet werden. Sie ist ausschließlich von Fachpersonal mit entsprechender Ausbildung einzusetzen.
    Die Anwender sind für den sachgemäßen Betrieb sowie für die Einhaltung aller geltenden Normen und Vorschriften selbst verantwortlich.
    Ergänzend gelten die Bedingungen der Softwareklausel zur Überlassung von Standard-Software als Teil von Lieferungen des ZVEI e.V. sowie die Allgemeine Lieferbedingungen für Erzeugnisse und Leistungen der Elektroindustrie des ZVEI e.V. (verfügbar unter www.turck.com/agb).

    Software-Disclaimer English

    Description/filename (with version): Demo2 (1.4.0)
    Function: This software should explain in a simple way how an OPC server including Turck RFID HF/UHF works and how to use it.

    The software available here is provided free of charge and only "as is".
    Any liability is limited to cases of intent and gross negligence. TURCK does not assume any warranty, especially not for suitability and functionality. The software may only be used for the provided hardware. It is to be used exclusively by qualified personnel with appropriate professional training.
    Each user is responsible for proper handling and compliance with all applicable standards and regulations.
    In addition, the Software Clause for the Provision of Standard Software as Part of Supplies of the ZVEI e.V. and the General Conditions for the Supply of Products and Services of the Electrical and Electronics Industry of the ZVEI (available at www.turck.com/agb) shall apply.
-->
<Window
    x:Class="Demo2.View.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converter="clr-namespace:DemoLib.Converter;assembly=DemoLib"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:loading="clr-namespace:LoadingIndicators.WPF;assembly=LoadingIndicators.WPF"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewModel="clr-namespace:Demo2.ViewModel"
    Title="OPC UA Client Demo V1.4.0 - Notifications about scan events"
    Width="530"
    Height="230"
    Icon="/DemoLib;Component/Ressource/Logo.ico"
    mc:Ignorable="d">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingWave.xaml" />
                <ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingThreeDots.xaml" />
                <ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingFlipPlane.xaml" />
                <ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingPulse.xaml" />
                <ResourceDictionary Source="pack://application:,,,/LoadingIndicators.WPF;component/Styles/LoadingDoubleBounce.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <converter:InvertBoolConverter x:Key="InvertBoolConverter" />
            <converter:BooleanToVisibilityConverter
                x:Key="VisibilityConverter"
                FalseState="Collapsed"
                TrueState="Visible" />
        </ResourceDictionary>
    </Window.Resources>
    <Window.DataContext>
        <viewModel:MainViewModel />
    </Window.DataContext>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Background="#FFFFCC00">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Image
                Grid.Column="1"
                Height="40"
                Source="/DemoLib;Component/Ressource/Turck-Stand alone_2015_RGB.jpg" />
        </Grid>
        <Grid Margin="5" Row="1">
            <StackPanel Orientation="Horizontal">
                <TextBlock
                    Width="50"
                    VerticalAlignment="Center"
                    Text="Server: "
                    TextAlignment="Right" />
                <TextBox
                    Width="150"
                    IsEnabled="{Binding Connected, Converter={StaticResource InvertBoolConverter}}"
                    Text="{Binding Server, UpdateSourceTrigger=PropertyChanged}" />
                <TextBlock
                    Width="50"
                    VerticalAlignment="Center"
                    Text="Port: "
                    TextAlignment="Right" />
                <TextBox
                    Width="80"
                    IsEnabled="{Binding Connected, Converter={StaticResource InvertBoolConverter}}"
                    Text="{Binding Port, UpdateSourceTrigger=PropertyChanged}" />
                <Button
                    Width="80"
                    Margin="5,0"
                    Command="{Binding ConnectCommand}"
                    Content="Connect" />
                <Button
                    Width="80"
                    Command="{Binding DisconnectCommand}"
                    Content="Disconnect" />
            </StackPanel>
        </Grid>
        <StackPanel
            Grid.Row="2"
            Margin="5"
            Orientation="Horizontal">
            <TextBlock
                Width="50"
                VerticalAlignment="Center"
                Text="Reader: "
                TextAlignment="Right" />
            <ComboBox
                Width="195"
                IsEnabled="{Binding Connected}"
                ItemsSource="{Binding ReaderList}"
                SelectedItem="{Binding SelectedReader}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Ident}" />
                            <TextBlock
                                Margin="5,0"
                                Foreground="Gray"
                                Text="{Binding Type}" />
                            <TextBlock Foreground="Gray" Text="{Binding Name, StringFormat={} Name: {0}}" />
                        </StackPanel>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <Button
                Width="80"
                Margin="5,0,0,0"
                Command="{Binding RefreshReaderListCommand}"
                Content="Refresh" />
            <Rectangle
                Width="1"
                Margin="3,2"
                VerticalAlignment="Stretch"
                Stroke="#FFA0A0A0" />
            <Button
                Width="80"
                Command="{Binding ScanStartCommand}"
                Content="Scan start" />
            <Button
                Width="80"
                Margin="5,0"
                Command="{Binding ScanStopCommand}"
                Content="Scan stop" />
        </StackPanel>
        <StackPanel
            Grid.Row="3"
            Margin="5"
            Orientation="Vertical">
            <TextBlock Margin="50,0" Text="{Binding DeviceStatus, StringFormat={}DeviceStatus: {0}}" />
            <StackPanel Margin="0,5" Orientation="Horizontal">
                <TextBlock Margin="50,0,0,0" Text="Last found tag: " />
                <TextBlock Text="{Binding FoundTag.Timestamp}" />
                <TextBlock Margin="5,0" Text="{Binding FoundTag.IdentiferString, StringFormat={}Tag: {0}}" />
            </StackPanel>
            <TextBlock Margin="50,0" Text="{Binding FoundTagAntenna, StringFormat={}Antenna: {0}}" />
            <TextBlock Margin="50,0" Text="{Binding FoundTagRssi, StringFormat={}Rssi: {0}}" />
        </StackPanel>
        <Grid
            Margin="5"
            Background="White"
            Opacity="0.5"
            Row="2"
            RowSpan="2"
            Visibility="{Binding RunningConnect, Converter={StaticResource VisibilityConverter}}">
            <loading:LoadingIndicator
                Width="100"
                Height="100"
                IsActive="true"
                SnapsToDevicePixels="True"
                Style="{DynamicResource LoadingIndicatorThreeDotsStyleKey}" />
        </Grid>
    </Grid>
</Window>