This commit is contained in:
Oleksandr Liakhevych 2022-04-12 22:19:10 +03:00
Родитель b2d4c99b9c
Коммит 70038adace
28 изменённых файлов: 24 добавлений и 110 удалений

Просмотреть файл

@ -43,12 +43,6 @@
<MauiFont Include="Resources\Fonts\*" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
<OutputType>WinExe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

Просмотреть файл

@ -1,6 +1,3 @@
@using Microsoft.MobileBlazorBindings
@using Microsoft.MobileBlazorBindings.Elements
@using Microsoft.Maui
@using Microsoft.Maui.Graphics
@using Microsoft.Maui.Essentials
@using MC = Microsoft.Maui.Controls

Просмотреть файл

@ -42,13 +42,7 @@
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
<OutputType>WinExe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT license.
using HybridApp.Data;
using Microsoft.AspNetCore.Components.WebView.Maui;
using Microsoft.MobileBlazorBindings;
namespace HybridApp
@ -13,7 +12,6 @@ namespace HybridApp
{
var builder = MauiApp.CreateBuilder();
builder
.RegisterBlazorMauiWebView()
.UseMauiApp<App>()
.UseMobileBlazorBindings()
.ConfigureFonts(fonts =>
@ -21,7 +19,7 @@ namespace HybridApp
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
builder.Services.AddBlazorWebView();
builder.Services.AddMauiBlazorWebView();
builder.Services.AddSingleton<WeatherForecastService>();
builder.Services.AddSingleton<CounterState>();

Просмотреть файл

@ -1,4 +1,3 @@
@using Microsoft.MobileBlazorBindings
@using Microsoft.MobileBlazorBindings.Elements
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.Maui
@using Microsoft.AspNetCore.Components.Web

Просмотреть файл

@ -42,13 +42,7 @@
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
<OutputType>WinExe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT license.
using HybridAuthApp;
using Microsoft.AspNetCore.Components.WebView.Maui;
using Microsoft.MobileBlazorBindings;
using Microsoft.MobileBlazorBindings.Authentication;
@ -16,7 +15,6 @@ namespace HybridAuthSample
{
var builder = MauiApp.CreateBuilder();
builder
.RegisterBlazorMauiWebView()
.UseMauiApp<App>()
.UseMobileBlazorBindings()
.ConfigureFonts(fonts =>
@ -25,7 +23,7 @@ namespace HybridAuthSample
});
builder.Services
.AddBlazorWebView()
.AddMauiBlazorWebView()
.AddProtectedStorage()
.AddSingleton<CounterState>();

Просмотреть файл

@ -40,12 +40,6 @@
<MauiImage Include="Resources\Images\*" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="SQLitePCLRaw.core" Version="2.0.7" />

Просмотреть файл

@ -1,4 +1,2 @@
@using Microsoft.MobileBlazorBindings
@using Microsoft.MobileBlazorBindings.Elements
@using Microsoft.Maui
@using Microsoft.Maui.Essentials
@using Microsoft.MobileBlazorBindings.Elements

Просмотреть файл

@ -42,12 +42,6 @@
<MauiFont Include="Resources\Fonts\*" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
<OutputType>WinExe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

Просмотреть файл

@ -1,8 +1,5 @@
@using MobileBlazorBindingsXaminals.Models
@using Microsoft.MobileBlazorBindings
@using Microsoft.MobileBlazorBindings.Elements
@using Microsoft.Maui
@using Microsoft.Maui.Graphics
@using Microsoft.Maui.Essentials
@using MobileBlazorBindingsXaminals.Data
@using MobileBlazorBindingsXaminals.Views

Просмотреть файл

@ -3,7 +3,7 @@
using Microsoft.Extensions.Options;
using Microsoft.Identity.Client;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Devices;
using Microsoft.MobileBlazorBindings.ProtectedStorage;
using System;
using System.Collections.Generic;
@ -93,8 +93,8 @@ namespace Microsoft.MobileBlazorBindings.Authentication.Msal
private void SetUpSerializationHandlers(IProtectedStorage protectedStorage)
{
// these platforms have their own secure storage.
if (Device.RuntimePlatform == Device.iOS ||
Device.RuntimePlatform == Device.Android)
if (DeviceInfo.Platform == DevicePlatform.Android
|| DeviceInfo.Platform == DevicePlatform.iOS)
{
return;
}

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT license.
using Microsoft.Extensions.Options;
using Microsoft.Maui.Essentials;
using Microsoft.Maui.Authentication;
using Microsoft.MobileBlazorBindings.ProtectedStorage;
using System;
using System.Linq;

Просмотреть файл

@ -12,7 +12,7 @@ namespace Microsoft.MobileBlazorBindings.Authentication
/// </summary>
[Activity(NoHistory = true, LaunchMode = LaunchMode.SingleTop)]
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable }, DataScheme = "app")]
public class WebAuthenticationCallbackActivity : Maui.Essentials.WebAuthenticatorCallbackActivity
public class WebAuthenticationCallbackActivity : Maui.Authentication.WebAuthenticatorCallbackActivity
{
}
}

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
using Microsoft.Maui.Essentials;
using Microsoft.Maui.Storage;
using System;
using System.Text.Json;
using System.Threading.Tasks;

