diff --git a/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs b/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs index 3897a0bf62..5bd3c3d0b1 100644 --- a/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs +++ b/src/Components/Blazor/Blazor/ref/Microsoft.AspNetCore.Blazor.netstandard2.0.cs @@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Blazor.Rendering public override Microsoft.AspNetCore.Components.Dispatcher Dispatcher { get { throw null; } } public System.Threading.Tasks.Task AddComponentAsync(System.Type componentType, string domElementSelector) { throw null; } public System.Threading.Tasks.Task AddComponentAsync(string domElementSelector) where TComponent : Microsoft.AspNetCore.Components.IComponent { throw null; } - public override System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo eventFieldInfo, Microsoft.AspNetCore.Components.UIEventArgs eventArgs) { throw null; } + public override System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo eventFieldInfo, System.EventArgs eventArgs) { throw null; } protected override void Dispose(bool disposing) { } protected override void HandleException(System.Exception exception) { } protected override System.Threading.Tasks.Task UpdateDisplayAsync(in Microsoft.AspNetCore.Components.Rendering.RenderBatch batch) { throw null; } diff --git a/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs b/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs index 528816e492..d4e867621e 100644 --- a/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs +++ b/src/Components/Blazor/Blazor/src/Rendering/WebAssemblyRenderer.cs @@ -120,7 +120,7 @@ namespace Microsoft.AspNetCore.Blazor.Rendering } /// - public override Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, UIEventArgs eventArgs) + public override Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs eventArgs) { // Be sure we only run one event handler at once. Although they couldn't run // simultaneously anyway (there's only one thread), they could run nested on @@ -185,10 +185,10 @@ namespace Microsoft.AspNetCore.Blazor.Rendering { public readonly ulong EventHandlerId; public readonly EventFieldInfo EventFieldInfo; - public readonly UIEventArgs EventArgs; + public readonly EventArgs EventArgs; public readonly TaskCompletionSource TaskCompletionSource; - public IncomingEventInfo(ulong eventHandlerId, EventFieldInfo eventFieldInfo, UIEventArgs eventArgs) + public IncomingEventInfo(ulong eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs eventArgs) { EventHandlerId = eventHandlerId; EventFieldInfo = eventFieldInfo; diff --git a/src/Components/Blazor/Build/test/ComponentRenderingRazorIntegrationTest.cs b/src/Components/Blazor/Build/test/ComponentRenderingRazorIntegrationTest.cs index abfdd07793..6c0a7fab96 100644 --- a/src/Components/Blazor/Build/test/ComponentRenderingRazorIntegrationTest.cs +++ b/src/Components/Blazor/Build/test/ComponentRenderingRazorIntegrationTest.cs @@ -253,7 +253,7 @@ namespace Test public class MyComponent : ComponentBase { [Parameter] - public Action OnClick { get; set; } + public Action OnClick { get; set; } } } ")); @@ -263,7 +263,7 @@ namespace Test @code { private int counter; - private void Increment(UIEventArgs e) { + private void Increment(EventArgs e) { counter++; } }"); @@ -280,7 +280,7 @@ namespace Test AssertFrame.Attribute(frame, "OnClick", 1); // The handler will have been assigned to a lambda - var handler = Assert.IsType>(frame.AttributeValue); + var handler = Assert.IsType>(frame.AttributeValue); Assert.Equal("Test.TestComponent", handler.Target.GetType().FullName); Assert.Equal("Increment", handler.Method.Name); }); diff --git a/src/Components/Blazor/Build/test/RenderingRazorIntegrationTest.cs b/src/Components/Blazor/Build/test/RenderingRazorIntegrationTest.cs index 8b91c024b4..990ec1db18 100644 --- a/src/Components/Blazor/Build/test/RenderingRazorIntegrationTest.cs +++ b/src/Components/Blazor/Build/test/RenderingRazorIntegrationTest.cs @@ -332,7 +332,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // Trigger the change event to show it updates the property // // This should always complete synchronously. - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = "Modified value", })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = "Modified value", })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; @@ -367,7 +367,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // Trigger the change event to show it updates the property // // This should always complete synchronously. - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = "Modified value", })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = "Modified value", })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; @@ -404,7 +404,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // // This should always complete synchronously. var newDateValue = new DateTime(2018, 3, 5, 4, 5, 6); - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = newDateValue.ToString(), })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = newDateValue.ToString(), })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; @@ -440,7 +440,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // Trigger the change event to show it updates the property // // This should always complete synchronously. - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = new DateTime(2018, 3, 5).ToString(testDateFormat), })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = new DateTime(2018, 3, 5).ToString(testDateFormat), })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; @@ -559,7 +559,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // Trigger the change event to show it updates the property // // This should always complete synchronously. - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs() { Value = false, })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs() { Value = false, })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; @@ -595,7 +595,7 @@ namespace Microsoft.AspNetCore.Blazor.Build.Test // Trigger the change event to show it updates the property // // This should always complete synchronously. - var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new UIChangeEventArgs { Value = MyEnum.SecondValue.ToString(), })); + var task = renderer.Dispatcher.InvokeAsync(() => setter.InvokeAsync(new ChangeEventArgs { Value = MyEnum.SecondValue.ToString(), })); Assert.Equal(TaskStatus.RanToCompletion, task.Status); await task; diff --git a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs index c9276fab24..6f24d20761 100644 --- a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs +++ b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs @@ -119,6 +119,11 @@ namespace Microsoft.AspNetCore.Components public void Attach(Microsoft.AspNetCore.Components.RenderHandle renderHandle) { } public System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterView parameters) { throw null; } } + public partial class ChangeEventArgs : System.EventArgs + { + public ChangeEventArgs() { } + public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } public abstract partial class ComponentBase : Microsoft.AspNetCore.Components.IComponent, Microsoft.AspNetCore.Components.IHandleAfterRender, Microsoft.AspNetCore.Components.IHandleEvent { public ComponentBase() { } @@ -188,35 +193,35 @@ namespace Microsoft.AspNetCore.Components } public static partial class EventCallbackFactoryBinderExtensions { - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; } } - public static partial class EventCallbackFactoryUIEventArgsExtensions + public static partial class EventCallbackFactoryEventArgsExtensions { - public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action callback) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action callback) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func callback) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func callback) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action callback) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action callback) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func callback) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback Create(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func callback) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct EventCallbackWorkItem @@ -365,16 +370,6 @@ namespace Microsoft.AspNetCore.Components public RouteAttribute(string template) { } public string Template { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } - public partial class UIChangeEventArgs : Microsoft.AspNetCore.Components.UIEventArgs - { - public UIChangeEventArgs() { } - public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } - public partial class UIEventArgs - { - public UIEventArgs() { } - public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } - } public abstract partial class UriHelperBase : Microsoft.AspNetCore.Components.IUriHelper { protected UriHelperBase() { } @@ -516,7 +511,7 @@ namespace Microsoft.AspNetCore.Components.Rendering public event System.UnhandledExceptionEventHandler UnhandledSynchronizationException { add { } remove { } } protected internal virtual void AddToRenderQueue(int componentId, Microsoft.AspNetCore.Components.RenderFragment renderFragment) { } protected internal int AssignRootComponentId(Microsoft.AspNetCore.Components.IComponent component) { throw null; } - public virtual System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo fieldInfo, Microsoft.AspNetCore.Components.UIEventArgs eventArgs) { throw null; } + public virtual System.Threading.Tasks.Task DispatchEventAsync(ulong eventHandlerId, Microsoft.AspNetCore.Components.Rendering.EventFieldInfo fieldInfo, System.EventArgs eventArgs) { throw null; } public void Dispose() { } protected virtual void Dispose(bool disposing) { } protected abstract void HandleException(System.Exception exception); diff --git a/src/Components/Components/src/UIEventArgs.cs b/src/Components/Components/src/ChangeEventArgs.cs similarity index 58% rename from src/Components/Components/src/UIEventArgs.cs rename to src/Components/Components/src/ChangeEventArgs.cs index 8be500d2ae..e64e4c10c7 100644 --- a/src/Components/Components/src/UIEventArgs.cs +++ b/src/Components/Components/src/ChangeEventArgs.cs @@ -1,16 +1,19 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; + namespace Microsoft.AspNetCore.Components { /// - /// Supplies information about an event that is being raised. + /// Supplies information about an change event that is being raised. /// - public class UIEventArgs + public class ChangeEventArgs : EventArgs { /// - /// Gets or sets the type of the event. + /// Gets or sets the new value. /// - public string Type { get; set; } + public object Value { get; set; } + } } diff --git a/src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs b/src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs index a007c47f09..99eac1965a 100644 --- a/src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs +++ b/src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs @@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -145,7 +145,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -164,7 +164,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -183,7 +183,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -202,7 +202,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -221,7 +221,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -240,7 +240,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -259,7 +259,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -278,7 +278,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -298,7 +298,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -318,7 +318,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -338,7 +338,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -358,7 +358,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -378,7 +378,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -398,7 +398,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -418,7 +418,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -439,7 +439,7 @@ namespace Microsoft.AspNetCore.Components /// /// /// - public static EventCallback CreateBinder( + public static EventCallback CreateBinder( this EventCallbackFactory factory, object receiver, Action setter, @@ -449,14 +449,14 @@ namespace Microsoft.AspNetCore.Components return CreateBinderCore(factory, receiver, setter, culture, ParserDelegateCache.Get()); } - private static EventCallback CreateBinderCore( + private static EventCallback CreateBinderCore( this EventCallbackFactory factory, object receiver, Action setter, CultureInfo culture, BindConverter.BindParser converter) { - Action callback = e => + Action callback = e => { T value = default; var converted = false; @@ -489,10 +489,10 @@ namespace Microsoft.AspNetCore.Components setter(default); } }; - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } - private static EventCallback CreateBinderCore( + private static EventCallback CreateBinderCore( this EventCallbackFactory factory, object receiver, Action setter, @@ -500,7 +500,7 @@ namespace Microsoft.AspNetCore.Components string format, BindConverter.BindParserWithFormat converter) { - Action callback = e => + Action callback = e => { T value = default; var converted = false; @@ -533,7 +533,7 @@ namespace Microsoft.AspNetCore.Components setter(default); } }; - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } } } diff --git a/src/Components/Components/src/EventCallbackFactoryUIEventArgsExtensions.cs b/src/Components/Components/src/EventCallbackFactoryEventArgsExtensions.cs similarity index 74% rename from src/Components/Components/src/EventCallbackFactoryUIEventArgsExtensions.cs rename to src/Components/Components/src/EventCallbackFactoryEventArgsExtensions.cs index bf19b94c68..d0c4aec303 100644 --- a/src/Components/Components/src/EventCallbackFactoryUIEventArgsExtensions.cs +++ b/src/Components/Components/src/EventCallbackFactoryEventArgsExtensions.cs @@ -7,9 +7,9 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Components { /// - /// Provides extension methods for and types. + /// Provides extension methods for and types. /// - public static class EventCallbackFactoryUIEventArgsExtensions + public static class EventCallbackFactoryEventArgsExtensions { /// /// Creates an for the provided and @@ -19,14 +19,14 @@ namespace Microsoft.AspNetCore.Components /// The event receiver. /// The event callback. /// The . - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) + public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } /// @@ -37,14 +37,14 @@ namespace Microsoft.AspNetCore.Components /// The event receiver. /// The event callback. /// The . - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) + public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } /// @@ -55,14 +55,14 @@ namespace Microsoft.AspNetCore.Components /// The event receiver. /// The event callback. /// The . - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) + public static EventCallback Create(this EventCallbackFactory factory, object receiver, Action callback) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } /// @@ -73,14 +73,14 @@ namespace Microsoft.AspNetCore.Components /// The event receiver. /// The event callback. /// The . - public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) + public static EventCallback Create(this EventCallbackFactory factory, object receiver, Func callback) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } - return factory.Create(receiver, callback); + return factory.Create(receiver, callback); } } } diff --git a/src/Components/Components/src/Rendering/Renderer.Log.cs b/src/Components/Components/src/Rendering/Renderer.Log.cs index 68a28b62a1..3b70f58973 100644 --- a/src/Components/Components/src/Rendering/Renderer.Log.cs +++ b/src/Components/Components/src/Rendering/Renderer.Log.cs @@ -56,9 +56,9 @@ namespace Microsoft.AspNetCore.Components.Rendering } } - internal static void HandlingEvent(ILogger logger, ulong eventHandlerId, UIEventArgs eventArgs) + internal static void HandlingEvent(ILogger logger, ulong eventHandlerId, EventArgs eventArgs) { - _handlingEvent(logger, eventHandlerId, eventArgs?.Type ?? "null", null); + _handlingEvent(logger, eventHandlerId, eventArgs?.GetType().Name ?? "null", null); } } } diff --git a/src/Components/Components/src/Rendering/Renderer.cs b/src/Components/Components/src/Rendering/Renderer.cs index 83505bd61e..8cbc6b78b6 100644 --- a/src/Components/Components/src/Rendering/Renderer.cs +++ b/src/Components/Components/src/Rendering/Renderer.cs @@ -206,7 +206,7 @@ namespace Microsoft.AspNetCore.Components.Rendering /// A which will complete once all asynchronous processing related to the event /// has completed. /// - public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, UIEventArgs eventArgs) + public virtual Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs) { EnsureSynchronizationContext(); diff --git a/src/Components/Components/src/UIChangeEventArgs.cs b/src/Components/Components/src/UIChangeEventArgs.cs deleted file mode 100644 index 79402eb55e..0000000000 --- a/src/Components/Components/src/UIChangeEventArgs.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.AspNetCore.Components -{ - /// - /// Supplies information about an input change event that is being raised. - /// - public class UIChangeEventArgs : UIEventArgs - { - /// - /// Gets or sets the new value of the input. This may be a - /// or a . - /// - public object Value { get; set; } - } -} diff --git a/src/Components/Components/test/EventCallbackFactoryBinderExtensionsTest.cs b/src/Components/Components/test/EventCallbackFactoryBinderExtensionsTest.cs index 0a588259cc..8df5092112 100644 --- a/src/Components/Components/test/EventCallbackFactoryBinderExtensionsTest.cs +++ b/src/Components/Components/test/EventCallbackFactoryBinderExtensionsTest.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Components var binder = EventCallback.Factory.CreateBinder(component, setter, value); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "not-an-integer!", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "not-an-integer!", }); Assert.Equal(17, value); // Setter not called Assert.Equal(1, component.Count); @@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Components var binder = EventCallback.Factory.CreateBinder(component, setter, value); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = string.Empty, }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = string.Empty, }); Assert.Equal(0, value); // Calls setter to apply default value for this type Assert.Equal(1, component.Count); @@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Components // Act await Assert.ThrowsAsync(() => { - return binder.InvokeAsync(new UIChangeEventArgs() { Value = "18", }); + return binder.InvokeAsync(new ChangeEventArgs() { Value = "18", }); }); Assert.Equal(1, component.Count); @@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Components var binder = EventCallback.Factory.CreateBinder(component, setter, value); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "not-an-integer!", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "not-an-integer!", }); Assert.Equal(17, value); // Setter not called Assert.Equal(1, component.Count); @@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Components var binder = EventCallback.Factory.CreateBinder(component, setter, value); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "", }); Assert.Null(value); // Setter called Assert.Equal(1, component.Count); @@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = "bye"; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue, }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue, }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = true; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = true, }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = true, }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -149,7 +149,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (bool?)true; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = true, }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = true, }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = 42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -187,7 +187,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (int?)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -206,7 +206,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (long)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -225,7 +225,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (long?)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -244,7 +244,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (float)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -263,7 +263,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (float?)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -282,7 +282,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (double)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -301,7 +301,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (double?)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -320,7 +320,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (decimal)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -339,7 +339,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = (decimal?)42; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -358,7 +358,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = AttributeTargets.Class; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -377,7 +377,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = AttributeTargets.Class; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -396,7 +396,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -415,7 +415,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -435,7 +435,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -455,7 +455,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -474,7 +474,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -493,7 +493,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4, 1, 2, 3); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -513,7 +513,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -533,7 +533,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new DateTime(2018, 3, 4); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(format), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(format), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -553,7 +553,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = Guid.NewGuid(); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -573,7 +573,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = Guid.NewGuid(); // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -592,7 +592,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = new SecretMessage() { Message = "TypeConverter may be old, but it still works!", }; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = expectedValue.ToString(), }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = expectedValue.ToString(), }); Assert.Equal(expectedValue.Message, value.Message); Assert.Equal(1, component.Count); @@ -627,7 +627,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = 42_000; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42 000,00", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42 000,00", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); @@ -646,7 +646,7 @@ namespace Microsoft.AspNetCore.Components var expectedValue = 42_000; // Act - await binder.InvokeAsync(new UIChangeEventArgs() { Value = "42,000.00", }); + await binder.InvokeAsync(new ChangeEventArgs() { Value = "42,000.00", }); Assert.Equal(expectedValue, value); Assert.Equal(1, component.Count); diff --git a/src/Components/Components/test/EventCallbackTest.cs b/src/Components/Components/test/EventCallbackTest.cs index 6fc1e601ca..25405c2180 100644 --- a/src/Components/Components/test/EventCallbackTest.cs +++ b/src/Components/Components/test/EventCallbackTest.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Components public async Task EventCallbackOfT_Default() { // Arrange - var callback = default(EventCallback); + var callback = default(EventCallback); // Act & Assert (Does not throw) await callback.InvokeAsync(null); @@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Components { // Arrange int runCount = 0; - var callback = new EventCallback(null, (Action)(() => runCount++)); + var callback = new EventCallback(null, (Action)(() => runCount++)); // Act await callback.InvokeAsync(null); @@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Components var callback = new EventCallback(component, (Action)(() => runCount++)); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -104,8 +104,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); // Act await callback.InvokeAsync(null); @@ -124,11 +124,11 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -164,8 +164,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); // Act & Assert await Assert.ThrowsAsync(() => @@ -202,7 +202,7 @@ namespace Microsoft.AspNetCore.Components var callback = new EventCallback(component, (Func)(() => { runCount++; return Task.CompletedTask; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -217,8 +217,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); // Act await callback.InvokeAsync(null); @@ -237,11 +237,11 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -277,8 +277,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); // Act & Assert await Assert.ThrowsAsync(() => @@ -294,7 +294,7 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - var callback = new EventCallback(component, (Action)(() => runCount++)); + var callback = new EventCallback(component, (Action)(() => runCount++)); // Act await callback.InvokeAsync(null); @@ -312,10 +312,10 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - var callback = new EventCallback(component, (Action)(() => runCount++)); + var callback = new EventCallback(component, (Action)(() => runCount++)); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -330,8 +330,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); // Act await callback.InvokeAsync(null); @@ -350,11 +350,11 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Action)((e) => { arg = e; runCount++; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -370,7 +370,7 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - var callback = new EventCallback(component, (Func)(() => { runCount++; return Task.CompletedTask; })); + var callback = new EventCallback(component, (Func)(() => { runCount++; return Task.CompletedTask; })); // Act await callback.InvokeAsync(null); @@ -388,10 +388,10 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - var callback = new EventCallback(component, (Func)(() => { runCount++; return Task.CompletedTask; })); + var callback = new EventCallback(component, (Func)(() => { runCount++; return Task.CompletedTask; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert @@ -406,8 +406,8 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); // Act await callback.InvokeAsync(null); @@ -426,11 +426,11 @@ namespace Microsoft.AspNetCore.Components var component = new EventCountingComponent(); int runCount = 0; - UIEventArgs arg = null; - var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); + EventArgs arg = null; + var callback = new EventCallback(component, (Func)((e) => { arg = e; runCount++; return Task.CompletedTask; })); // Act - await callback.InvokeAsync(new UIEventArgs()); + await callback.InvokeAsync(new EventArgs()); // Assert diff --git a/src/Components/Components/test/RenderTreeBuilderTest.cs b/src/Components/Components/test/RenderTreeBuilderTest.cs index c90259f057..3e5cc0b969 100644 --- a/src/Components/Components/test/RenderTreeBuilderTest.cs +++ b/src/Components/Components/test/RenderTreeBuilderTest.cs @@ -216,7 +216,7 @@ namespace Microsoft.AspNetCore.Components.Test { // Arrange var builder = new RenderTreeBuilder(); - Action eventHandler = eventInfo => { }; + Action eventHandler = eventInfo => { }; // Act builder.OpenElement(0, "myelement"); // 0: eventHandler = eventInfo => { }; + Action eventHandler = eventInfo => { }; // Act builder.OpenElement(0, "myelement"); @@ -428,7 +428,7 @@ namespace Microsoft.AspNetCore.Components.Test { builder.OpenElement(0, "some element"); builder.AddContent(1, "hello"); - builder.AddAttribute(2, "name", new Action(eventInfo => { })); + builder.AddAttribute(2, "name", new Action(eventInfo => { })); }); } @@ -897,7 +897,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var builder = new RenderTreeBuilder(); - var value = new Action((e) => { }); + var value = new Action((e) => { }); // Act builder.OpenElement(0, "elem"); @@ -919,7 +919,7 @@ namespace Microsoft.AspNetCore.Components.Test // Act builder.OpenElement(0, "elem"); - builder.AddAttribute(1, "attr", (Action)null); + builder.AddAttribute(1, "attr", (Action)null); builder.CloseElement(); // Assert @@ -965,7 +965,7 @@ namespace Microsoft.AspNetCore.Components.Test frame => AssertFrame.Element(frame, "elem", 1, 0)); } - public static TheoryData> EventHandlerValues => new TheoryData> + public static TheoryData> EventHandlerValues => new TheoryData> { null, (e) => { }, @@ -973,7 +973,7 @@ namespace Microsoft.AspNetCore.Components.Test [Theory] [MemberData(nameof(EventHandlerValues))] - public void AddAttribute_Component_EventHandlerValue_SetsAttributeValue(Action value) + public void AddAttribute_Component_EventHandlerValue_SetsAttributeValue(Action value) { // Arrange var builder = new RenderTreeBuilder(); @@ -1241,7 +1241,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var builder = new RenderTreeBuilder(); - var value = new Action((e) => { }); + var value = new Action((e) => { }); // Act builder.OpenElement(0, "elem"); @@ -1261,7 +1261,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var builder = new RenderTreeBuilder(); - var value = new Action((e) => { }); + var value = new Action((e) => { }); // Act builder.OpenComponent(0); diff --git a/src/Components/Components/test/RenderTreeDiffBuilderTest.cs b/src/Components/Components/test/RenderTreeDiffBuilderTest.cs index 3c0edffd62..45e7fdcba1 100644 --- a/src/Components/Components/test/RenderTreeDiffBuilderTest.cs +++ b/src/Components/Components/test/RenderTreeDiffBuilderTest.cs @@ -835,9 +835,9 @@ namespace Microsoft.AspNetCore.Components.Test public void RecognizesAttributeEventHandlerValuesChanged() { // Arrange - Action retainedHandler = _ => { }; - Action removedHandler = _ => { }; - Action addedHandler = _ => { }; + Action retainedHandler = _ => { }; + Action removedHandler = _ => { }; + Action addedHandler = _ => { }; oldTree.OpenElement(0, "My element"); oldTree.AddAttribute(1, "onfoo", retainedHandler); oldTree.AddAttribute(2, "onbar", removedHandler); @@ -1575,7 +1575,7 @@ namespace Microsoft.AspNetCore.Components.Test public void PreservesEventHandlerIdsForRetainedEventHandlers() { // Arrange - Action retainedHandler = _ => { }; + Action retainedHandler = _ => { }; oldTree.OpenElement(0, "My element"); oldTree.AddAttribute(1, "ontest", retainedHandler); oldTree.CloseElement(); @@ -1601,7 +1601,7 @@ namespace Microsoft.AspNetCore.Components.Test public void PreservesEventHandlerIdsForRetainedEventHandlers_SlowPath() { // Arrange - Action retainedHandler = _ => { }; + Action retainedHandler = _ => { }; oldTree.OpenElement(0, "My element"); oldTree.AddAttribute(0, "ontest", retainedHandler); oldTree.CloseElement(); diff --git a/src/Components/Components/test/RendererTest.cs b/src/Components/Components/test/RendererTest.cs index c404e5360f..f895c47f10 100644 --- a/src/Components/Components/test/RendererTest.cs +++ b/src/Components/Components/test/RendererTest.cs @@ -430,7 +430,7 @@ namespace Microsoft.AspNetCore.Components.Test { // Arrange: Render a component with an event handler var renderer = new TestRenderer(); - UIEventArgs receivedArgs = null; + EventArgs receivedArgs = null; var component = new EventComponent { @@ -448,7 +448,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Null(receivedArgs); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs); // This should always be run synchronously @@ -460,7 +460,7 @@ namespace Microsoft.AspNetCore.Components.Test { // Arrange: Render a component with an event handler var renderer = new TestRenderer(); - UIEventArgs receivedArgs = null; + EventArgs receivedArgs = null; var component = new EventComponent { @@ -478,7 +478,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Null(receivedArgs); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs); Assert.True(renderTask.IsCompletedSuccessfully); Assert.Same(eventArgs, receivedArgs); @@ -508,7 +508,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Empty(renderer.HandledExceptions); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs); Assert.True(renderTask.IsCompletedSuccessfully); @@ -577,7 +577,7 @@ namespace Microsoft.AspNetCore.Components.Test [Fact] public void CanDispatchEventsToNestedComponents() { - UIEventArgs receivedArgs = null; + EventArgs receivedArgs = null; // Arrange: Render parent component var renderer = new TestRenderer(); @@ -608,7 +608,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Null(receivedArgs); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var renderTask = renderer.DispatchEventAsync(eventHandlerId, eventArgs); Assert.True(renderTask.IsCompletedSuccessfully); Assert.Same(eventArgs, receivedArgs); @@ -619,7 +619,7 @@ namespace Microsoft.AspNetCore.Components.Test { // Arrange: Render a component with an event handler var renderer = new TestRenderer(); - UIEventArgs receivedArgs = null; + EventArgs receivedArgs = null; var state = 0; var tcs = new TaskCompletionSource(); @@ -646,7 +646,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Null(receivedArgs); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs); Assert.Equal(1, state); Assert.Same(eventArgs, receivedArgs); @@ -746,7 +746,7 @@ namespace Microsoft.AspNetCore.Components.Test [Fact] public async Task CanAsyncDispatchEventsToNestedComponents() { - UIEventArgs receivedArgs = null; + EventArgs receivedArgs = null; var state = 0; var tcs = new TaskCompletionSource(); @@ -786,7 +786,7 @@ namespace Microsoft.AspNetCore.Components.Test Assert.Null(receivedArgs); // Act/Assert: Event can be fired - var eventArgs = new UIEventArgs(); + var eventArgs = new EventArgs(); var task = renderer.DispatchEventAsync(eventHandlerId, eventArgs); Assert.Equal(1, state); Assert.Same(eventArgs, receivedArgs); @@ -1774,7 +1774,7 @@ namespace Microsoft.AspNetCore.Components.Test // Act/Assert await Assert.ThrowsAsync(() => { - return renderer.DispatchEventAsync(0, new UIEventArgs()); + return renderer.DispatchEventAsync(0, new EventArgs()); }); } @@ -2052,7 +2052,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var renderer = new TestRenderer(); var eventCount = 0; - Action origEventHandler = args => { eventCount++; }; + Action origEventHandler = args => { eventCount++; }; var component = new EventComponent { OnTest = origEventHandler }; var componentId = renderer.AssignRootComponentId(component); component.TriggerRender(); @@ -2094,7 +2094,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var renderer = new TestRenderer(); var eventCount = 0; - Action origEventHandler = args => { eventCount++; }; + Action origEventHandler = args => { eventCount++; }; var component = new EventComponent { OnTest = origEventHandler }; var componentId = renderer.AssignRootComponentId(component); component.TriggerRender(); @@ -2129,7 +2129,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var renderer = new TestRenderer(); var eventCount = 0; - Action origEventHandler = args => { eventCount++; }; + Action origEventHandler = args => { eventCount++; }; var component = new ConditionalParentComponent { IncludeChild = true, @@ -2180,7 +2180,7 @@ namespace Microsoft.AspNetCore.Components.Test // Arrange var renderer = new TestRenderer(); var eventCount = 0; - Action origEventHandler = args => { eventCount++; }; + Action origEventHandler = args => { eventCount++; }; var component = new EventComponent { OnTest = origEventHandler }; var componentId = renderer.AssignRootComponentId(component); component.TriggerRender(); @@ -2222,7 +2222,7 @@ namespace Microsoft.AspNetCore.Components.Test { builder.AddContent(0, "Child event count: " + eventCount); builder.OpenComponent(1); - builder.AddAttribute(2, nameof(EventComponent.OnTest), new Action(args => + builder.AddAttribute(2, nameof(EventComponent.OnTest), new Action(args => { eventCount++; rootComponent.TriggerRender(); @@ -2468,7 +2468,7 @@ namespace Microsoft.AspNetCore.Components.Test .AttributeEventHandlerId; // Act: Toggle the checkbox - var eventArgs = new UIChangeEventArgs { Value = true }; + var eventArgs = new ChangeEventArgs { Value = true }; var renderTask = renderer.DispatchEventAsync(checkboxChangeEventHandlerId, eventArgs); Assert.True(renderTask.IsCompletedSuccessfully); @@ -2713,7 +2713,7 @@ namespace Microsoft.AspNetCore.Components.Test }; var numEventsFired = 0; EventComponent component = null; - Action eventHandler = null; + Action eventHandler = null; eventHandler = _ => { @@ -2737,14 +2737,14 @@ namespace Microsoft.AspNetCore.Components.Test // Act/Assert 1: Event can be fired for the first time var render1TCS = new TaskCompletionSource(); renderer.NextUpdateDisplayReturnTask = render1TCS.Task; - await renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs()); + await renderer.DispatchEventAsync(eventHandlerId, new EventArgs()); Assert.Equal(1, numEventsFired); // Act/Assert 2: *Same* event handler ID can be reused prior to completion of // preceding UI update var render2TCS = new TaskCompletionSource(); renderer.NextUpdateDisplayReturnTask = render2TCS.Task; - await renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs()); + await renderer.DispatchEventAsync(eventHandlerId, new EventArgs()); Assert.Equal(2, numEventsFired); // Act/Assert 3: After we complete the first UI update in which a given @@ -2760,7 +2760,7 @@ namespace Microsoft.AspNetCore.Components.Test await awaitableTask; var ex = await Assert.ThrowsAsync(() => { - return renderer.DispatchEventAsync(eventHandlerId, new UIEventArgs()); + return renderer.DispatchEventAsync(eventHandlerId, new EventArgs()); }); Assert.Equal($"There is no event handler with ID {eventHandlerId}", ex.Message); Assert.Equal(2, numEventsFired); @@ -3318,7 +3318,7 @@ namespace Microsoft.AspNetCore.Components.Test FieldValue = "new property value", ComponentId = componentId }; - var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, eventFieldInfo, new UIChangeEventArgs + var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, eventFieldInfo, new ChangeEventArgs { Value = "new property value" }); @@ -3336,7 +3336,7 @@ namespace Microsoft.AspNetCore.Components.Test // show that the diff does *not* update the BoundString value attribute. Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type); var attributeFrame = batch2.ReferenceFrames[edit.ReferenceFrameIndex]; - AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action)); + AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action)); Assert.NotEqual(default, attributeFrame.AttributeEventHandlerId); Assert.NotEqual(eventHandlerId, attributeFrame.AttributeEventHandlerId); }); @@ -3370,7 +3370,7 @@ namespace Microsoft.AspNetCore.Components.Test ComponentId = componentId, FieldValue = newPropertyValue, }; - var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, fieldInfo, new UIChangeEventArgs + var dispatchEventTask = renderer.DispatchEventAsync(eventHandlerId, fieldInfo, new ChangeEventArgs { Value = newPropertyValue }); @@ -3388,7 +3388,7 @@ namespace Microsoft.AspNetCore.Components.Test // show that the diff does *not* update the BoundString value attribute. Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type); var attributeFrame = latestBatch.ReferenceFrames[edit.ReferenceFrameIndex]; - AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action)); + AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action)); Assert.NotEqual(default, attributeFrame.AttributeEventHandlerId); Assert.NotEqual(eventHandlerId, attributeFrame.AttributeEventHandlerId); }); @@ -3507,10 +3507,10 @@ namespace Microsoft.AspNetCore.Components.Test private class EventComponent : AutoRenderComponent, IComponent, IHandleEvent { [Parameter] - public Action OnTest { get; set; } + public Action OnTest { get; set; } [Parameter] - public Func OnTestAsync { get; set; } + public Func OnTestAsync { get; set; } [Parameter] public Action OnClick { get; set; } @@ -3664,7 +3664,7 @@ namespace Microsoft.AspNetCore.Components.Test => _renderHandle.Render(builder => { builder.OpenElement(0, "my button"); - builder.AddAttribute(1, "my click handler", new Action(eventArgs => OnClick(eventArgs))); + builder.AddAttribute(1, "my click handler", new Action(eventArgs => OnClick(eventArgs))); builder.CloseElement(); }); } @@ -4095,7 +4095,7 @@ namespace Microsoft.AspNetCore.Components.Test builder.OpenElement(0, "element with event"); builder.AddAttribute(1, nameof(BoundString), BoundString); - builder.AddAttribute(2, "ontestevent", new Action((UIChangeEventArgs eventArgs) => + builder.AddAttribute(2, "ontestevent", new Action((ChangeEventArgs eventArgs) => { BoundString = (string)eventArgs.Value; TriggerRender(); @@ -4106,7 +4106,7 @@ namespace Microsoft.AspNetCore.Components.Test } } - private class DerivedEventArgs : UIEventArgs + private class DerivedEventArgs : EventArgs { } } diff --git a/src/Components/Components/test/Rendering/HtmlRendererTestBase.cs b/src/Components/Components/test/Rendering/HtmlRendererTestBase.cs index 894c8d4703..d12aaf32ad 100644 --- a/src/Components/Components/test/Rendering/HtmlRendererTestBase.cs +++ b/src/Components/Components/test/Rendering/HtmlRendererTestBase.cs @@ -343,7 +343,7 @@ namespace Microsoft.AspNetCore.Components.Rendering { rtb.OpenElement(0, "p"); rtb.OpenElement(1, "input"); - rtb.AddAttribute(2, "change", pc.GetValueOrDefault>("update")); + rtb.AddAttribute(2, "change", pc.GetValueOrDefault>("update")); rtb.AddAttribute(3, "value", pc.GetValueOrDefault("value")); rtb.CloseElement(); rtb.CloseElement(); @@ -354,7 +354,7 @@ namespace Microsoft.AspNetCore.Components.Rendering .BuildServiceProvider(); var htmlRenderer = GetHtmlRenderer(serviceProvider); - Action change = (UIChangeEventArgs changeArgs) => throw new InvalidOperationException(); + Action change = (ChangeEventArgs changeArgs) => throw new InvalidOperationException(); // Act var result = GetResult(htmlRenderer.Dispatcher.InvokeAsync(() => htmlRenderer.RenderComponentAsync( diff --git a/src/Components/Shared/test/AssertFrame.cs b/src/Components/Shared/test/AssertFrame.cs index b0cff34f41..1fb2debbf2 100644 --- a/src/Components/Shared/test/AssertFrame.cs +++ b/src/Components/Shared/test/AssertFrame.cs @@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Components.Test.Helpers Assert.Equal(attributeValue, frame.AttributeValue); } - public static void Attribute(RenderTreeFrame frame, string attributeName, Action attributeEventHandlerValue, int? sequence = null) + public static void Attribute(RenderTreeFrame frame, string attributeName, Action attributeEventHandlerValue, int? sequence = null) { AssertFrame.Attribute(frame, attributeName, sequence); Assert.Equal(attributeEventHandlerValue, frame.AttributeValue); diff --git a/src/Components/Shared/test/TestRenderer.cs b/src/Components/Shared/test/TestRenderer.cs index 6b5f751818..d5ce07bf4b 100644 --- a/src/Components/Shared/test/TestRenderer.cs +++ b/src/Components/Shared/test/TestRenderer.cs @@ -60,10 +60,10 @@ namespace Microsoft.AspNetCore.Components.Test.Helpers public new Task RenderRootComponentAsync(int componentId, ParameterView parameters) => Dispatcher.InvokeAsync(() => base.RenderRootComponentAsync(componentId, parameters)); - public Task DispatchEventAsync(ulong eventHandlerId, UIEventArgs args) + public Task DispatchEventAsync(ulong eventHandlerId, EventArgs args) => Dispatcher.InvokeAsync(() => base.DispatchEventAsync(eventHandlerId, null, args)); - public new Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, UIEventArgs args) + public new Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo eventFieldInfo, EventArgs args) => Dispatcher.InvokeAsync(() => base.DispatchEventAsync(eventHandlerId, eventFieldInfo, args)); private static Task UnwrapTask(Task task) diff --git a/src/Components/Web/ref/Microsoft.AspNetCore.Components.Web.netstandard2.0.cs b/src/Components/Web/ref/Microsoft.AspNetCore.Components.Web.netstandard2.0.cs index 30fc3e3d99..034b500218 100644 --- a/src/Components/Web/ref/Microsoft.AspNetCore.Components.Web.netstandard2.0.cs +++ b/src/Components/Web/ref/Microsoft.AspNetCore.Components.Web.netstandard2.0.cs @@ -53,23 +53,23 @@ namespace Microsoft.AspNetCore.Components public System.Type EventArgsType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } [Microsoft.AspNetCore.Components.EventHandlerAttribute("onabort", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecopy", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecut", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforedeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforepaste", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onactivate", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforeactivate", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecopy", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforecut", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforedeactivate", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onbeforepaste", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onblur", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplay", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplaythrough", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onchange", typeof(Microsoft.AspNetCore.Components.UIChangeEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplay", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncanplaythrough", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onchange", typeof(Microsoft.AspNetCore.Components.ChangeEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onclick", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncontextmenu", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncopy", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncuechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncuechange", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("oncut", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondblclick", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondeactivate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondeactivate", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondrag", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragend", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragenter", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] @@ -77,24 +77,24 @@ namespace Microsoft.AspNetCore.Components [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragover", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondragstart", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondrop", typeof(Microsoft.AspNetCore.Components.UIDragEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondurationchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onemptied", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onended", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("ondurationchange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onemptied", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onended", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onerror", typeof(Microsoft.AspNetCore.Components.UIErrorEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocus", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocusin", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfocusout", typeof(Microsoft.AspNetCore.Components.UIFocusEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenerror", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenchange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onfullscreenerror", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ongotpointercapture", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("oninput", typeof(Microsoft.AspNetCore.Components.UIChangeEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("oninvalid", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("oninput", typeof(Microsoft.AspNetCore.Components.ChangeEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("oninvalid", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeydown", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeypress", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onkeyup", typeof(Microsoft.AspNetCore.Components.UIKeyboardEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onload", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadeddata", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadedmetadata", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadeddata", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadedmetadata", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadend", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onloadstart", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onlostpointercapture", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] @@ -105,50 +105,51 @@ namespace Microsoft.AspNetCore.Components [Microsoft.AspNetCore.Components.EventHandlerAttribute("onmouseup", typeof(Microsoft.AspNetCore.Components.UIMouseEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onmousewheel", typeof(Microsoft.AspNetCore.Components.UIWheelEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpaste", typeof(Microsoft.AspNetCore.Components.UIClipboardEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpause", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onplay", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onplaying", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpause", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onplay", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onplaying", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointercancel", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerdown", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerenter", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerleave", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockerror", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockchange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerlockerror", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointermove", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerout", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerover", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onpointerup", typeof(Microsoft.AspNetCore.Components.UIPointerEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onprogress", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onratechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onreadystatechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onreset", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onscroll", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeked", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeking", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselect", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectionchange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectstart", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onstalled", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onstop", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onsubmit", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onsuspend", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onratechange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onreadystatechange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onreset", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onscroll", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeked", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onseeking", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselect", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectionchange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onselectstart", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onstalled", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onstop", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onsubmit", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onsuspend", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontimeout", typeof(Microsoft.AspNetCore.Components.UIProgressEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontimeupdate", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontimeupdate", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchcancel", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchend", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchenter", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchleave", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchmove", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("ontouchstart", typeof(Microsoft.AspNetCore.Components.UITouchEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onvolumechange", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] - [Microsoft.AspNetCore.Components.EventHandlerAttribute("onwaiting", typeof(Microsoft.AspNetCore.Components.UIEventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onvolumechange", typeof(System.EventArgs))] + [Microsoft.AspNetCore.Components.EventHandlerAttribute("onwaiting", typeof(System.EventArgs))] [Microsoft.AspNetCore.Components.EventHandlerAttribute("onwheel", typeof(Microsoft.AspNetCore.Components.UIWheelEventArgs))] public static partial class EventHandlers { } - public partial class UIClipboardEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIClipboardEventArgs : System.EventArgs { public UIClipboardEventArgs() { } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } public partial class UIDataTransferItem { @@ -161,19 +162,21 @@ namespace Microsoft.AspNetCore.Components public UIDragEventArgs() { } public Microsoft.AspNetCore.Components.DataTransfer DataTransfer { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UIErrorEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIErrorEventArgs : System.EventArgs { public UIErrorEventArgs() { } public int Colno { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string Filename { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public int Lineno { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string Message { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UIFocusEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIFocusEventArgs : System.EventArgs { public UIFocusEventArgs() { } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UIKeyboardEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIKeyboardEventArgs : System.EventArgs { public UIKeyboardEventArgs() { } public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } @@ -184,8 +187,9 @@ namespace Microsoft.AspNetCore.Components public bool MetaKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool Repeat { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UIMouseEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIMouseEventArgs : System.EventArgs { public UIMouseEventArgs() { } public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } @@ -199,6 +203,7 @@ namespace Microsoft.AspNetCore.Components public double ScreenX { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public double ScreenY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } public partial class UIPointerEventArgs : Microsoft.AspNetCore.Components.UIMouseEventArgs { @@ -212,14 +217,15 @@ namespace Microsoft.AspNetCore.Components public float TiltY { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public float Width { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UIProgressEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UIProgressEventArgs : System.EventArgs { public UIProgressEventArgs() { } public bool LengthComputable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public long Loaded { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public long Total { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } - public partial class UITouchEventArgs : Microsoft.AspNetCore.Components.UIEventArgs + public partial class UITouchEventArgs : System.EventArgs { public UITouchEventArgs() { } public bool AltKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } @@ -230,6 +236,7 @@ namespace Microsoft.AspNetCore.Components public bool ShiftKey { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public Microsoft.AspNetCore.Components.UITouchPoint[] TargetTouches { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public Microsoft.AspNetCore.Components.UITouchPoint[] Touches { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + public string Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } } public partial class UITouchPoint { diff --git a/src/Components/Web/src/EventHandlers.cs b/src/Components/Web/src/EventHandlers.cs index 0023ac1054..8df8102278 100644 --- a/src/Components/Web/src/EventHandlers.cs +++ b/src/Components/Web/src/EventHandlers.cs @@ -43,19 +43,19 @@ namespace Microsoft.AspNetCore.Components [EventHandler("onkeypress", typeof(UIKeyboardEventArgs))] // Input events - [EventHandler("onchange", typeof(UIChangeEventArgs))] - [EventHandler("oninput", typeof(UIChangeEventArgs))] - [EventHandler("oninvalid", typeof(UIEventArgs))] - [EventHandler("onreset", typeof(UIEventArgs))] - [EventHandler("onselect", typeof(UIEventArgs))] - [EventHandler("onselectstart", typeof(UIEventArgs))] - [EventHandler("onselectionchange", typeof(UIEventArgs))] - [EventHandler("onsubmit", typeof(UIEventArgs))] + [EventHandler("onchange", typeof(ChangeEventArgs))] + [EventHandler("oninput", typeof(ChangeEventArgs))] + [EventHandler("oninvalid", typeof(EventArgs))] + [EventHandler("onreset", typeof(EventArgs))] + [EventHandler("onselect", typeof(EventArgs))] + [EventHandler("onselectstart", typeof(EventArgs))] + [EventHandler("onselectionchange", typeof(EventArgs))] + [EventHandler("onsubmit", typeof(EventArgs))] // Clipboard events - [EventHandler("onbeforecopy", typeof(UIEventArgs))] - [EventHandler("onbeforecut", typeof(UIEventArgs))] - [EventHandler("onbeforepaste", typeof(UIEventArgs))] + [EventHandler("onbeforecopy", typeof(EventArgs))] + [EventHandler("onbeforecut", typeof(EventArgs))] + [EventHandler("onbeforepaste", typeof(EventArgs))] [EventHandler("oncopy", typeof(UIClipboardEventArgs))] [EventHandler("oncut", typeof(UIClipboardEventArgs))] [EventHandler("onpaste", typeof(UIClipboardEventArgs))] @@ -81,23 +81,23 @@ namespace Microsoft.AspNetCore.Components [EventHandler("onpointerup", typeof(UIPointerEventArgs))] // Media events - [EventHandler("oncanplay", typeof(UIEventArgs))] - [EventHandler("oncanplaythrough", typeof(UIEventArgs))] - [EventHandler("oncuechange", typeof(UIEventArgs))] - [EventHandler("ondurationchange", typeof(UIEventArgs))] - [EventHandler("onemptied", typeof(UIEventArgs))] - [EventHandler("onpause", typeof(UIEventArgs))] - [EventHandler("onplay", typeof(UIEventArgs))] - [EventHandler("onplaying", typeof(UIEventArgs))] - [EventHandler("onratechange", typeof(UIEventArgs))] - [EventHandler("onseeked", typeof(UIEventArgs))] - [EventHandler("onseeking", typeof(UIEventArgs))] - [EventHandler("onstalled", typeof(UIEventArgs))] - [EventHandler("onstop", typeof(UIEventArgs))] - [EventHandler("onsuspend", typeof(UIEventArgs))] - [EventHandler("ontimeupdate", typeof(UIEventArgs))] - [EventHandler("onvolumechange", typeof(UIEventArgs))] - [EventHandler("onwaiting", typeof(UIEventArgs))] + [EventHandler("oncanplay", typeof(EventArgs))] + [EventHandler("oncanplaythrough", typeof(EventArgs))] + [EventHandler("oncuechange", typeof(EventArgs))] + [EventHandler("ondurationchange", typeof(EventArgs))] + [EventHandler("onemptied", typeof(EventArgs))] + [EventHandler("onpause", typeof(EventArgs))] + [EventHandler("onplay", typeof(EventArgs))] + [EventHandler("onplaying", typeof(EventArgs))] + [EventHandler("onratechange", typeof(EventArgs))] + [EventHandler("onseeked", typeof(EventArgs))] + [EventHandler("onseeking", typeof(EventArgs))] + [EventHandler("onstalled", typeof(EventArgs))] + [EventHandler("onstop", typeof(EventArgs))] + [EventHandler("onsuspend", typeof(EventArgs))] + [EventHandler("ontimeupdate", typeof(EventArgs))] + [EventHandler("onvolumechange", typeof(EventArgs))] + [EventHandler("onwaiting", typeof(EventArgs))] // Progress events [EventHandler("onloadstart", typeof(UIProgressEventArgs))] @@ -109,19 +109,19 @@ namespace Microsoft.AspNetCore.Components [EventHandler("onerror", typeof(UIErrorEventArgs))] // General events - [EventHandler("onactivate", typeof(UIEventArgs))] - [EventHandler("onbeforeactivate", typeof(UIEventArgs))] - [EventHandler("onbeforedeactivate", typeof(UIEventArgs))] - [EventHandler("ondeactivate", typeof(UIEventArgs))] - [EventHandler("onended", typeof(UIEventArgs))] - [EventHandler("onfullscreenchange", typeof(UIEventArgs))] - [EventHandler("onfullscreenerror", typeof(UIEventArgs))] - [EventHandler("onloadeddata", typeof(UIEventArgs))] - [EventHandler("onloadedmetadata", typeof(UIEventArgs))] - [EventHandler("onpointerlockchange", typeof(UIEventArgs))] - [EventHandler("onpointerlockerror", typeof(UIEventArgs))] - [EventHandler("onreadystatechange", typeof(UIEventArgs))] - [EventHandler("onscroll", typeof(UIEventArgs))] + [EventHandler("onactivate", typeof(EventArgs))] + [EventHandler("onbeforeactivate", typeof(EventArgs))] + [EventHandler("onbeforedeactivate", typeof(EventArgs))] + [EventHandler("ondeactivate", typeof(EventArgs))] + [EventHandler("onended", typeof(EventArgs))] + [EventHandler("onfullscreenchange", typeof(EventArgs))] + [EventHandler("onfullscreenerror", typeof(EventArgs))] + [EventHandler("onloadeddata", typeof(EventArgs))] + [EventHandler("onloadedmetadata", typeof(EventArgs))] + [EventHandler("onpointerlockchange", typeof(EventArgs))] + [EventHandler("onpointerlockerror", typeof(EventArgs))] + [EventHandler("onreadystatechange", typeof(EventArgs))] + [EventHandler("onscroll", typeof(EventArgs))] public static class EventHandlers { } diff --git a/src/Components/Web/src/RendererRegistryEventDispatcher.cs b/src/Components/Web/src/RendererRegistryEventDispatcher.cs index ea4a5c0b46..7bffa1ec6e 100644 --- a/src/Components/Web/src/RendererRegistryEventDispatcher.cs +++ b/src/Components/Web/src/RendererRegistryEventDispatcher.cs @@ -54,12 +54,12 @@ namespace Microsoft.AspNetCore.Components.Web } } - private static UIEventArgs ParseEventArgsJson(string eventArgsType, string eventArgsJson) + private static EventArgs ParseEventArgsJson(string eventArgsType, string eventArgsJson) { switch (eventArgsType) { case "change": - return DeserializeUIEventChangeArgs(eventArgsJson); + return DeserializeChangeEventArgs(eventArgsJson); case "clipboard": return Deserialize(eventArgsJson); case "drag": @@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Components.Web case "touch": return Deserialize(eventArgsJson); case "unknown": - return Deserialize(eventArgsJson); + return EventArgs.Empty; case "wheel": return Deserialize(eventArgsJson); default: @@ -92,9 +92,9 @@ namespace Microsoft.AspNetCore.Components.Web return JsonSerializer.Deserialize(eventArgsJson, JsonSerializerOptionsProvider.Options); } - private static UIChangeEventArgs DeserializeUIEventChangeArgs(string eventArgsJson) + private static ChangeEventArgs DeserializeChangeEventArgs(string eventArgsJson) { - var changeArgs = Deserialize(eventArgsJson); + var changeArgs = Deserialize(eventArgsJson); var jsonElement = (JsonElement)changeArgs.Value; switch (jsonElement.ValueKind) { @@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Components.Web changeArgs.Value = jsonElement.GetBoolean(); break; default: - throw new ArgumentException($"Unsupported {nameof(UIChangeEventArgs)} value {jsonElement}."); + throw new ArgumentException($"Unsupported {nameof(ChangeEventArgs)} value {jsonElement}."); } return changeArgs; } diff --git a/src/Components/Web/src/UIClipboardEventArgs.cs b/src/Components/Web/src/UIClipboardEventArgs.cs index f4ed05d3f7..166d9221c1 100644 --- a/src/Components/Web/src/UIClipboardEventArgs.cs +++ b/src/Components/Web/src/UIClipboardEventArgs.cs @@ -1,12 +1,18 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about an clipboard event that is being raised. /// - public class UIClipboardEventArgs : UIEventArgs + public class UIClipboardEventArgs : EventArgs { + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UIErrorEventArgs.cs b/src/Components/Web/src/UIErrorEventArgs.cs index c7b0b31a4a..6cf86b7553 100644 --- a/src/Components/Web/src/UIErrorEventArgs.cs +++ b/src/Components/Web/src/UIErrorEventArgs.cs @@ -1,12 +1,14 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about an error event that is being raised. /// - public class UIErrorEventArgs : UIEventArgs + public class UIErrorEventArgs : EventArgs { /// /// Gets a a human-readable error message describing the problem. @@ -27,5 +29,10 @@ namespace Microsoft.AspNetCore.Components /// Gets the column number of the script file on which the error occurred. /// public int Colno { get; set; } + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UIFocusEventArgs.cs b/src/Components/Web/src/UIFocusEventArgs.cs index 1260a9e088..b120e666a8 100644 --- a/src/Components/Web/src/UIFocusEventArgs.cs +++ b/src/Components/Web/src/UIFocusEventArgs.cs @@ -1,14 +1,21 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about a focus event that is being raised. /// - public class UIFocusEventArgs : UIEventArgs + public class UIFocusEventArgs : EventArgs { // Not including support for 'relatedTarget' since we don't have a good way to represent it. // see: https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UIKeyboardEventArgs.cs b/src/Components/Web/src/UIKeyboardEventArgs.cs index fdcb5fd462..fd66247dc4 100644 --- a/src/Components/Web/src/UIKeyboardEventArgs.cs +++ b/src/Components/Web/src/UIKeyboardEventArgs.cs @@ -1,12 +1,14 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about a keyboard event that is being raised. /// - public class UIKeyboardEventArgs : UIEventArgs + public class UIKeyboardEventArgs : EventArgs { /// /// The key value of the key represented by the event. @@ -51,5 +53,10 @@ namespace Microsoft.AspNetCore.Components /// true if the meta key was down when the event was fired. false otherwise. /// public bool MetaKey { get; set; } + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UIMouseEventArgs.cs b/src/Components/Web/src/UIMouseEventArgs.cs index fa5327e1fd..da4d2a64ae 100644 --- a/src/Components/Web/src/UIMouseEventArgs.cs +++ b/src/Components/Web/src/UIMouseEventArgs.cs @@ -1,12 +1,14 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about a mouse event that is being raised. /// - public class UIMouseEventArgs : UIEventArgs + public class UIMouseEventArgs : EventArgs { /// /// A count of consecutive clicks that happened in a short amount of time, incremented by one. @@ -73,5 +75,10 @@ namespace Microsoft.AspNetCore.Components /// true if the meta key was down when the event was fired. false otherwise. /// public bool MetaKey { get; set; } + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UIProgressEventArgs.cs b/src/Components/Web/src/UIProgressEventArgs.cs index 9d57a357c8..e0273c665f 100644 --- a/src/Components/Web/src/UIProgressEventArgs.cs +++ b/src/Components/Web/src/UIProgressEventArgs.cs @@ -1,12 +1,14 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about a progress event that is being raised. /// - public class UIProgressEventArgs : UIEventArgs + public class UIProgressEventArgs : EventArgs { /// /// Whether or not the total size of the transfer is known. @@ -24,5 +26,10 @@ namespace Microsoft.AspNetCore.Components /// If the total size is unknown, this value is zero. /// public long Total { get; set; } + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/UITouchEventArgs.cs b/src/Components/Web/src/UITouchEventArgs.cs index be5fe34da1..3be004b7f1 100644 --- a/src/Components/Web/src/UITouchEventArgs.cs +++ b/src/Components/Web/src/UITouchEventArgs.cs @@ -1,12 +1,14 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; + namespace Microsoft.AspNetCore.Components { /// /// Supplies information about a touch event that is being raised. /// - public class UITouchEventArgs : UIEventArgs + public class UITouchEventArgs : EventArgs { /// /// A count of consecutive clicks that happened in a short amount of time, incremented by one. @@ -50,5 +52,10 @@ namespace Microsoft.AspNetCore.Components /// true if the meta key was down when the event was fired. false otherwise. /// public bool MetaKey { get; set; } + + /// + /// Gets or sets the type of the event. + /// + public string Type { get; set; } } } diff --git a/src/Components/Web/src/WebEventCallbackFactoryUIEventArgsExtensions.cs b/src/Components/Web/src/WebEventCallbackFactoryUIEventArgsExtensions.cs index 1966f20ddc..02bb5d6d58 100644 --- a/src/Components/Web/src/WebEventCallbackFactoryUIEventArgsExtensions.cs +++ b/src/Components/Web/src/WebEventCallbackFactoryUIEventArgsExtensions.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Microsoft.AspNetCore.Components { /// - /// Provides extension methods for and types. + /// Provides extension methods for and types. /// public static class WebEventCallbackFactoryUIEventArgsExtensions { diff --git a/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs b/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs index 9d9cdfc46b..bc27130792 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/InteropReliabilityTests.cs @@ -385,7 +385,7 @@ namespace Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests } [Fact] - public async Task DispatchingEventsWithInvalidUIEventArgs() + public async Task DispatchingEventsWithInvalidEventArgs() { // Arrange var (interopCalls, dotNetCompletions, batches) = ConfigureClient(); diff --git a/src/Components/test/testassets/BasicTestApp/CulturePicker.razor b/src/Components/test/testassets/BasicTestApp/CulturePicker.razor index aacf90bb12..b7d0a90739 100644 --- a/src/Components/test/testassets/BasicTestApp/CulturePicker.razor +++ b/src/Components/test/testassets/BasicTestApp/CulturePicker.razor @@ -8,7 +8,7 @@ @code { - void OnSelected(UIChangeEventArgs e) + void OnSelected(ChangeEventArgs e) { // Included fragment to preserve choice of Blazor client or server. var redirect = new Uri(UriHelper.GetAbsoluteUri()).GetComponents(UriComponents.PathAndQuery | UriComponents.Fragment, UriFormat.UriEscaped); diff --git a/src/Components/test/testassets/Ignitor/ElementNode.cs b/src/Components/test/testassets/Ignitor/ElementNode.cs index 2232ba8d08..2bb447d127 100644 --- a/src/Components/test/testassets/Ignitor/ElementNode.cs +++ b/src/Components/test/testassets/Ignitor/ElementNode.cs @@ -70,9 +70,8 @@ namespace Ignitor throw new InvalidOperationException("Element does not have a change event."); } - var sleectEventArgs = new UIChangeEventArgs() + var args = new ChangeEventArgs() { - Type = changeEventDescriptor.EventName, Value = value }; @@ -88,7 +87,7 @@ namespace Ignitor } }; - return DispatchEventCore(connection, Serialize(browserDescriptor), Serialize(sleectEventArgs)); + return DispatchEventCore(connection, Serialize(browserDescriptor), Serialize(args)); } public Task ClickAsync(HubConnection connection)