Skip to content

Commit

Permalink
chore: Build issue fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Jun 6, 2022
1 parent f1d3b07 commit 03cf67b
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/Uno.UI.Runtime.Skia.Wpf/WpfHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,4 @@ private void InvalidateOverlays()
WpfCanvas? IWpfHost.NativeOverlayLayer => NativeOverlayLayer;
}
}
DesktopWindowXamlSource
7 changes: 6 additions & 1 deletion src/Uno.UI.XamlHost/IXamlMetadataContainer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using System.Collections.Generic;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// https://github.com/CommunityToolkit/Microsoft.Toolkit.Win32/blob/master/Microsoft.Toolkit.Win32.UI.XamlApplication/XamlApplication.idl

using System.Collections.Generic;
using Windows.UI.Xaml.Markup;

namespace Uno.UI.XamlHost;
Expand Down
14 changes: 8 additions & 6 deletions src/Uno.UI.XamlHost/MetadataProviderDiscovery.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// https://github.com/CommunityToolkit/Microsoft.Toolkit.Win32/blob/master/Microsoft.Toolkit.Win32.UI.XamlHost/MetadataProviderDiscovery.cs

using System;
using System.Collections.Generic;
Expand All @@ -14,7 +15,7 @@ namespace Uno.UI.XamlHost;

/// <summary>
/// MetadataProviderDiscovery is responsible for loading all metadata providers for custom UWP XAML
/// types. In this implementation, reflection is used at runtime to probe for metadata providers in
/// types. In this implementation, reflection is used at runtime to probe for metadata providers in
/// the working directory, allowing any type that includes metadata (compiled in to a .NET framework
/// assembly) to be used without explicit metadata handling by the application developer. This
/// internal class will be amended or removed when additional type loading support is available.
Expand Down Expand Up @@ -59,11 +60,12 @@ internal static class MetadataProviderDiscovery
{
yield return provider;

if (typeof(WUX.Application).IsAssignableFrom(provider.GetType()))
{
System.Diagnostics.Debug.WriteLine("Xaml application has been created");
yield break;
}
// TODO: Yield break is weird here, investigate in WCT issues. #8978
//if (typeof(WUX.Application).IsAssignableFrom(provider.GetType()))
//{
// System.Diagnostics.Debug.WriteLine("Xaml application has been created");
// yield break;
//}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/Uno.UI.XamlHost/UnoTypeFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// https://github.com/CommunityToolkit/Microsoft.Toolkit.Win32/blob/master/Microsoft.Toolkit.Win32.UI.XamlHost/UWPTypeFactory.cs

using System;
using windows = Windows;
Expand Down
7 changes: 6 additions & 1 deletion src/Uno.UI.XamlHost/XamlApplication.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
using System;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// https://github.com/CommunityToolkit/Microsoft.Toolkit.Win32/blob/master/Microsoft.Toolkit.Win32.UI.XamlApplication/XamlApplication.cpp

using System;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Markup;
Expand Down
1 change: 1 addition & 0 deletions src/Uno.UI.XamlHost/XamlApplicationExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// https://github.com/CommunityToolkit/Microsoft.Toolkit.Win32/blob/master/Microsoft.Toolkit.Win32.UI.XamlHost/XamlApplicationExtensions.cs

using System;
using System.Linq;
Expand Down
12 changes: 8 additions & 4 deletions src/Uno.UI/UI/Xaml/Hosting/DesktopWindowXamlSource.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
#pragma warning disable 67 // TODO: Focus-related members are currently unused #8978

using System;
using Uno.UI.Xaml.Core;
using Uno.UI.Xaml.Islands;
using Windows.Foundation;
using WinUICoreServices = global::Uno.UI.Xaml.Core.CoreServices;

namespace Windows.UI.Xaml.Hosting;

Expand Down Expand Up @@ -50,16 +53,17 @@ public UIElement Content
{
if (_root is null)
{
_root = new XamlIslandRoot(CoreServices.Instance);
_root = new XamlIslandRoot(WinUICoreServices.Instance);
}

_root.SetPublicRootVisual(value);

UIElement.LoadingRootElement(_root);
UIElement.RootElementLoaded(_root);
OnContentChangedPartial(_root);
}
}

partial void OnContentChangedPartial(XamlIslandRoot xamlIslandRoot);

/// <summary>
/// Attempts to programmatically give focus to the DesktopWindowXamlSource in the desktop application.
/// </summary>
Expand Down
16 changes: 16 additions & 0 deletions src/Uno.UI/UI/Xaml/Hosting/DesktopWindowXamlSource.netstd.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
using Uno.UI.Xaml.Islands;

namespace Windows.UI.Xaml.Hosting;

partial class DesktopWindowXamlSource
{
partial void OnContentChangedPartial(XamlIslandRoot xamlIslandRoot)
{
// Ensure the root element of the XamlIsland is loaded.
UIElement.LoadingRootElement(_root);
UIElement.RootElementLoaded(_root);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internal void SetPointerCapture(PointerIdentifier identifier)
internal void ReleasePointerCapture(PointerIdentifier identifier)
=> _pointerManager.SetPointerCapture(identifier);

private PointerManager _pointerManager;
private PointerManager _pointerManager = null!;

partial void InitializeManagedPointers()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Uno.UI/UI/Xaml/Internal/Islands/XamlIslandRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using CoreServices = global::Uno.UI.Xaml.Core.CoreServices;
using WinUICoreServices = global::Uno.UI.Xaml.Core.CoreServices;

namespace Uno.UI.Xaml.Islands;

internal partial class XamlIslandRoot : Panel
{
private readonly ContentRoot _contentRoot;

internal XamlIslandRoot(CoreServices coreServices)
internal XamlIslandRoot(WinUICoreServices coreServices)
{
_contentRoot = coreServices.ContentRootCoordinator.CreateContentRoot(ContentRootType.XamlIsland, Colors.Transparent, this);

Expand Down
16 changes: 16 additions & 0 deletions src/Uno.UI/UI/Xaml/UIElement.Layout.netstd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public void InvalidateMeasure()
(this.GetParent() as UIElement)?.InvalidateMeasure();
if (IsVisualTreeRoot)
{
#if __SKIA__
XamlRoot.InvalidateMeasure();
#else
Window.InvalidateMeasure();
#endif
}
}
}
Expand All @@ -70,7 +74,11 @@ internal void InvalidateParentMeasureDirtyPath()
}
else if (IsVisualTreeRoot)
{
#if __SKIA__
XamlRoot.InvalidateMeasure();
#else
Window.InvalidateMeasure();
#endif
}
}

Expand All @@ -97,7 +105,11 @@ public void InvalidateArrange()
(this.GetParent() as UIElement)?.InvalidateArrange();
if (IsVisualTreeRoot)
{
#if __SKIA__
XamlRoot.InvalidateArrange();
#else
Window.InvalidateArrange();
#endif
}
}
}
Expand All @@ -124,7 +136,11 @@ private void InvalidateParentArrangeDirtyPath()
}
else //TODO: Why not check IsVisualTreeRoot as in InvalidateParentMeasureDirtyPath?
{
#if __SKIA__
XamlRoot?.InvalidateArrange();
#else
Window.InvalidateArrange();
#endif
}
}

Expand Down
File renamed without changes.

0 comments on commit 03cf67b

Please sign in to comment.