Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Client/analysis/Interop/BlackbirdNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ static BlackbirdNative()
internal const uint IpcEtwFamilyThreatIntel = 8;
internal const uint IpcEtwFamilySocket = 9;
internal const uint IpcEtwFamilyUserHook = 10;
internal const uint IpcEtwFamilyIpcIo = 11;

internal const uint IpcEtwFlagHandleExecProtect = 0x00000001;
internal const uint IpcEtwFlagHandleFromNtdll = 0x00000002;
Expand Down
111 changes: 67 additions & 44 deletions Client/analysis/Themes/DarkTheme.xaml

Large diffs are not rendered by default.

37 changes: 21 additions & 16 deletions Client/analysis/Themes/LightTheme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<Color x:Key="WinBgColor">#FFF5F3EF</Color>
<Color x:Key="WinPanelColor">#FFFDFBF7</Color>
<Color x:Key="WinHeaderColor">#FFEAE4DC</Color>
<Color x:Key="PaneBorderColor">#FFB8ADA2</Color>
<Color x:Key="WinBorderColor">#FFD0C5B9</Color>
<Color x:Key="WinSubtleBorderColor">#FFE1D8CF</Color>
<Color x:Key="PaneBorderColor">#FFE4DDD5</Color>
<Color x:Key="WinBorderColor">#FFE2DBD3</Color>
<Color x:Key="WinSubtleBorderColor">#FFE9E3DC</Color>
<Color x:Key="WinTextColor">#FF1F1C18</Color>
<Color x:Key="WinMutedTextColor">#FF6E655D</Color>
<Color x:Key="WinAccentColor">#FF9A2F23</Color>
Expand Down Expand Up @@ -176,8 +176,8 @@
<Style TargetType="ToolTip">
<Setter Property="Background" Value="{StaticResource WinPanelBrush}"/>
<Setter Property="Foreground" Value="{StaticResource WinTextBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource WinBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="6"/>
</Style>

Expand All @@ -199,16 +199,19 @@
CornerRadius="0">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
TextElement.Foreground="{TemplateBinding Foreground}"
Margin="{TemplateBinding Padding}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FFF1E7DA"/>
<Setter Property="BorderBrush" Value="#FF8F7F72"/>
<Setter Property="Background" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#FF111111"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#FFE7DDD0"/>
<Setter Property="BorderBrush" Value="{StaticResource WinAccentBrush}"/>
<Setter Property="Background" Value="#FFEFEFEF"/>
<Setter Property="Foreground" Value="#FF111111"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5"/>
Expand Down Expand Up @@ -272,15 +275,15 @@
<Style TargetType="ProgressBar">
<Setter Property="Background" Value="#FFEAE3D8"/>
<Setter Property="Foreground" Value="#FF4C8E67"/>
<Setter Property="BorderBrush" Value="#FFC3B7A8"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>

