Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code clean up #1692

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions src/Uno.Extensions.Maui.UI/Internals/ThreadHelper.cs

This file was deleted.

14 changes: 0 additions & 14 deletions src/Uno.Extensions.Maui.UI/Internals/UnoHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,4 @@ public UnoHost(ResourceDictionary resources)
{
Resources = resources.ToMauiResources();
}

protected override void OnBindingContextChanged()
{

if (BindingContext is null)
{
System.Console.WriteLine("UnoHost.BindingContext is null");
}
else
{
System.Console.WriteLine($"UnoHost.BindingContext is {BindingContext.GetType().FullName}");
}

}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Uno.Extensions.Maui.Interop;

public interface IWinUIToMauiStyleHandler
internal interface IWinUIToMauiStyleHandler
{
Type TargetType { get; }

Expand Down
24 changes: 12 additions & 12 deletions src/Uno.Extensions.Maui.UI/Interop/MauiInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ internal static class MauiInterop
private static readonly List<ControlMapping> _mappings = new();
private static readonly List<IWinUIToMauiStyleHandler> _styleHandlers = new();

static MauiInterop()
{
MapControl<TextBlock, Microsoft.Maui.Controls.Label>();
MapControl<TextBox, Microsoft.Maui.Controls.Entry>();
MapControl<Grid, Microsoft.Maui.Controls.Grid>();
MapControl<StackPanel, Microsoft.Maui.Controls.StackLayout>();

MapStyleHandler<LabelStyleHandler>();
MapStyleHandler<VisualElementStyleHandler>();
MapStyleHandler<ViewStyleHandler>();
MapStyleHandler<LayoutStyleHandler>();
}
// static MauiInterop()
nickrandolph marked this conversation as resolved.
Show resolved Hide resolved
// {
// MapControl<TextBlock, Microsoft.Maui.Controls.Label>();
// MapControl<TextBox, Microsoft.Maui.Controls.Entry>();
// MapControl<Grid, Microsoft.Maui.Controls.Grid>();
// MapControl<StackPanel, Microsoft.Maui.Controls.StackLayout>();
//
// MapStyleHandler<LabelStyleHandler>();
// MapStyleHandler<VisualElementStyleHandler>();
// MapStyleHandler<ViewStyleHandler>();
// MapStyleHandler<LayoutStyleHandler>();
// }

public static void MapControl<TWinUI, TMaui>()
where TWinUI : FrameworkElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Uno.Extensions.Maui.Interop;

public abstract class WinUIToMauiStyleHandler : IWinUIToMauiStyleHandler
internal abstract class WinUIToMauiStyleHandler : IWinUIToMauiStyleHandler
{
public abstract Type TargetType { get; }

Expand Down
5 changes: 1 addition & 4 deletions src/Uno.Extensions.Maui.UI/MauiBinding.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Uno.Extensions.Maui.Internals;
using UnoMusicApp.Helpers;

namespace Uno.Extensions.Maui;

Expand Down Expand Up @@ -35,7 +34,7 @@ public class MauiBinding : MauiExtensionBase
public object? ConverterParameter { get; set; }

/// <summary>
/// The source object for the bound property.
/// The source object for the bound property.
/// </summary>
public object? Source { get; set; }

Expand All @@ -47,8 +46,6 @@ protected override void SetValue(View view, Type viewType, Type propertyType, Mi
Path = ".";
}

ThreadHelpers.WhatThreadAmI();

IMauiConverter? converter = null;
if (Converter is IMauiConverter converterAsMauiConverter)
{
Expand Down
11 changes: 0 additions & 11 deletions src/Uno.Extensions.Maui.UI/MauiContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,10 @@ private void OnLoading(FrameworkElement sender, object args)

void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
if (DataContext is null)
{
System.Console.WriteLine("MauiContent.DataContext is null");
}
else
{
System.Console.WriteLine($"MauiContent.DataContext is {DataContext.GetType().FullName}");
}


if (_host is not null && _host.BindingContext != DataContext)
{
_host.BindingContext = DataContext;
View.BindingContext = DataContext;
}
//DataContextChanged -= OnDataContextChanged;
}
}
2 changes: 0 additions & 2 deletions src/Uno.Extensions.Maui.UI/MauiExtensionBase.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Diagnostics;
using System.Reflection;
using Microsoft.Maui.Controls;
using UnoMusicApp.Helpers;

namespace Uno.Extensions.Maui;

Expand All @@ -21,7 +20,6 @@ public abstract class MauiExtensionBase : MarkupExtension
protected sealed override object? ProvideValue(IXamlServiceProvider serviceProvider)
{
var provideValueTarget = (IProvideValueTarget)serviceProvider.GetService(typeof(IProvideValueTarget));
ThreadHelpers.WhatThreadAmI();

if (provideValueTarget?.TargetObject is View view && provideValueTarget.TargetProperty is ProvideValueTargetProperty targetProperty)
{
Expand Down