112 lines
5.4 KiB
XML
112 lines
5.4 KiB
XML
<UserControl xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="using:LANCommander.Launcher.ViewModels"
|
|
xmlns:models="using:LANCommander.Launcher.Models"
|
|
xmlns:svg="using:Avalonia.Svg.Skia"
|
|
x:Class="LANCommander.Launcher.Views.ServerSelectionView"
|
|
x:DataType="vm:ServerSelectionViewModel">
|
|
<Grid>
|
|
<Image x:Name="BackgroundImage" Stretch="UniformToFill" />
|
|
|
|
<Border Background="#AA000000" />
|
|
|
|
<Border Padding="40" VerticalAlignment="Center" HorizontalAlignment="Center">
|
|
<StackPanel Spacing="20" Width="400" VerticalAlignment="Center">
|
|
<svg:Svg Path="/Assets/logo.svg"
|
|
Width="350"
|
|
HorizontalAlignment="Center" />
|
|
|
|
<StackPanel Spacing="8" Margin="0,20,0,20">
|
|
<TextBlock Text="Server Address" FontWeight="SemiBold" />
|
|
<TextBox x:Name="ServerAddressTextBox"
|
|
Classes="Glass"
|
|
Watermark="e.g., 192.168.1.100:5000 or lancommander.local"
|
|
Text="{Binding ServerAddress}"
|
|
IsEnabled="{Binding !IsLoading}">
|
|
<TextBox.KeyBindings>
|
|
<KeyBinding Gesture="Return" Command="{Binding ConnectCommand}" />
|
|
</TextBox.KeyBindings>
|
|
</TextBox>
|
|
</StackPanel>
|
|
|
|
<Button Command="{Binding ConnectCommand}"
|
|
HorizontalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
Classes="Primary"
|
|
Padding="12"
|
|
IsEnabled="{Binding !IsLoading}">
|
|
<Panel>
|
|
<TextBlock Text="Connect" IsVisible="{Binding !IsLoading}" />
|
|
<TextBlock Text="Connecting..." IsVisible="{Binding IsLoading}" />
|
|
</Panel>
|
|
</Button>
|
|
|
|
<StackPanel HorizontalAlignment="Center" Spacing="12" IsVisible="{Binding IsLoading}">
|
|
<ProgressBar IsIndeterminate="True"
|
|
Width="200"
|
|
Height="4" />
|
|
<TextBlock Text="{Binding StatusMessage}"
|
|
Foreground="White"
|
|
Opacity="0.75"
|
|
FontSize="12"
|
|
HorizontalAlignment="Center" />
|
|
</StackPanel>
|
|
|
|
<TextBlock Text="{Binding StatusMessage}"
|
|
IsVisible="{Binding HasError}"
|
|
Foreground="#FF6B6B"
|
|
FontSize="12"
|
|
TextWrapping="Wrap"
|
|
HorizontalAlignment="Center" />
|
|
|
|
<!-- Discovered Servers -->
|
|
<Border BorderBrush="White" BorderThickness="0,1,0,0" Opacity="0.3" Margin="0,4,0,0" />
|
|
|
|
<TextBlock Text="Discovered Servers"
|
|
HorizontalAlignment="Center"
|
|
Opacity="0.6"
|
|
FontSize="12" />
|
|
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="8"
|
|
IsVisible="{Binding IsScanning}">
|
|
<ProgressBar IsIndeterminate="True" Width="40" Height="3"
|
|
VerticalAlignment="Center" />
|
|
<Button Command="{Binding CancelScanCommand}"
|
|
Classes="Text"
|
|
Padding="4,2"
|
|
VerticalAlignment="Center">
|
|
<TextBlock Text="×" FontSize="16" />
|
|
</Button>
|
|
</StackPanel>
|
|
|
|
<ItemsControl ItemsSource="{Binding DiscoveredServers}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate x:DataType="models:DiscoveredServer">
|
|
<Button Command="{Binding $parent[ItemsControl].((vm:ServerSelectionViewModel)DataContext).SelectServerCommand}"
|
|
CommandParameter="{Binding}"
|
|
HorizontalAlignment="Stretch"
|
|
HorizontalContentAlignment="Stretch"
|
|
Padding="12,8"
|
|
Margin="0,2"
|
|
Classes="Glass">
|
|
<StackPanel>
|
|
<TextBlock Text="{Binding Name}" FontWeight="SemiBold" />
|
|
<TextBlock Text="{Binding Address}" FontSize="12" Opacity="0.6" />
|
|
</StackPanel>
|
|
</Button>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
|
|
<Button Command="{Binding ScanCommand}"
|
|
IsVisible="{Binding !IsScanning}"
|
|
Padding="12,6"
|
|
HorizontalAlignment="Center"
|
|
HorizontalContentAlignment="Center"
|
|
Classes="Glass">
|
|
<TextBlock Text="Rescan" />
|
|
</Button>
|
|
</StackPanel>
|
|
</Border>
|
|
</Grid>
|
|
</UserControl>
|