Group header actions and restore refresh/close button behavior

This commit is contained in:
Meik
2026-03-05 11:10:35 +01:00
parent c29ca72b2b
commit 5a1a54e9ff
2 changed files with 69 additions and 25 deletions

View File

@@ -294,6 +294,18 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button"
x:Key="HeaderGroupButtonStyle"
BasedOn="{StaticResource HeaderIconButtonStyle}">
<Setter Property="BorderThickness"
Value="0" />
<Setter Property="Background"
Value="Transparent" />
<Setter Property="Width"
Value="32" />
<Setter Property="Height"
Value="32" />
</Style>
<DrawingImage x:Key="OverlayOffline">
<DrawingImage.Drawing>
@@ -341,34 +353,40 @@
HorizontalAlignment="Left"
Margin="14,14,0,0"
x:Name="Logo" />
<Button x:Name="Close_Text"
Style="{StaticResource HeaderIconButtonStyle}"
HorizontalAlignment="Right"
<Border HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="0,12,12,0"
Panel.ZIndex="500"
ToolTip="{x:Static resx:Resources.close}"
PreviewMouseDown="OnMinimizeClicked">
<TextBlock Text="X"
FontSize="15"
FontWeight="Bold"
TextAlignment="Center"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Button>
<Button x:Name="RefreshIcon"
Style="{StaticResource HeaderIconButtonStyle}"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="0,12,88,0"
Panel.ZIndex="500"
ToolTip="Refresh"
PreviewMouseDown="OnRefreshClicked">
<Image Source="{DynamicResource nav_appbar_refresh}"
Tag="ICO"
Width="16"
Height="16" />
</Button>
CornerRadius="10"
BorderThickness="1"
BorderBrush="{DynamicResource panelBorderColor}"
Background="{DynamicResource headerControlBackgroundColor}">
<StackPanel Orientation="Horizontal">
<Button x:Name="RefreshIcon"
Style="{StaticResource HeaderGroupButtonStyle}"
ToolTip="Refresh"
Click="OnRefreshButtonClick">
<Image Source="{DynamicResource nav_appbar_refresh}"
Tag="ICO"
Width="16"
Height="16" />
</Button>
<Border Width="1"
Margin="0,6"
Background="{DynamicResource panelBorderColor}" />
<Button x:Name="Close_Text"
Style="{StaticResource HeaderGroupButtonStyle}"
ToolTip="{x:Static resx:Resources.close}"
Click="OnMinimizeButtonClick">
<TextBlock Text="X"
FontSize="15"
FontWeight="Bold"
TextAlignment="Center"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Button>
</StackPanel>
</Border>
<!--<TextBlock MouseDown="OnCloseClicked" HorizontalAlignment="Right" FontSize="20" FontWeight="Bold" Margin="0,-5,5,0" Cursor="Hand" Panel.ZIndex="500" >X</TextBlock>-->
<Image Source="{DynamicResource nav_appbar_network_server_disconnect}"
Tag="ICO"

View File

@@ -1478,6 +1478,16 @@ namespace C4IT_CustomerPanel
HideMainForm();
}
private void OnRefreshButtonClick(object sender, RoutedEventArgs e)
{
OnRefreshClicked(sender, null);
}
private void OnMinimizeButtonClick(object sender, RoutedEventArgs e)
{
OnMinimizeClicked(sender, null);
}
private void OnNotifierMenuClicked(object sender, EventArgs e)
{
if (!(sender is ToolStripMenuItem menuItem))
@@ -1606,6 +1616,9 @@ namespace C4IT_CustomerPanel
private void GridTop_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.OriginalSource is DependencyObject source && FindVisualParent<Button>(source) != null)
return;
if (e.ChangedButton == MouseButton.Left && ConfigSettings.GetConfig()._isDraggable)
this.DragMove();
}
@@ -1633,6 +1646,19 @@ namespace C4IT_CustomerPanel
}
}
private static T FindVisualParent<T>(DependencyObject source) where T : DependencyObject
{
while (source != null)
{
if (source is T target)
return target;
source = VisualTreeHelper.GetParent(source);
}
return null;
}
private void App_KeyDown(object sender, KeyEventArgs e)
{
if (((Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt) && Keyboard.IsKeyDown(Key.R) && ConfigSettings.GetConfig()._isDraggable)