2025-01-20 14:05:21 -06:00

185 lines
9.8 KiB
XML

<UserControl x:Class="Breath_of_the_Wild_Multiplayer.MVVM.View.ServerBrowser"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Breath_of_the_Wild_Multiplayer.MVVM.View"
xmlns:viewModel="clr-namespace:Breath_of_the_Wild_Multiplayer.MVVM.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<viewModel:ServerBrowserModel/>
</UserControl.DataContext>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.50*"/>
<ColumnDefinition Width="0.50*"/>
</Grid.ColumnDefinitions>
<Path Grid.ColumnSpan="2" Stroke="#55FFFFFF" StrokeThickness="2" Panel.ZIndex="1">
<Path.Data>
<GeometryGroup>
<LineGeometry StartPoint="-500,1" EndPoint="2000,1"/>
<LineGeometry StartPoint="-500,496" EndPoint="2000,496"/>
</GeometryGroup>
</Path.Data>
</Path>
<Grid Grid.Column="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="8*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">
<Button Content="Add Server" Style="{StaticResource ConnectionButtons}" Command="{Binding addServerClick}">
<Button.Tag>
<BitmapImage UriSource="/Images/AddServer_Icon.png"/>
</Button.Tag>
</Button>
<Button Content="Direct IP" Style="{StaticResource ConnectionButtons}" Command="{Binding directConnectClick}">
<Button.Tag>
<BitmapImage UriSource="/Images/DirectConnection_Icon.png"/>
</Button.Tag>
</Button>
<Button Content="Refresh" Style="{StaticResource ConnectionButtons}" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ServerBrowser}}, Path=DataContext.refreshClick}">
<Button.Tag>
<BitmapImage UriSource="/Images/Refresh_Icon.png"/>
</Button.Tag>
</Button>
</StackPanel>
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Hidden" Style="{StaticResource Scroll}" Tag="{Binding scrollState, Mode=TwoWay}" ScrollChanged="ScrollViewer_ScrollChanged">
<ItemsControl Name="serverList" ItemsSource="{Binding serversToShow}" Background="Transparent">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Margin="15, 5, 15, 5"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button
Style="{StaticResource ServerButton}"
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ServerBrowser}}, Path=DataContext.serverButtonClick}"
CommandParameter="{Binding serverIndex}">
<Button.InputBindings>
<MouseBinding
Gesture="RightClick"
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ServerBrowser}}, Path=DataContext.serverButtonClick}"
CommandParameter="{Binding serverIndex}"/>
</Button.InputBindings>
<Button.ContextMenu>
<ContextMenu Style="{StaticResource ServerContextMenu}">
<MenuItem Header="Edit server"
FontFamily="Roboto"
FontSize="20"
Style="{StaticResource ServerContextMenuItemUpper}"
Click="EditClick"/>
<MenuItem Header="Remove server"
FontFamily="Roboto"
FontSize="20"
Style="{StaticResource ServerContextMenuItemLower}"
Click="RemoveClick"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>
<Border Grid.Column="1" Background="#99000000" Margin="10,10,0,10" CornerRadius="3, 0, 0, 3">
<Border Margin="3, 3, 0, 3" Background="Transparent" BorderBrush="#FF626262" BorderThickness="2, 2, 0, 2" CornerRadius="3, 0, 0, 3">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="85"/>
<RowDefinition Height="6*"/>
<RowDefinition Height="157*"/>
<RowDefinition Height="80"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical">
<Label Content="{Binding selectedServer[0].Name}"
Foreground="White"
FontFamily="Roboto"
FontStyle="Italic"
FontWeight="Bold"
FontSize="36"/>
<Rectangle Height="1" Fill="#CC8C8C8C" Visibility="{Binding selectedServer[0].visible}"/>
<DockPanel>
<Label Content="{Binding selectedServer[0].questGiver}"
Foreground="#FF8C8C8C"
FontFamily="Roboto"
FontStyle="Italic"
FontSize="16"
Visibility="{Binding selectedServer[0].visible}"/>
<Label Content="{Binding selectedServer[0].pingData}"
Foreground="{Binding selectedServer[0].pingColor}"
FontFamily="Roboto"
FontStyle="Italic"
FontSize="16"
HorizontalContentAlignment="Right"
Visibility="{Binding selectedServer[0].visible}"/>
</DockPanel>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Vertical" Grid.RowSpan="2">
<TextBlock Text="{Binding selectedServer[0].description}"
Foreground="White"
FontFamily="Roboto"
FontStyle="Italic"
TextWrapping="Wrap"
FontSize="24"
Margin="5"
MaxHeight="150"/>
<StackPanel Orientation="Horizontal" Margin="0,2,0,2">
<Label Content="Gamemode:"
Foreground="White"
FontFamily="Roboto"
FontStyle="Italic"
FontSize="22">
<Label.Style>
<Style TargetType="Label">
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
<DataTrigger Binding="{Binding selectedServer[0].open}" Value="false">
<Setter Property="Visibility" Value="Hidden"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
<Label Content="{Binding selectedServer[0].playStyle}"
Foreground="#FF467DE3"
FontFamily="Roboto"
FontStyle="Italic"
FontSize="22"/>
</StackPanel>
</StackPanel>
<Button
Content="{Binding selectedServer[0].connectMessage}"
Grid.Row="3"
Margin="10"
Style="{StaticResource ConnectToServerButton}"
Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ServerBrowser}}, Path=DataContext.connectClick}"
Visibility="{Binding selectedServer[0].visible}"/>
</Grid>
</Border>
</Border>
</Grid>
</UserControl>