Skip to content

Commit 627110e

Browse files
committed
More code refactoring
1 parent 3b80b6b commit 627110e

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

CommunityToolkit.WinUI/Extensions/Interop/DispatcherQueueProxyHandler.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Runtime.CompilerServices;
77
using System.Runtime.InteropServices;
88
using System.Threading;
9+
using static CommunityToolkit.WinUI.Interop.Windows;
910

1011
#nullable enable
1112

@@ -19,13 +20,6 @@ namespace CommunityToolkit.WinUI.Interop
1920
/// </summary>
2021
internal unsafe struct DispatcherQueueProxyHandler
2122
{
22-
private const int S_OK = 0;
23-
private const int E_NOINTERFACE = unchecked((int)0x80004002);
24-
25-
private static readonly Guid IUnknown = new(0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
26-
private static readonly Guid IAgileObject = new(0x94EA2B94, 0xE9CC, 0x49E0, 0xC0, 0xFF, 0xEE, 0x64, 0xCA, 0x8F, 0x5B, 0x90);
27-
private static readonly Guid IDispatcherQueueHandler = new(0x2E0872A9, 0x4E29, 0x5F14, 0xB6, 0x88, 0xFB, 0x96, 0xD5, 0xF9, 0xD5, 0xF8);
28-
2923
/// <summary>
3024
/// The shared vtable pointer for <see cref="DispatcherQueueProxyHandler"/> instances.
3125
/// </summary>

CommunityToolkit.WinUI/Extensions/Interop/IDispatcherQueue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#nullable enable
99

10-
#pragma warning disable SA1023
10+
#pragma warning disable CS0649, SA1023
1111

1212
namespace CommunityToolkit.WinUI.Interop
1313
{
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
7+
namespace CommunityToolkit.WinUI.Interop
8+
{
9+
/// <summary>
10+
/// A helper class with some shared constants from the Windows headers.
11+
/// </summary>
12+
internal static class Windows
13+
{
14+
/// <summary>
15+
/// The HRESULT for a successful operation.
16+
/// </summary>
17+
public const int S_OK = 0;
18+
19+
/// <summary>
20+
/// The HRESULT for an invalid cast from <c>IUnknown.QueryInterface</c>.
21+
/// </summary>
22+
public const int E_NOINTERFACE = unchecked((int)0x80004002);
23+
24+
/// <summary>
25+
/// The GUID for the <c>IUnknown</c> COM interface.
26+
/// </summary>
27+
public static readonly Guid IUnknown = new(0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
28+
29+
/// <summary>
30+
/// The GUID for the <c>IAgileObject</c> WinRT interface.
31+
/// </summary>
32+
public static readonly Guid IAgileObject = new(0x94EA2B94, 0xE9CC, 0x49E0, 0xC0, 0xFF, 0xEE, 0x64, 0xCA, 0x8F, 0x5B, 0x90);
33+
34+
/// <summary>
35+
/// The GUID for the <c>IDispatcherQueueHandler</c> WinRT interface.
36+
/// </summary>
37+
public static readonly Guid IDispatcherQueueHandler = new(0x2E0872A9, 0x4E29, 0x5F14, 0xB6, 0x88, 0xFB, 0x96, 0xD5, 0xF9, 0xD5, 0xF8);
38+
}
39+
}

0 commit comments

Comments
 (0)