Просмотреть файл

@ -3,7 +3,6 @@
using MC = Microsoft.Maui.Controls;
using Microsoft.AspNetCore.Components;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
using Microsoft.MobileBlazorBindings.Core;
using Microsoft.MobileBlazorBindings.Elements.Handlers;
@ -32,7 +31,6 @@ namespace Microsoft.MobileBlazorBindings.Elements
[Parameter] public DateTime? MaximumDate { get; set; }
[Parameter] public DateTime? MinimumDate { get; set; }
[Parameter] public Color TextColor { get; set; }
[Parameter] public TextTransform? TextTransform { get; set; }
public new MC.DatePicker NativeControl => ((DatePickerHandler)ElementHandler).DatePickerControl;
@ -80,10 +78,6 @@ namespace Microsoft.MobileBlazorBindings.Elements
{
builder.AddAttribute(nameof(TextColor), AttributeHelper.ColorToString(TextColor));
}
if (TextTransform != null)
{
builder.AddAttribute(nameof(TextTransform), (int)TextTransform.Value);
}
RenderAdditionalAttributes(builder);
}

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT license.
using MC = Microsoft.Maui.Controls;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
using Microsoft.MobileBlazorBindings.Core;
using System;
@ -21,7 +20,6 @@ namespace Microsoft.MobileBlazorBindings.Elements.Handlers
private static readonly DateTime MaximumDateDefaultValue = MC.DatePicker.MaximumDateProperty.DefaultValue is DateTime value ? value : default;
private static readonly DateTime MinimumDateDefaultValue = MC.DatePicker.MinimumDateProperty.DefaultValue is DateTime value ? value : default;
private static readonly Color TextColorDefaultValue = MC.DatePicker.TextColorProperty.DefaultValue is Color value ? value : default;
private static readonly TextTransform TextTransformDefaultValue = MC.DatePicker.TextTransformProperty.DefaultValue is TextTransform value ? value : default;
public DatePickerHandler(NativeComponentRenderer renderer, MC.DatePicker datePickerControl) : base(renderer, datePickerControl)
{
@ -68,9 +66,6 @@ namespace Microsoft.MobileBlazorBindings.Elements.Handlers
case nameof(MC.DatePicker.TextColor):
DatePickerControl.TextColor = AttributeHelper.StringToColor((string)attributeValue, TextColorDefaultValue);
break;
case nameof(MC.DatePicker.TextTransform):
DatePickerControl.TextTransform = (TextTransform)AttributeHelper.GetInt(attributeValue, (int)TextTransformDefaultValue);
break;
default:
base.ApplyAttribute(attributeEventHandlerId, attributeName, attributeValue, attributeEventUpdatesAttributeName);
break;

Просмотреть файл

@ -10,6 +10,7 @@ namespace Microsoft.MobileBlazorBindings.Elements.Handlers
{
public abstract partial class LayoutHandler : ViewHandler
{
private static readonly bool CascadeInputTransparentDefaultValue = MC.Layout.CascadeInputTransparentProperty.DefaultValue is bool value ? value : default;
private static readonly bool IsClippedToBoundsDefaultValue = MC.Layout.IsClippedToBoundsProperty.DefaultValue is bool value ? value : default;
private static readonly Thickness PaddingDefaultValue = MC.Layout.PaddingProperty.DefaultValue is Thickness value ? value : default;
@ -28,6 +29,9 @@ namespace Microsoft.MobileBlazorBindings.Elements.Handlers
{
switch (attributeName)
{
case nameof(MC.Layout.CascadeInputTransparent):
LayoutControl.CascadeInputTransparent = AttributeHelper.GetBool(attributeValue, CascadeInputTransparentDefaultValue);
break;
case nameof(MC.Layout.IgnoreSafeArea):
LayoutControl.IgnoreSafeArea = AttributeHelper.GetBool(attributeValue);
break;

Просмотреть файл

@ -82,9 +82,6 @@ namespace Microsoft.MobileBlazorBindings.Elements.Handlers
case nameof(MC.Picker.TextColor):
PickerControl.TextColor = AttributeHelper.StringToColor((string)attributeValue);
break;
case nameof(MC.Picker.TextTransform):
PickerControl.TextTransform = (TextTransform)AttributeHelper.GetInt(attributeValue, (int)TextTransform.Default);
break;
case nameof(MC.Picker.Title):
PickerControl.Title = (string)attributeValue;
break;

Просмотреть файл

@ -2,7 +2,6 @@
// Licensed under the MIT license.
using MC = Microsoft.Maui.Controls;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
using Microsoft.MobileBlazorBindings.Core;
using System;
@ -18,7 +17,6 @@ namespace Microsoft.MobileBlazorBindings.Elements.Handlers
private static readonly double FontSizeDefaultValue = MC.TimePicker.FontSizeProperty.DefaultValue is double value ? value : default;
private static readonly string FormatDefaultValue = MC.TimePicker.FormatProperty.DefaultValue is string value ? value : default;
private static readonly Color TextColorDefaultValue = MC.TimePicker.TextColorProperty.DefaultValue is Color value ? value : default;
private static readonly TextTransform TextTransformDefaultValue = MC.TimePicker.TextTransformProperty.DefaultValue is TextTransform value ? value : default;
private static readonly TimeSpan TimeDefaultValue = MC.TimePicker.TimeProperty.DefaultValue is TimeSpan value ? value : default;
public TimePickerHandler(NativeComponentRenderer renderer, MC.TimePicker timePickerControl) : base(renderer, timePickerControl)
@ -57,9 +55,6 @@ namespace Microsoft.MobileBlazorBindings.Elements.Handlers
case nameof(MC.TimePicker.TextColor):
TimePickerControl.TextColor = AttributeHelper.StringToColor((string)attributeValue, TextColorDefaultValue);
break;
case nameof(MC.TimePicker.TextTransform):
TimePickerControl.TextTransform = (TextTransform)AttributeHelper.GetInt(attributeValue, (int)TextTransformDefaultValue);
break;
case nameof(MC.TimePicker.Time):
TimePickerControl.Time = AttributeHelper.StringToTimeSpan(attributeValue, TimeDefaultValue);
break;

Просмотреть файл

@ -17,6 +17,7 @@ namespace Microsoft.MobileBlazorBindings.Elements
RegisterAdditionalHandlers();
}
[Parameter] public bool? CascadeInputTransparent { get; set; }
[Parameter] public bool? IgnoreSafeArea { get; set; }
[Parameter] public bool? IsClippedToBounds { get; set; }
[Parameter] public Thickness? Padding { get; set; }
@ -27,6 +28,10 @@ namespace Microsoft.MobileBlazorBindings.Elements
{
base.RenderAttributes(builder);
if (CascadeInputTransparent != null)
{
builder.AddAttribute(nameof(CascadeInputTransparent), CascadeInputTransparent.Value);
}
if (IgnoreSafeArea != null)
{
builder.AddAttribute(nameof(IgnoreSafeArea), IgnoreSafeArea.Value);

Просмотреть файл

@ -59,7 +59,6 @@ namespace Microsoft.MobileBlazorBindings.Elements
/// The <see cref="T:Xamarin.Forms.Color" /> value.
/// </value>
[Parameter] public Color TitleColor { get; set; }
[Parameter] public TextTransform? TextTransform { get; set; }
/// <summary>
/// Gets or sets the vertical alignement of the Text property. This is a bindable property.
/// </summary>
@ -111,10 +110,6 @@ namespace Microsoft.MobileBlazorBindings.Elements
{
builder.AddAttribute(nameof(TextColor), AttributeHelper.ColorToString(TextColor));
}
if (TextTransform != null)
{
builder.AddAttribute(nameof(TextTransform), (int)TextTransform.Value);
}
if (Title != null)
{
builder.AddAttribute(nameof(Title), Title);

Просмотреть файл

@ -3,7 +3,6 @@
using MC = Microsoft.Maui.Controls;
using Microsoft.AspNetCore.Components;
using Microsoft.Maui;
using Microsoft.Maui.Graphics;
using Microsoft.MobileBlazorBindings.Core;
using Microsoft.MobileBlazorBindings.Elements.Handlers;
@ -29,7 +28,6 @@ namespace Microsoft.MobileBlazorBindings.Elements
[Parameter] public double? FontSize { get; set; }
[Parameter] public string Format { get; set; }
[Parameter] public Color TextColor { get; set; }
[Parameter] public TextTransform? TextTransform { get; set; }
[Parameter] public TimeSpan? Time { get; set; }
public new MC.TimePicker NativeControl => ((TimePickerHandler)ElementHandler).TimePickerControl;
@ -66,10 +64,6 @@ namespace Microsoft.MobileBlazorBindings.Elements
{
builder.AddAttribute(nameof(TextColor), AttributeHelper.ColorToString(TextColor));
}
if (TextTransform != null)
{
builder.AddAttribute(nameof(TextTransform), (int)TextTransform.Value);
}
if (Time != null)
{
builder.AddAttribute(nameof(Time), AttributeHelper.TimeSpanToString(Time.Value));

Просмотреть файл

@ -1,7 +1,4 @@
using Microsoft.AspNetCore.Components.WebView.Maui;
using Microsoft.MobileBlazorBindings;
namespace NewApp;
namespace NewApp;
public static class MauiProgram
{
@ -9,7 +6,6 @@ public static class MauiProgram
{
var builder = MauiApp.CreateBuilder();
builder
.RegisterBlazorMauiWebView()
.UseMauiApp<App>()
.UseMobileBlazorBindings()
.ConfigureFonts(fonts =>
@ -17,7 +13,7 @@ public static class MauiProgram
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
builder.Services.AddBlazorWebView();
builder.Services.AddMauiBlazorWebView();
builder.Services.AddSingleton<CounterState>();
return builder.Build();

Просмотреть файл

@ -42,13 +42,7 @@
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.MobileBlazorBindings" Version="MobileBlazorBindingsVersion" />
</ItemGroup>

Просмотреть файл

@ -1,6 +1,3 @@
@using Microsoft.MobileBlazorBindings
@using Microsoft.MobileBlazorBindings.Elements
@using Microsoft.Maui
@using Microsoft.Maui.Graphics
@using Microsoft.Maui.Essentials
@using MC = Microsoft.Maui.Controls

Просмотреть файл

@ -43,12 +43,6 @@
<MauiFont Include="Resources\Fonts\*" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.MobileBlazorBindings" Version="MobileBlazorBindingsVersion" />
</ItemGroup>

Просмотреть файл

@ -1,6 +1,3 @@
@using Microsoft.MobileBlazorBindings
@using Microsoft.MobileBlazorBindings.Elements
@using Microsoft.Maui
@using Microsoft.Maui.Graphics
@using Microsoft.Maui.Essentials
@using MC = Microsoft.Maui.Controls