<Style TargetType="ToggleButton">
<Setter Property="Background" Value="{StaticResource WinHeaderBrush}"/>
<Setter Property="Foreground" Value="{StaticResource WinTextBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource WinBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="10,4"/>
<Setter Property="Margin" Value="4,0"/>
<Setter Property="MinWidth" Value="70"/>
Expand All @@ -295,16 +298,18 @@
CornerRadius="0">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
TextElement.Foreground="{TemplateBinding Foreground}"
Margin="{TemplateBinding Padding}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ToggleRoot" Property="Background" Value="#FFF1E7DA"/>
<Setter TargetName="ToggleRoot" Property="BorderBrush" Value="#FF8F7F72"/>
<Setter TargetName="ToggleRoot" Property="Background" Value="#FFFFFFFF"/>
<Setter Property="Foreground" Value="#FF111111"/>
<Setter TargetName="ToggleRoot" Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="ToggleRoot" Property="Background" Value="#FFE7DDD0"/>
<Setter TargetName="ToggleRoot" Property="BorderBrush" Value="{StaticResource WinAccentBrush}"/>
<Setter TargetName="ToggleRoot" Property="BorderBrush" Value="Transparent"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5"/>
Expand Down
76 changes: 59 additions & 17 deletions Client/analysis/Theming/ThemedMessageBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ public static MessageBoxResult Show(Window? owner, string message, string title,
MessageBoxButton buttons = MessageBoxButton.OK,
MessageBoxImage image = MessageBoxImage.None)
{
bool isPreflightDialog = title.Contains("Preflight", StringComparison.OrdinalIgnoreCase);
var dialog = new Window { Title = title,
Width = 432,
Width = isPreflightDialog ? 720 : 432,
SizeToContent = SizeToContent.Height,
MinWidth = 360,
MinHeight = 0,
MaxWidth = 560,
MaxHeight = 320,
MaxWidth = isPreflightDialog
? Math.Min(SystemParameters.WorkArea.Width - 80, 900)
: 560,
MaxHeight = isPreflightDialog
? Math.Min(SystemParameters.WorkArea.Height - 80, 720)
: 320,
WindowStartupLocation = owner == null ? WindowStartupLocation.CenterScreen
: WindowStartupLocation.CenterOwner,
Owner = owner,
Expand All @@ -34,8 +39,8 @@ public static MessageBoxResult Show(Window? owner, string message, string title,
WindowThemeHelper.ApplyTitleBarTheme(dialog, App.IsDarkTheme);

var root = new Border { Background = dialog.Background,
BorderBrush = GetBrush("WinBorderBrush", Color.FromRgb(0x2B, 0x2B, 0x2B)),
BorderThickness = new Thickness(1) };
BorderBrush = Brushes.Transparent,
BorderThickness = new Thickness(0) };

var layout = new Grid();
layout.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
Expand Down Expand Up @@ -64,11 +69,17 @@ public static MessageBoxResult Show(Window? owner, string message, string title,

var messageBlock =
new TextBlock { Text = message, TextWrapping = TextWrapping.Wrap,
MaxWidth = isPreflightDialog ? 640 : double.PositiveInfinity,
VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, 1, 0, 0),
Foreground = GetBrush("MessageBoxMutedTextBrush", Color.FromRgb(0xB0, 0xB0, 0xB0)) };

var messageScroll =
new ScrollViewer { MaxHeight = 150, VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
new ScrollViewer { MaxHeight = isPreflightDialog
? Math.Max(260, SystemParameters.WorkArea.Height - 240)
: 150,
VerticalScrollBarVisibility = isPreflightDialog
? ScrollBarVisibility.Disabled
: ScrollBarVisibility.Auto,
HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
CanContentScroll = false, Content = messageBlock };
Grid.SetColumn(messageScroll, 1);
Expand Down Expand Up @@ -157,8 +168,8 @@ public static void ShowToast(Window? owner, string message, string title = "Noti
WindowThemeHelper.ApplyTitleBarTheme(toast, App.IsDarkTheme);

var shell = new Border { Background = toast.Background,
BorderBrush = GetBrush("WinBorderBrush", Color.FromRgb(0x2B, 0x2B, 0x2B)),
BorderThickness = new Thickness(1) };
BorderBrush = Brushes.Transparent,
BorderThickness = new Thickness(0) };

var layout = new Grid();
layout.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
Expand Down Expand Up @@ -228,8 +239,8 @@ private static Border BuildTitleBar(Window host, string title)
{
var border =
new Border { Background = GetBrush("WinHeaderBrush", Color.FromRgb(0x1B, 0x1B, 0x1B)),
BorderBrush = GetBrush("WinBorderBrush", Color.FromRgb(0x2B, 0x2B, 0x2B)),
BorderThickness = new Thickness(0, 0, 0, 1), Padding = new Thickness(10, 6, 6, 6) };
BorderBrush = Brushes.Transparent,
BorderThickness = new Thickness(0), Padding = new Thickness(10, 6, 6, 6) };

var grid = new Grid();
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
Expand Down Expand Up @@ -304,16 +315,14 @@ private static Style BuildTitleCloseButtonStyle()
var over = new Trigger { Property = UIElement.IsMouseOverProperty, Value = true };
over.Setters.Add(
new Setter(Control.BackgroundProperty, new SolidColorBrush(Color.FromRgb(0xAA, 0x3A, 0x3A))));
over.Setters.Add(
new Setter(Control.BorderBrushProperty, new SolidColorBrush(Color.FromRgb(0xBC, 0x54, 0x54))));
over.Setters.Add(new Setter(Control.BorderThicknessProperty, new Thickness(1)));
over.Setters.Add(new Setter(Control.BorderBrushProperty, Brushes.Transparent));
over.Setters.Add(new Setter(Control.BorderThicknessProperty, new Thickness(0)));

var pressed = new Trigger { Property = ButtonBase.IsPressedProperty, Value = true };
pressed.Setters.Add(
new Setter(Control.BackgroundProperty, new SolidColorBrush(Color.FromRgb(0x91, 0x2E, 0x2E))));
pressed.Setters.Add(
new Setter(Control.BorderBrushProperty, new SolidColorBrush(Color.FromRgb(0xBC, 0x54, 0x54))));
pressed.Setters.Add(new Setter(Control.BorderThicknessProperty, new Thickness(1)));
pressed.Setters.Add(new Setter(Control.BorderBrushProperty, Brushes.Transparent));
pressed.Setters.Add(new Setter(Control.BorderThicknessProperty, new Thickness(0)));

template.Triggers.Add(over);
template.Triggers.Add(pressed);
Expand Down Expand Up @@ -376,10 +385,43 @@ private static Style BuildMessageButtonStyle()
new Setter(Control.ForegroundProperty, new SolidColorBrush(Color.FromRgb(0xE6, 0xE6, 0xE6))));
style.Setters.Add(
new Setter(Control.BorderBrushProperty, new SolidColorBrush(Color.FromRgb(0x2B, 0x2B, 0x2B))));
style.Setters.Add(new Setter(Control.BorderThicknessProperty, new Thickness(1)));
style.Setters.Add(new Setter(Control.BorderThicknessProperty, new Thickness(0)));
style.Setters.Add(new Setter(Control.PaddingProperty, new Thickness(10, 4, 10, 4)));
style.Setters.Add(new Setter(FrameworkElement.MinWidthProperty, 76d));
style.Setters.Add(new Setter(FrameworkElement.MinHeightProperty, 24d));

var template = new ControlTemplate(typeof(Button));
var border = new FrameworkElementFactory(typeof(Border));
border.SetValue(Border.BackgroundProperty, new TemplateBindingExtension(Control.BackgroundProperty));
border.SetValue(Border.BorderBrushProperty, new TemplateBindingExtension(Control.BorderBrushProperty));
border.SetValue(Border.BorderThicknessProperty,
new TemplateBindingExtension(Control.BorderThicknessProperty));

var presenter = new FrameworkElementFactory(typeof(ContentPresenter));
presenter.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Center);
presenter.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center);
presenter.SetValue(FrameworkElement.MarginProperty, new TemplateBindingExtension(Control.PaddingProperty));
presenter.SetValue(System.Windows.Documents.TextElement.ForegroundProperty,
new TemplateBindingExtension(Control.ForegroundProperty));
border.AppendChild(presenter);
template.VisualTree = border;

var over = new Trigger { Property = UIElement.IsMouseOverProperty, Value = true };
over.Setters.Add(
new Setter(Control.BackgroundProperty, new SolidColorBrush(Color.FromRgb(0xF4, 0xF4, 0xF4))));
over.Setters.Add(new Setter(Control.ForegroundProperty, new SolidColorBrush(Color.FromRgb(0x11, 0x11, 0x11))));
over.Setters.Add(new Setter(Control.BorderBrushProperty, Brushes.Transparent));

var pressed = new Trigger { Property = ButtonBase.IsPressedProperty, Value = true };
pressed.Setters.Add(
new Setter(Control.BackgroundProperty, new SolidColorBrush(Color.FromRgb(0xE3, 0xE3, 0xE3))));
pressed.Setters.Add(
new Setter(Control.ForegroundProperty, new SolidColorBrush(Color.FromRgb(0x11, 0x11, 0x11))));
pressed.Setters.Add(new Setter(Control.BorderBrushProperty, Brushes.Transparent));

template.Triggers.Add(over);
template.Triggers.Add(pressed);
style.Setters.Add(new Setter(Control.TemplateProperty, template));
return style;
}
}
Expand Down
Loading