Skip to content

Commit ac74e1f

Browse files
Cleanup
1 parent 9a159b7 commit ac74e1f

16 files changed

+23
-806
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using FullTrustUWP.Core.Interfaces;
2-
using System;
32

43
namespace FullTrustUWP.Core.Activation
54
{
@@ -9,7 +8,7 @@ public static IApplicationFrameManager CreateApplicationFrameManager()
98
{
109
// CLSID_ApplicationFrameManagerPriv = ddc05a5a-351a-4e06-8eaf-54ec1bc2dcea
1110
// CLSID_ApplicationFrameManager = b9b05098-3e30-483f-87f7-027ca78da287 // b9b05098_3e30_483f_87f7_027ca78da287
12-
return Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("b9b05098-3e30-483f-87f7-027ca78da287"))) as IApplicationFrameManager;
11+
return InteropHelper.ComCreateInstance<IApplicationFrameManager>("b9b05098-3e30-483f-87f7-027ca78da287")!;
1312
}
1413
}
1514
}
Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
using FullTrustUWP.Core.Interfaces;
22
using System;
33
using System.Runtime.InteropServices;
4-
using Windows.ApplicationModel.Core;
54
using Windows.UI.Core;
6-
using Windows.UI.ViewManagement;
7-
using Windows.UI.WindowManagement;
85

96
namespace FullTrustUWP.Core.Activation
107
{
@@ -21,7 +18,6 @@ public enum WindowType : long
2118
NOT_IMMERSIVE
2219
}
2320

24-
#region CreateCoreWindow
2521
[DllImport("windows.ui.dll", EntryPoint = "#1500")]
2622
static extern int PrivateCreateCoreWindow(
2723
WindowType windowType,
@@ -39,49 +35,7 @@ out ICoreWindowInterop windowRef
3935
public static CoreWindow CreateCoreWindow(WindowType windowType, string windowTitle, IntPtr hOwnerWindow, int x = 0, int y = 0, uint width = 10, uint height = 10, uint dwAttributes = 0)
4036
{
4137
Marshal.ThrowExceptionForHR(PrivateCreateCoreWindow(windowType, windowTitle, x, y, width, height, dwAttributes, hOwnerWindow, typeof(ICoreWindowInterop).GUID, out ICoreWindowInterop windowRef));
42-
return windowRef as object as CoreWindow;
38+
return (windowRef as object as CoreWindow)!;
4339
}
44-
#endregion
45-
46-
#region CreateCoreApplicationViewTitleBar
47-
[DllImport("twinapi.appcore.dll", EntryPoint = "#501")]
48-
static extern int CreateCoreApplicationViewTitleBar(
49-
CoreWindow titleBarClientAdapter,
50-
IntPtr hWnd,
51-
out CoreApplicationViewTitleBar titleBar
52-
);
53-
54-
public static CoreApplicationViewTitleBar CreateCoreApplicationViewTitleBar(CoreWindow coreWindow, IntPtr hWnd)
55-
{
56-
Marshal.ThrowExceptionForHR(CreateCoreApplicationViewTitleBar(coreWindow, hWnd, out var titleBar));
57-
return titleBar;
58-
}
59-
#endregion
60-
61-
#region CreateApplicationViewTitleBar
62-
[DllImport("twinapi.appcore.dll", EntryPoint = "#502")]
63-
static extern int CreateApplicationViewTitleBar(
64-
AppWindow titleBarClientAdapter,
65-
IntPtr hWnd,
66-
out ApplicationViewTitleBar titleBar
67-
);
68-
69-
public static ApplicationViewTitleBar CreateApplicationViewTitleBar(AppWindow titleBarClientAdapter, IntPtr hWnd)
70-
{
71-
Marshal.ThrowExceptionForHR(CreateApplicationViewTitleBar(titleBarClientAdapter, hWnd, out var titleBar));
72-
return titleBar;
73-
}
74-
#endregion
75-
76-
/// <summary>
77-
/// Not really working?!
78-
/// </summary>
79-
/// <param name="hWnd"></param>
80-
/// <returns></returns>
81-
[DllImport("twinapi.appcore.dll", EntryPoint = "#12")]
82-
public static extern bool IsImmersiveWindow(IntPtr hWnd);
83-
84-
[DllImport("CoreUIComponents.dll", SetLastError = true)]
85-
public static extern int CoreUICreateICoreWindowFactory(IntPtr a, IntPtr reserved1, IntPtr reserved2, out ICoreWindowFactory coreWindowFactory);
8640
}
8741
}

