﻿<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiModelTester.MainPage" BackgroundColor="Black">

    <ScrollView x:Name="MainScrollView" Margin="10">
        <Grid RowSpacing="10" ColumnSpacing="0">

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Label Grid.Row="0"
                Text="ONNX Runtime Mobile Model Tester"
                FontSize="Header"
                TextColor="DeepSkyBlue"             
                HorizontalOptions="Center" />

            <Grid Grid.Row="1" ColumnSpacing="10">
                <!-- Run params. EP and iterations currently-->
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"  />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Label Grid.Row="0" Grid.Column="0" Text="Execution Provider" 
                       TextColor="White" VerticalOptions="Center"/>
                <Picker Grid.Row="0" Grid.Column="1" x:Name="ExecutionProviderOptions" 
                        TextColor="White" Margin="5,5,5,5"/>
                
                <Label Grid.Row="1" Grid.Column="0" Text="Iterations" TextColor="White" VerticalOptions="Center"/>
                <Entry Grid.Row="1" Grid.Column="1" x:Name="Iterations" Text="10" TextColor="White"/>
            </Grid>

            <Button Grid.Row="2" 
                    x:Name="RunButton" Text="Run"
                    FontSize="Large"
                    TextColor="White"
                    BackgroundColor="DeepSkyBlue"
                    SemanticProperties.Hint="Runs the model the requested number of times."
                    Clicked="OnRunClicked"
                    HorizontalOptions="Center" />

            <Label Grid.Row="3" Text="Performance test results" TextColor="White" FontAttributes="Bold" />

            <ActivityIndicator Grid.Row="4" x:Name="BusyIndicator" IsRunning="False" Color="Orange" />

            <ScrollView Grid.Row="4" x:Name="TestResultsView" Margin="10">
                <StackLayout x:Name="TestResults">
                    <Label Text="Results will be displayed after the model is run." TextColor="GhostWhite" />
                </StackLayout>
            </ScrollView>

        </Grid>
    </ScrollView>

</ContentPage>
