Files

204 lines
10 KiB
XML
Raw Permalink Normal View History

2026-08-27 11:23:13 -06:00
<Window x:Class="Raton.RatonForms.BlockWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Loaded="Window_Loaded" Closing="Window_Closing" Title="Block connections" Height="411.368"
Width="340" Background="#FF202020" WindowStartupLocation="CenterOwner" ResizeMode="NoResize"
Icon="/Raton;component/RATA.ico">
<FrameworkElement.Resources>
<Style x:Key="DarkTextBox" TargetType="{x:Type TextBox}">
<Setter Property="Control.Background" Value="#2A2A2A"/>
<Setter Property="Control.Foreground" Value="#888888"/>
<Setter Property="TextBoxBase.CaretBrush" Value="#AAAAAA"/>
<Setter Property="Control.BorderBrush" Value="#383838"/>
<Setter Property="Control.BorderThickness" Value="1"/>
<Setter Property="Control.FontSize" Value="12"/>
<Setter Property="Control.Padding" Value="8,0"/>
<Setter Property="FrameworkElement.Height" Value="30"/>
<Setter Property="Control.VerticalContentAlignment" Value="Center"/>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border x:Name="Bd" Background="{TemplateBinding Control.Background}"
BorderBrush="{TemplateBinding Control.BorderBrush}"
BorderThickness="{TemplateBinding Control.BorderThickness}" CornerRadius="4">
<ScrollViewer x:Name="PART_ContentHost"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsFocused" Value="true">
<Setter TargetName="Bd" Property="Border.BorderBrush" Value="#7C4DFF"/>
<Setter Property="Control.Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="DarkListBox" TargetType="{x:Type ListBox}">
<Setter Property="Control.Background" Value="#222222"/>
<Setter Property="Control.Foreground" Value="#CCCCCC"/>
<Setter Property="Control.BorderBrush" Value="#383838"/>
<Setter Property="Control.BorderThickness" Value="1"/>
<Setter Property="Control.FontSize" Value="12"/>
<Setter Property="Control.Padding" Value="0,2"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border Background="{TemplateBinding Control.Background}"
BorderBrush="{TemplateBinding Control.BorderBrush}"
BorderThickness="{TemplateBinding Control.BorderThickness}" CornerRadius="4">
<ScrollViewer Focusable="false" Padding="{TemplateBinding Control.Padding}">
<ItemsPresenter/>
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Control.Padding" Value="8,5"/>
<Setter Property="Control.Foreground" Value="#CCCCCC"/>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="Bd" Background="Transparent" CornerRadius="3" Margin="2,1">
<ContentPresenter Margin="{TemplateBinding Control.Padding}" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="true">
<Setter TargetName="Bd" Property="Border.Background" Value="#2E2E2E"/>
</Trigger>
<Trigger Property="ListBoxItem.IsSelected" Value="true">
<Setter TargetName="Bd" Property="Border.Background" Value="#3A2D6A"/>
<Setter Property="Control.Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ActionButton" TargetType="{x:Type Button}">
<Setter Property="Control.Foreground" Value="White"/>
<Setter Property="Control.FontSize" Value="12.5"/>
<Setter Property="Control.FontWeight" Value="SemiBold"/>
<Setter Property="FrameworkElement.Cursor" Value="Hand"/>
<Setter Property="FrameworkElement.Height" Value="34"/>
<Setter Property="Control.Background" Value="#7C4DFF"/>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="Bd" Background="{TemplateBinding Control.Background}" CornerRadius="6">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="13" Foreground="White" VerticalAlignment="Center"
Margin="0,0,7,0" Text="{TemplateBinding FrameworkElement.Tag}"/>
<ContentPresenter VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="true">
<Setter TargetName="Bd" Property="Border.Background" Value="#8D60FF"/>
</Trigger>
<Trigger Property="ButtonBase.IsPressed" Value="true">
<Setter TargetName="Bd" Property="Border.Background" Value="#6A3DE8"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ContextMenu}">
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="true"/>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContextMenu}">
<Border Background="#242424" BorderBrush="#383838" BorderThickness="1" CornerRadius="5" Padding="0,3">
<UIElement.Effect>
<DropShadowEffect Color="Black" BlurRadius="12" ShadowDepth="2" Opacity="0.5"/>
</UIElement.Effect>
<ItemsPresenter/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="true"/>
<Setter Property="Control.Foreground" Value="#DDDDDD"/>
<Setter Property="Control.FontSize" Value="12"/>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<Border x:Name="Bd" Background="Transparent" CornerRadius="3" Margin="3,1" Padding="8,5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="18"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ContentPresenter Content="{TemplateBinding MenuItem.Icon}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ContentPresenter Grid.Column="1" ContentSource="Header" VerticalAlignment="Center" Margin="6,0,0,0"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="MenuItem.IsHighlighted" Value="true">
<Setter TargetName="Bd" Property="Border.Background" Value="#333333"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Separator}">
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="true"/>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Separator}">
<Border Height="1" Background="#383838" Margin="6,3"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</FrameworkElement.Resources>
<FrameworkElement.Triggers>
<EventTrigger RoutedEvent="Window.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.3">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</FrameworkElement.Triggers>
<StackPanel x:Name="Root" Margin="14,12,14,14">
<StackPanel Margin="0,0,0,10">
<TextBlock Text="Block connections" Foreground="White" FontSize="14" FontWeight="Bold" Margin="0,0,0,3"/>
<TextBlock Text="Block connections by the IP or Username" Foreground="#555" FontSize="11"/>
</StackPanel>
<TextBox GotFocus="TextBox1_GotFocus" LostFocus="TextBox1_LostFocus" KeyDown="TextBox1_KeyDown"
x:Name="textBox1" Style="{StaticResource DarkTextBox}" Text="Enter the IP or Username here"
Margin="0,0,0,6"/>
<ListBox x:Name="listBox1" Style="{StaticResource DarkListBox}" Height="170" Margin="0,0,0,10">
<FrameworkElement.ContextMenu>
<ContextMenu>
<MenuItem Click="ClearAll_Click" Header="Clear all">
<MenuItem.Icon>
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="12" Foreground="#AAAAAA" TextAlignment="Center"/>
</MenuItem.Icon>
</MenuItem>
<Separator/>
<MenuItem Click="RemoveSelected_Click" Header="Remove selected">
<MenuItem.Icon>
<TextBlock FontFamily="Segoe MDL2 Assets" Text="" FontSize="12" Foreground="#EF5350" TextAlignment="Center"/>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</FrameworkElement.ContextMenu>
</ListBox>
<Button Click="BtnBlock_Click" x:Name="BtnBlock" Content="Block" Tag=""
Style="{StaticResource ActionButton}" Margin="0,0,0,6" Background="#FF5C3D8F"/>
<Button Click="BtnUnblock_Click" x:Name="BtnUnblock" Content="Unblock" Tag=""
Style="{StaticResource ActionButton}" Background="#FF5C3D8F"/>
</StackPanel>
</Window>