Skip to content

Commit eb3ab30

Browse files
author
BRUNER Patrick
committed
error fix
1 parent 7c86104 commit eb3ab30

5 files changed

Lines changed: 22 additions & 37 deletions

File tree

src/FlashIconHighlighter/FlashIconHighlighter.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
88
<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
10+
<AssemblyTitle>FlashIconHighlighter</AssemblyTitle>
11+
<RootNamespace>FlashIconHighlighter</RootNamespace>
1012
</PropertyGroup>
1113

14+
<ItemGroup>
15+
<PackageReference Include="Vanara.PInvoke.User32" />
16+
</ItemGroup>
17+
1218
<ItemGroup>
1319
<ProjectReference Include="..\ColumnizerLib\ColumnizerLib.csproj" />
1420
</ItemGroup>

src/FlashIconHighlighter/FlashIconPlugin.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using System;
21
using System.Runtime.InteropServices;
32
using System.Runtime.Versioning;
4-
using System.Windows.Forms;
53

64
using ColumnizerLib;
75

6+
using static Vanara.PInvoke.User32;
7+
88
[assembly: SupportedOSPlatform("windows")]
99
namespace FlashIconHighlighter;
1010

@@ -18,29 +18,33 @@ internal class FlashIconPlugin : IKeywordAction
1818

1919
#region IKeywordAction Member
2020

21-
public void Execute (string keyword, string param, ILogExpertCallback callback, ILogLineMemoryColumnizer columnizer)
21+
public void Execute (string keyword, string param, ILogExpertCallbackMemory callback, ILogLineMemoryColumnizer columnizer)
2222
{
2323
var openForms = Application.OpenForms;
2424
foreach (Form form in openForms)
2525
{
2626
if (form.TopLevel && form.Name.Equals("LogTabWindow", StringComparison.OrdinalIgnoreCase) && form.Text.Contains(callback.GetFileName(), StringComparison.Ordinal))
2727
{
28-
form.BeginInvoke(FlashWindow, [form]);
28+
_ = form.BeginInvoke(FlashWindow, [form]);
2929
}
3030
}
3131
}
3232

33+
/// <summary>
34+
/// Flash Window http://blogs.x2line.com/al/archive/2008/04/19/3392.aspx
35+
/// </summary>
36+
/// <param name="form"></param>
3337
private void FlashWindow (Form form)
3438
{
3539
FLASHWINFO fw = new()
3640
{
37-
cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(FLASHWINFO))),
41+
cbSize = Convert.ToUInt32(Marshal.SizeOf<FLASHWINFO>()),
3842
hwnd = form.Handle,
39-
dwFlags = 14,
43+
dwFlags = FLASHW.FLASHW_TRAY | FLASHW.FLASHW_CAPTION | FLASHW.FLASHW_TIMER,
4044
uCount = 0
4145
};
4246

43-
Win32Stuff.FlashWindowEx(ref fw);
47+
_ = FlashWindowEx(fw);
4448
}
4549

4650
public string GetDescription ()

src/FlashIconHighlighter/Win32Stuff.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/LogExpert.Tests/Services/LedIndicatorServiceTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ public class LedIndicatorServiceTests
1313
{
1414
private LedIndicatorService? _service;
1515
private ApplicationContext? _appContext;
16+
private WindowsFormsSynchronizationContext? _syncContext;
1617

1718
[SetUp]
1819
public void Setup ()
1920
{
2021
// Ensure we have a WindowsFormsSynchronizationContext for the UI thread
2122
if (SynchronizationContext.Current == null)
2223
{
23-
SynchronizationContext.SetSynchronizationContext(new WindowsFormsSynchronizationContext());
24+
_syncContext = new WindowsFormsSynchronizationContext();
25+
SynchronizationContext.SetSynchronizationContext(_syncContext);
2426
}
2527

2628
// Create an application context to ensure we have a proper UI context
@@ -35,6 +37,7 @@ public void TearDown ()
3537
{
3638
_service?.Dispose();
3739
_appContext?.Dispose();
40+
_syncContext?.Dispose();
3841
}
3942

4043
[Test]

src/LogExpert.UI/Services/LedIndicatorService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace LogExpert.UI.Services;
1111

1212
[SupportedOSPlatform("windows")]
13-
internal sealed class LedIndicatorService : ILedIndicatorService
13+
internal sealed class LedIndicatorService : ILedIndicatorService, IDisposable
1414
{
1515
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
1616

0 commit comments

Comments
 (0)