Files
NebulaLauncher/Nebula.Launcher/Views/ServerEntryView.axaml
2025-01-22 21:06:05 +03:00

190 lines
8.2 KiB
XML

<UserControl
d:DesignHeight="300"
d:DesignWidth="800"
mc:Ignorable="d"
x:Class="Nebula.Launcher.Views.ServerEntryView"
x:DataType="viewModels:ServerEntryModelView"
xmlns="https://github.com/avaloniaui"
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
xmlns:converters="clr-namespace:Nebula.Launcher.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:viewModels="clr-namespace:Nebula.Launcher.ViewModels"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.DataContext>
<viewModels:ServerEntryModelView />
</Design.DataContext>
<Border
Background="Transparent"
BorderThickness="3,1,0,1"
BorderBrush="{StaticResource DefaultForeground}"
CornerRadius="10"
Margin="5">
<Grid ColumnDefinitions="*,80,50" RowDefinitions="35,*,*">
<Border
BorderBrush="{StaticResource DefaultForeground}"
Background="#00000000"
BorderThickness="0,0,0,2"
CornerRadius="10"
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="0"
IsVisible="{Binding ExpandInfo}" />
<Button
Background="#00000000"
Command="{Binding ExpandInfoRequired}"
Grid.Column="0"
Grid.Row="0"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<ScrollViewer
HorizontalScrollBarVisibility="Hidden"
Margin="10,0,0,0"
VerticalScrollBarVisibility="Disabled"
x:Name="AutoScrollViewer">
<Label VerticalAlignment="Center">
<TextBlock Text="{Binding ServerHubInfo.StatusData.Name}" />
</Label>
</ScrollViewer>
</Button>
<StackPanel
Grid.Column="1"
Grid.Row="0"
HorizontalAlignment="Center"
Orientation="Horizontal"
VerticalAlignment="Center">
<Label>
<TextBlock Text="{Binding ServerHubInfo.StatusData.Players}" />
</Label>
<Label>/</Label>
<Label>
<TextBlock Text="{Binding ServerHubInfo.StatusData.SoftMaxPlayers}" />
</Label>
</StackPanel>
<Panel
Grid.Column="2"
Grid.Row="0"
Margin="5,0,0,0">
<Button
Command="{Binding RunInstance}"
CornerRadius="10,10,10,10"
HorizontalAlignment="Stretch"
IsVisible="{Binding RunVisible}"
VerticalAlignment="Stretch">
<Svg Margin="4" Path="/Assets/svg/play.svg" />
</Button>
<Grid ColumnDefinitions="*" IsVisible="{Binding !RunVisible}">
<Button
Command="{Binding ReadLog}"
CornerRadius="10"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Svg Margin="4" Path="/Assets/svg/newspaper.svg" />
</Button>
</Grid>
</Panel>
<Label FontSize="12" Grid.Column="0" HorizontalAlignment="Left"
Grid.ColumnSpan="2"
Grid.Row="1"
IsVisible="{Binding ExpandInfo}"
Margin="15">
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" />
</Label>
<Border
BorderBrush="{StaticResource DefaultForeground}"
Background="Transparent"
BorderThickness="0,2,0,0"
CornerRadius="10"
Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="2"
IsVisible="{Binding ExpandInfo}"
Margin="5,15,15,5">
<StackPanel Margin="5" Spacing="5">
<StackPanel Orientation="Horizontal">
<Label FontSize="10" VerticalAlignment="Center">Tags:</Label>
<ItemsControl ItemsSource="{Binding Tags}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type system:String}">
<Border
Background="{StaticResource DefaultForeground}"
CornerRadius="8"
BorderThickness="0"
HorizontalAlignment="Center"
Margin="1,1,1,1"
VerticalAlignment="Center">
<Label FontSize="10" Margin="5,0,5,0">
<TextBlock Text="{Binding}" />
</Label>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Margin="5"
HorizontalAlignment="Left"
Orientation="Horizontal"
VerticalAlignment="Center" Spacing="8"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<Label FontSize="10" VerticalAlignment="Center">Map:</Label>
<Border
Background="{StaticResource DefaultForeground}"
CornerRadius="8"
BorderThickness="0"
HorizontalAlignment="Center"
Margin="5"
VerticalAlignment="Center">
<Label FontSize="10" Margin="5,0,5,0">
<TextBlock Text="{Binding ServerHubInfo.StatusData.Map}" />
</Label>
</Border>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label FontSize="10" VerticalAlignment="Center">Preset:</Label>
<Border
Background="{StaticResource DefaultForeground}"
CornerRadius="8"
BorderThickness="0"
HorizontalAlignment="Center"
Margin="5"
VerticalAlignment="Center">
<Label FontSize="10" Margin="5,0,5,0">
<TextBlock Text="{Binding ServerHubInfo.StatusData.Preset}" />
</Label>
</Border>
</StackPanel>
</StackPanel>
</Border>
<StackPanel
Grid.Column="2"
Grid.Row="1"
IsVisible="{Binding ExpandInfo}"
Margin="5,5,0,0"
Spacing="5">
<Button
Command="{Binding StopInstance}"
CornerRadius="10"
Height="35"
HorizontalAlignment="Stretch"
IsVisible="{Binding !RunVisible}"
VerticalAlignment="Stretch">
<Svg Margin="4" Path="/Assets/svg/stop.svg" />
</Button>
</StackPanel>
</Grid>
</Border>
</UserControl>