XamlIslands/FullTrustUWP/Core/Activation/CoreWindowFactoryActivator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static ICoreWindowFactory CreateInstance()
1212
Guid clsid = new(CLSID_CoreUICoreWindowFactoryProxy);
1313
Guid iid = new("00000000-0000-0000-C000-000000000046");
1414
Marshal.ThrowExceptionForHR(InteropHelper.CoCreateInstance(ref clsid, null, 1026, ref iid, out object factoryPtr));
15-
return factoryPtr as ICoreWindowFactory;
15+
return (factoryPtr as ICoreWindowFactory)!;
1616
}
1717
}
1818
}

XamlIslands/FullTrustUWP/Core/Activation/ImmersiveShellActivator.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ namespace FullTrustUWP.Core.Activation
66
public static class ImmersiveShellActivator
77
{
88
public static Interfaces.IServiceProvider CreateImmersiveShellServiceProvider()
9-
{
10-
var shellType = Type.GetTypeFromCLSID(new Guid("c2f03a33-21f5-47fa-b4bb-156362a2f239"));
11-
return (Interfaces.IServiceProvider)Activator.CreateInstance(shellType);
12-
}
9+
=> InteropHelper.ComCreateInstance<Interfaces.IServiceProvider>("c2f03a33-21f5-47fa-b4bb-156362a2f239")!;
1310

1411
public static T QueryService<T>(this Interfaces.IServiceProvider serviceProvider)
1512
{

XamlIslands/FullTrustUWP/Core/Activation/SplashScreenActivator.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
using FullTrustUWP.Core.Interfaces;
2-
using System;
32

43
namespace FullTrustUWP.Core.Activation
54
{
65
public static class VirtualDesktopManagerActivator
76
{
87
public static IVirtualDesktopManager CreateVirtualDesktopManager()
9-
{
10-
Type type = Type.GetTypeFromCLSID(new Guid("aa509086-5ca9-4c25-8f95-589d3c07b48a"));
11-
return (IVirtualDesktopManager)Activator.CreateInstance(type);
12-
}
8+
=> InteropHelper.ComCreateInstance<IVirtualDesktopManager>("aa509086-5ca9-4c25-8f95-589d3c07b48a")!;
139
}
1410
}

XamlIslands/FullTrustUWP/Core/Activation/XamlWindowActivator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static XamlWindow CreateNewWindow(XamlWindowConfig config)
3434
coreWindow = CoreWindowActivator.CreateCoreWindow(CoreWindowActivator.WindowType.NOT_IMMERSIVE, config.Title, IntPtr.Zero, 30, 30, 1024, 768, 0);
3535

3636
// Create CoreApplicationView
37-
var coreApplicationPrivate = InteropHelper.GetActivationFactory<Interfaces.ICoreApplicationPrivate2>("Windows.ApplicationModel.Core.CoreApplication");
37+
var coreApplicationPrivate = InteropHelper.RoGetActivationFactory<Interfaces.ICoreApplicationPrivate2>("Windows.ApplicationModel.Core.CoreApplication");
3838
Marshal.ThrowExceptionForHR(coreApplicationPrivate.CreateNonImmersiveView(out var coreView));
3939

4040
// Mount Xaml rendering

XamlIslands/FullTrustUWP/Core/ApplicationFrame/CloakingHelper.cs

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

XamlIslands/FullTrustUWP/Core/AppxActivator.cs

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

XamlIslands/FullTrustUWP/Core/AppxActivatorTest.cs

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

0 commit comments

Comments
 (0)