Files
Beyhan Oğur d5f52cc3d3 first commit
2026-09-03 04:45:36 +03:00

119 lines
7.6 KiB
XML

<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:properties="clr-namespace:ClassicAssist.Launcher.Properties"
xmlns:launcher="clr-namespace:ClassicAssist.Launcher"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:behaviours="clr-namespace:ClassicAssist.Launcher.Behaviours"
xmlns:ValueConverters="clr-namespace:ClassicAssist.Launcher.ValueConverters"
xmlns:controls="clr-namespace:ClassicAssist.Launcher.Controls"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
x:Class="ClassicAssist.Launcher.ShardsWindow"
mc:Ignorable="d"
Title="{x:Static properties:Resources.Shards}" Height="400" Width="620" WindowStartupLocation="CenterScreen">
<Window.Resources>
<ValueConverters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
<ValueConverters:BooleanToOpacityValueConverter x:Key="BooleanToOpacityValueConverter" />
<ValueConverters:CellWidthValueConverter x:Key="CellWidthValueConverter" />
</Window.Resources>
<Window.DataContext>
<launcher:ShardsViewModel />
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ToolBar Grid.Row="0" Style="{DynamicResource ToolBarStyle1}">
<Button Height="24" Margin="0,0,5,0" Command="{Binding AddCommand, Mode=OneWay}">
<Image Source="{StaticResource AddIcon}" ToolTip="{x:Static properties:Resources.Add}"
Opacity="{Binding IsEnabled, Converter={StaticResource BooleanToOpacityValueConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" />
</Button>
<Button Height="24" Margin="0,0,5,0" Command="{Binding RemoveCommand, Mode=OneWay}"
CommandParameter="{Binding SelectedShard}">
<Image Source="{StaticResource RemoveIcon}" ToolTip="{x:Static properties:Resources.Remove}"
Opacity="{Binding IsEnabled, Converter={StaticResource BooleanToOpacityValueConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" />
</Button>
<Button Height="24" Command="{Binding RefreshCommand}" CommandParameter="{Binding SelectedShard}">
<Image Source="{StaticResource RefreshIcon}" ToolTip="{x:Static properties:Resources.Refresh}"
Opacity="{Binding IsEnabled, Converter={StaticResource BooleanToOpacityValueConverter}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}" />
</Button>
</ToolBar>
<ListView ItemsSource="{Binding Shards}" Grid.Row="1" SelectedItem="{Binding SelectedShard}" Margin="10">
<ListView.View>
<GridView>
<GridViewColumn Header="{x:Static properties:Resources.Shard}" Width="150" x:Name="NameColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<controls:EditTextBlock
Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
CanEdit="{Binding IsPreset, Converter={StaticResource InverseBooleanConverter}}"
Width="{Binding ActualWidth, ElementName=NameColumn, Converter={StaticResource CellWidthValueConverter}}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="{x:Static properties:Resources.Address}" Width="150" x:Name="AddressColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<controls:EditTextBlock
Text="{Binding Address, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
CanEdit="{Binding IsPreset, Converter={StaticResource InverseBooleanConverter}}"
Width="{Binding ActualWidth, ElementName=AddressColumn, Converter={StaticResource CellWidthValueConverter}}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="{x:Static properties:Resources.Port}" Width="50" x:Name="PortColumn">
<GridViewColumn.CellTemplate>
<DataTemplate>
<controls:EditTextBlock
Text="{Binding Port, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
CanEdit="{Binding IsPreset, Converter={StaticResource InverseBooleanConverter}}"
Width="{Binding ActualWidth, ElementName=PortColumn, Converter={StaticResource CellWidthValueConverter}}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="{x:Static properties:Resources.Encryption}" Width="75">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Encryption}"
IsEnabled="{Binding IsPreset, Converter={StaticResource InverseBooleanConverter}}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="{x:Static properties:Resources.Players}" Width="75"
DisplayMemberBinding="{Binding Status}" />
<GridViewColumn Header="{x:Static properties:Resources.Ping}" Width="50"
DisplayMemberBinding="{Binding Ping}" />
</GridView>
</ListView.View>
</ListView>
<TextBlock Grid.Row="2" Margin="10,0">
<Hyperlink NavigateUri="https://github.com/Reetus/ClassicAssist/issues"
RequestNavigate="Hyperlink_RequestNavigate">
<Run Text="{x:Static properties:Resources.Open_a_GitHub_issue_to_have_your_shard_added_to_the_list_}" />
</Hyperlink>
</TextBlock>
<StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right" Margin="0,0,10,10">
<StackPanel.Resources>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Padding" Value="15,0,15,0" />
</Style>
</StackPanel.Resources>
<Button Content="{x:Static properties:Resources.OK}" Margin="0,0,10,0"
Command="{Binding OKCommand, Mode=OneWay}">
<i:Interaction.Behaviors>
<behaviours:CloseOnClickBehaviour />
</i:Interaction.Behaviors>
</Button>
<Button Content="{x:Static properties:Resources.Cancel}" Command="{Binding CancelCommand, Mode=OneWay}">
<i:Interaction.Behaviors>
<behaviours:CloseOnClickBehaviour />
</i:Interaction.Behaviors>
</Button>
</StackPanel>
</Grid>
</Window>