CsWinRT icon indicating copy to clipboard operation
CsWinRT copied to clipboard

How to definition event with ComWrappers?

Open Gaoyifei1011 opened this issue 1 year ago • 9 comments

Description

How to definition event with ComWrappers? 如何使用 ComWrappers 定义事件?

As you can see in the image, I have a COM interface for IInternalCoreWindow2 (the interface is derived from the IInspectable interface) that contains some events. How do I define these events in ComWrappers? How do I call it after the definition is complete? 如图所示,我有一个 IInternalCoreWindow2 的 COM 接口(接口派生于 IInspectable 接口),其中包含了一些事件。如何在 ComWrappers 中定义这些事件?在定义完成后,如何调用呢?

https://github.com/dillydylann/WindowsXamlHosting/blob/a4c8f95759c866d2b724394b0d1bbf866b94d087/CoreWindowAPI/CoreWindow.Interfaces.cs#L23 {98AB77B2-1CBB-4D85-B819-C800DA21E938}

In the .NET Framework we can define it like this (using COM Interop) 在 .NET Framework 中我们可以这样定义(使用了 COM Interop) {A6E30DB2-ECAE-46E0-ABBC-41C5420C2DBB}

Reproduction Steps

None

Expected behavior

Provide an example of defining and calling the interface 提供一个定义并调用该接口的例子

Actual behavior

There are only examples of cpp native and .NET Framework COM Interop 只有 cpp native 和 .NET Framework COM Interop 的示例

Regression?

None

Known Workarounds

None

Configuration

.NET 9 With UWP 10.0.26100.0 x64 None

Other information

Test UWP App App1.zip

https://github.com/dotnet/runtime/issues/107779

Gaoyifei1011 avatar Sep 13 '24 14:09 Gaoyifei1011