|
4 | 4 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
5 | 5 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
6 | 6 | xmlns:tb="http://www.hardcodet.net/taskbar" |
| 7 | + xmlns:helpers="clr-namespace:PortKiller.Helpers" |
7 | 8 | mc:Ignorable="d" |
8 | 9 | Title="PortKiller" |
9 | 10 | Height="700" Width="1200" |
|
19 | 20 | <Window.Resources> |
20 | 21 | <!-- Boolean to Visibility Converter --> |
21 | 22 | <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/> |
| 23 | + <helpers:InverseBoolToVisibilityConverter x:Key="InverseBoolToVisibilityConverter"/> |
22 | 24 |
|
23 | 25 | <!-- Modern Card Style --> |
24 | 26 | <Style x:Key="Card" TargetType="Border"> |
|
403 | 405 | </TextBlock> |
404 | 406 | </StackPanel> |
405 | 407 |
|
406 | | - <!-- Actions (Minimal Kill Button) --> |
| 408 | + <!-- Actions (Kill Button and Spinner) --> |
407 | 409 | <StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center"> |
408 | | - <Button Content="✕" |
409 | | - Click="KillButton_Click" |
| 410 | + <!-- Loading Spinner (visible when killing) --> |
| 411 | + <Border Padding="10,6" |
| 412 | + Visibility="{Binding IsKilling, Converter={StaticResource BoolToVisibilityConverter}}"> |
| 413 | + <Grid Width="16" Height="16" RenderTransformOrigin="0.5,0.5"> |
| 414 | + <Grid.RenderTransform> |
| 415 | + <RotateTransform/> |
| 416 | + </Grid.RenderTransform> |
| 417 | + <Ellipse Width="14" Height="14" |
| 418 | + Stroke="#e74c3c" |
| 419 | + StrokeThickness="2" |
| 420 | + Opacity="0.3"/> |
| 421 | + <Path Data="M 7,0 A 7,7 0 0 1 14,7" |
| 422 | + Stroke="#e74c3c" |
| 423 | + StrokeThickness="2" |
| 424 | + StrokeStartLineCap="Round" |
| 425 | + StrokeEndLineCap="Round" |
| 426 | + Margin="1"/> |
| 427 | + <Grid.Style> |
| 428 | + <Style TargetType="Grid"> |
| 429 | + <Style.Triggers> |
| 430 | + <DataTrigger Binding="{Binding IsKilling}" Value="True"> |
| 431 | + <DataTrigger.EnterActions> |
| 432 | + <BeginStoryboard> |
| 433 | + <Storyboard RepeatBehavior="Forever"> |
| 434 | + <DoubleAnimation |
| 435 | + Storyboard.TargetProperty="(Grid.RenderTransform).(RotateTransform.Angle)" |
| 436 | + From="0" To="360" Duration="0:0:0.8"/> |
| 437 | + </Storyboard> |
| 438 | + </BeginStoryboard> |
| 439 | + </DataTrigger.EnterActions> |
| 440 | + </DataTrigger> |
| 441 | + </Style.Triggers> |
| 442 | + </Style> |
| 443 | + </Grid.Style> |
| 444 | + </Grid> |
| 445 | + </Border> |
| 446 | + |
| 447 | + <!-- Kill Button (hidden when killing) --> |
| 448 | + <Button Content="✕" |
| 449 | + Click="KillButton_Click" |
410 | 450 | Tag="{Binding}" |
411 | 451 | Padding="10,6" |
412 | 452 | FontSize="16" |
413 | 453 | FontWeight="Normal" |
414 | 454 | Cursor="Hand" |
415 | | - ToolTip="Kill Process"> |
| 455 | + ToolTip="Kill Process" |
| 456 | + Visibility="{Binding IsKilling, Converter={StaticResource InverseBoolToVisibilityConverter}}"> |
416 | 457 | <Button.Style> |
417 | 458 | <Style TargetType="Button"> |
418 | 459 | <Setter Property="Background" Value="Transparent"/> |
|
421 | 462 | <Setter Property="Template"> |
422 | 463 | <Setter.Value> |
423 | 464 | <ControlTemplate TargetType="Button"> |
424 | | - <Border Background="{TemplateBinding Background}" |
| 465 | + <Border Background="{TemplateBinding Background}" |
425 | 466 | CornerRadius="6" |
426 | 467 | Padding="{TemplateBinding Padding}"> |
427 | 468 | <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> |
|
0 commit comments