diff --git a/RxBlazorLightCore/RxBlazorLightCore.csproj b/RxBlazorLightCore/RxBlazorLightCore.csproj
index 8f8a952..6b8cdae 100644
--- a/RxBlazorLightCore/RxBlazorLightCore.csproj
+++ b/RxBlazorLightCore/RxBlazorLightCore.csproj
@@ -6,7 +6,7 @@
-
-
+
+
diff --git a/RxBlazorLightCoreTests/RxBlazorLightCoreTests.csproj b/RxBlazorLightCoreTests/RxBlazorLightCoreTests.csproj
index 77b7f19..1bb138d 100644
--- a/RxBlazorLightCoreTests/RxBlazorLightCoreTests.csproj
+++ b/RxBlazorLightCoreTests/RxBlazorLightCoreTests.csproj
@@ -10,13 +10,13 @@
-
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
diff --git a/RxBlazorLightCoreTests/StateTests.cs b/RxBlazorLightCoreTests/StateTests.cs
index 5f2bb3a..565e0b1 100644
--- a/RxBlazorLightCoreTests/StateTests.cs
+++ b/RxBlazorLightCoreTests/StateTests.cs
@@ -744,7 +744,7 @@ public async Task TestStateObserver()
}
[Fact]
- public async void TestStateObserverCancel()
+ public async Task TestStateObserverCancel()
{
ServiceFixture fixture = new();
var stateChangeCount = 0;
@@ -811,7 +811,7 @@ public async Task TestStateObserverComplex()
}
[Fact]
- public async void TestStateObserverComplexCancel()
+ public async Task TestStateObserverComplexCancel()
{
ServiceFixture fixture = new();
var stateChangeCount = 0;
@@ -847,7 +847,7 @@ public async void TestStateObserverComplexCancel()
}
[Fact]
- public async void TestStateObserverThrow()
+ public async Task TestStateObserverThrow()
{
ServiceFixture fixture = new();
var stateChangeCount = 0;
@@ -895,14 +895,27 @@ IDisposable subscribeTest()
}
[Fact]
- public async void TestStateObserverHandleErrorThrow()
+ public async Task TestStateObserverHandleErrorThrow()
{
ServiceFixture fixture = new();
var stateChangeCount = 0;
bool exception = false;
bool done = false;
- IDisposable subscribeTest()
+ var disposable = SubscribeTest();
+ fixture.ResetExceptions();
+ fixture.CancellableObserverHandleErrorAsync.ExecuteAsync(ServiceFixture.ObserveStateThrow);
+ while (!done)
+ {
+ await Task.Delay(5);
+ }
+ Assert.True(exception);
+ Assert.Equal(1, stateChangeCount);
+ Assert.Empty(fixture.Exceptions);
+ disposable.Dispose();
+ return;
+
+ IDisposable SubscribeTest()
{
done = false;
stateChangeCount = 0;
@@ -928,18 +941,6 @@ IDisposable subscribeTest()
}
});
}
-
- var disposable = subscribeTest();
- fixture.ResetExceptions();
- fixture.CancellableObserverHandleErrorAsync.ExecuteAsync(ServiceFixture.ObserveStateThrow);
- while (!done)
- {
- await Task.Delay(5);
- }
- Assert.True(exception);
- Assert.Equal(1, stateChangeCount);
- Assert.Empty(fixture.Exceptions);
- disposable.Dispose();
}
}
}
\ No newline at end of file
diff --git a/RxMudBlazorLight/ButtonBase/ButtonRx.cs b/RxMudBlazorLight/ButtonBase/ButtonRx.cs
index cbd540a..38eb829 100644
--- a/RxMudBlazorLight/ButtonBase/ButtonRx.cs
+++ b/RxMudBlazorLight/ButtonBase/ButtonRx.cs
@@ -9,7 +9,6 @@ namespace RxMudBlazorLight.ButtonBase
internal class ButtonRx : ButtonBaseRx
{
public EventCallback? OnClick { get; private set; }
- public EventCallback? OnTouch { get; private set; }
private readonly Func>? _confirmExecutionAsync;
@@ -27,7 +26,6 @@ public static ButtonRx Create(MBButtonType type, Func>? confirmExecut
}
[MemberNotNull(nameof(OnClick))]
- [MemberNotNull(nameof(OnTouch))]
public void SetParameter(IStateCommand stateCommand, Action executeCallback, Func? canChangeCallback)
{
VerifyButtonParameters();
@@ -38,7 +36,6 @@ public void SetParameter(IStateCommand stateCommand, Action executeCallback, Fun
}
OnClick = EventCallback.Factory.Create(this, () => ExecuteStateCommand(stateCommand, executeCallback));
- OnTouch = EventCallback.Factory.Create(this, () => ExecuteStateCommand(stateCommand, executeCallback));
Disabled = stateCommand.Disabled || (canChangeCallback is not null && !canChangeCallback());
}
@@ -51,7 +48,6 @@ private async Task ExecuteStateCommand(IStateCommand stateCommand, Action execut
}
[MemberNotNull(nameof(OnClick))]
- [MemberNotNull(nameof(OnTouch))]
public void SetParameter(IStateCommandAsync stateCommand, Func executeAsyncCallback, Func? canChangeCallback, bool deferredNotification)
{
VerifyButtonParametersAsync(stateCommand);
@@ -70,7 +66,6 @@ public void SetParameter(IStateCommandAsync stateCommand, Func(this, stateCommand.Cancel);
- OnTouch = EventCallback.Factory.Create(this, stateCommand.Cancel);
if (_buttonType is MBButtonType.ICON)
{
@@ -107,14 +102,11 @@ public void SetParameter(IStateCommandAsync stateCommand, Func(this, () =>
ExecuteStateCommandAsync(stateCommand, executeAsyncCallback, deferredNotification));
- OnTouch = EventCallback.Factory.Create(this, () =>
- ExecuteStateCommandAsync(stateCommand, executeAsyncCallback, deferredNotification));
-
+
Disabled = stateCommand.Disabled || (canChangeCallback is not null && !canChangeCallback());
}
OnClick ??= EventCallback.Factory.Create(this, _ => { });
- OnTouch ??= EventCallback.Factory.Create(this, _ => { });
}
private async Task ExecuteStateCommandAsync(IStateCommandAsync stateCommand, Func executeAsyncCallback, bool deferredNotification)
diff --git a/RxMudBlazorLight/Dialogs/DialogAsyncORx.razor.cs b/RxMudBlazorLight/Dialogs/DialogAsyncORx.razor.cs
index cbf80e2..10ee34a 100644
--- a/RxMudBlazorLight/Dialogs/DialogAsyncORx.razor.cs
+++ b/RxMudBlazorLight/Dialogs/DialogAsyncORx.razor.cs
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using MudBlazor;
using RxBlazorLightCore;
+using RxMudBlazorLight.Extensions;
namespace RxMudBlazorLight.Dialogs
{
@@ -57,13 +58,7 @@ public static async Task Show(IDialogService dialogService,
var dialog = await dialogService.ShowAsync>(title, parameters);
var res = await dialog.Result;
-
- if (res.Canceled)
- {
- return false;
- }
-
- return true;
+ return res.OK();
}
private bool CanNotCancel()
diff --git a/RxMudBlazorLight/Dialogs/DialogAsyncRx.razor.cs b/RxMudBlazorLight/Dialogs/DialogAsyncRx.razor.cs
index c9cc0c6..67fe263 100644
--- a/RxMudBlazorLight/Dialogs/DialogAsyncRx.razor.cs
+++ b/RxMudBlazorLight/Dialogs/DialogAsyncRx.razor.cs
@@ -2,6 +2,7 @@
using MudBlazor;
using RxBlazorLightCore;
using RxMudBlazorLight.Buttons;
+using RxMudBlazorLight.Extensions;
namespace RxMudBlazorLight.Dialogs
{
@@ -63,16 +64,10 @@ public static async Task Show(IDialogService dialogService,
["SuccessOnConfirm"] = successOnConfirm
};
- var dialog = dialogService.Show>(title, parameters);
+ var dialog = await dialogService.ShowAsync>(title, parameters);
var res = await dialog.Result;
-
- if (res.Canceled)
- {
- return false;
- }
-
- return true;
+ return res.OK();
}
private bool CanNotCancel()
diff --git a/RxMudBlazorLight/Dialogs/DialogRx.razor.cs b/RxMudBlazorLight/Dialogs/DialogRx.razor.cs
index 7e2f330..61a75f4 100644
--- a/RxMudBlazorLight/Dialogs/DialogRx.razor.cs
+++ b/RxMudBlazorLight/Dialogs/DialogRx.razor.cs
@@ -2,6 +2,7 @@
using MudBlazor;
using RxBlazorLightCore;
using RxMudBlazorLight.Buttons;
+using RxMudBlazorLight.Extensions;
namespace RxMudBlazorLight.Dialogs
{
@@ -50,16 +51,10 @@ public static async Task Show(IDialogService dialogService,
["SuccessOnConfirm"] = successOnConfirm
};
- var dialog = dialogService.Show>(title, parameters);
+ var dialog = await dialogService.ShowAsync>(title, parameters);
var res = await dialog.Result;
-
- if (res.Canceled)
- {
- return false;
- }
-
- return true;
+ return res.OK();
}
private bool CanNotCancel()
diff --git a/RxMudBlazorLight/Extensions/RxMudBlazorLightExtensionsExtern.cs b/RxMudBlazorLight/Extensions/RxMudBlazorLightExtensionsExtern.cs
new file mode 100644
index 0000000..a01f0a4
--- /dev/null
+++ b/RxMudBlazorLight/Extensions/RxMudBlazorLightExtensionsExtern.cs
@@ -0,0 +1,12 @@
+using MudBlazor;
+
+namespace RxMudBlazorLight.Extensions
+{
+ public static class RxMudBlazorLightExtensionsExtern
+ {
+ public static bool OK(this DialogResult? result)
+ {
+ return result is not null && !result.Canceled;
+ }
+ }
+}
diff --git a/RxMudBlazorLight/Inputs/MudSliderRx.razor b/RxMudBlazorLight/Inputs/MudSliderRx.razor
index 585473a..b735128 100644
--- a/RxMudBlazorLight/Inputs/MudSliderRx.razor
+++ b/RxMudBlazorLight/Inputs/MudSliderRx.razor
@@ -1,5 +1,5 @@
@inherits MudSlider
-@typeparam T
+@typeparam T where T : struct, INumber
@RenderBase()
diff --git a/RxMudBlazorLight/Menus/MudMenuItemAsyncRx.razor b/RxMudBlazorLight/Menus/MudMenuItemAsyncRx.razor
index b2a0845..d8adb4c 100644
--- a/RxMudBlazorLight/Menus/MudMenuItemAsyncRx.razor
+++ b/RxMudBlazorLight/Menus/MudMenuItemAsyncRx.razor
@@ -30,7 +30,6 @@
_buttonRx.SetParameter(StateCommand, ExecuteAsyncCallback, CanChangeCallback, false);
OnClick = (EventCallback)_buttonRx.OnClick;
- OnTouch = (EventCallback)_buttonRx.OnTouch;
Disabled = _buttonRx.Disabled;
base.OnParametersSet();
diff --git a/RxMudBlazorLight/Menus/MudMenuItemRx.razor b/RxMudBlazorLight/Menus/MudMenuItemRx.razor
index da7de18..1728a3c 100644
--- a/RxMudBlazorLight/Menus/MudMenuItemRx.razor
+++ b/RxMudBlazorLight/Menus/MudMenuItemRx.razor
@@ -30,7 +30,6 @@
_buttonRx.SetParameter(StateCommand, ExecuteCallback, CanChangeCallback);
OnClick = (EventCallback)_buttonRx.OnClick;
- OnTouch = (EventCallback)_buttonRx.OnTouch;
Disabled = _buttonRx.Disabled;
base.OnParametersSet();
diff --git a/RxMudBlazorLight/RxMudBlazorLight.csproj b/RxMudBlazorLight/RxMudBlazorLight.csproj
index 3e49321..6648828 100644
--- a/RxMudBlazorLight/RxMudBlazorLight.csproj
+++ b/RxMudBlazorLight/RxMudBlazorLight.csproj
@@ -1,53 +1,57 @@
-
- net8.0
- enable
- enable
-
-
-
- RxMudBlazorLight
- A simple reactive wrapper around MudBlazor components.
- Bernhard Straub
- Bernhard Straub
- https://github.com/b-straub/RxMudBlazorLight
- https://github.com/b-straub/RxMudBlazorLight
- README.md
- git
- MIT
- false
- Blazor,MudBlazor,Rx,Reactive
- true
- ..\Nuget
- 0.9.2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $(TargetsForTfmSpecificContentInPackage);_AddCoreToOutput
-
-
-
-
-
-
-
+
+ net8.0
+ enable
+ enable
+
+
+
+ V7CaseSensitive
+ LowerCase
+
+
+
+ RxMudBlazorLight
+ A simple reactive wrapper around MudBlazor components.
+ Bernhard Straub
+ Bernhard Straub
+ https://github.com/b-straub/RxMudBlazorLight
+ https://github.com/b-straub/RxMudBlazorLight
+ README.md
+ git
+ MIT
+ false
+ Blazor,MudBlazor,Rx,Reactive
+ true
+ ..\Nuget
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(TargetsForTfmSpecificContentInPackage);_AddCoreToOutput
+
+
+
+
+
+
+
diff --git a/RxMudBlazorLight/_Imports.razor b/RxMudBlazorLight/_Imports.razor
index 1120253..26fa8b1 100644
--- a/RxMudBlazorLight/_Imports.razor
+++ b/RxMudBlazorLight/_Imports.razor
@@ -1,6 +1,7 @@
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.Extensions.DependencyInjection;
@using System.Diagnostics.CodeAnalysis
+@using System.Numerics
@using MudBlazor
@using RxBlazorLightCore
@using RxMudBlazorLight.Buttons
diff --git a/RxMudBlazorLightSample/RxMudBlazorLightSample.csproj b/RxMudBlazorLightSample/RxMudBlazorLightSample.csproj
index d8b6a54..c44e972 100644
--- a/RxMudBlazorLightSample/RxMudBlazorLightSample.csproj
+++ b/RxMudBlazorLightSample/RxMudBlazorLightSample.csproj
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/RxMudBlazorLightSample/Shared/MainLayout.razor b/RxMudBlazorLightSample/Shared/MainLayout.razor
index 4d7cc1e..89a06a0 100644
--- a/RxMudBlazorLightSample/Shared/MainLayout.razor
+++ b/RxMudBlazorLightSample/Shared/MainLayout.razor
@@ -3,6 +3,7 @@
+
@@ -10,8 +11,8 @@
-
+
diff --git a/RxMudBlazorLightTestBase/CRUD/CRUDItemAddOrUpdate.razor b/RxMudBlazorLightTestBase/CRUD/CRUDItemAddOrUpdate.razor
index 4357e7c..cdee389 100644
--- a/RxMudBlazorLightTestBase/CRUD/CRUDItemAddOrUpdate.razor
+++ b/RxMudBlazorLightTestBase/CRUD/CRUDItemAddOrUpdate.razor
@@ -22,13 +22,16 @@ else
private async Task ShowAddUpdateDialog(IStateCommandAsync _)
{
var parameters = new DialogParameters { ["Item"] = Item };
- var dialog = DialogService.Show(AddMode ? "Add ToDo" : "Edit ToDo", parameters);
+ var dialog = await DialogService.ShowAsync(AddMode ? "Add ToDo" : "Edit ToDo", parameters);
var result = await dialog.Result;
- if (!result.Canceled)
+ if (result is not null && !result.Canceled)
{
- var scope = (CrudService.CrudItemInput)result.Data;
- await scope.SubmitAsync();
+ var scope = (CrudService.CrudItemInput?)result.Data;
+ if (scope is not null)
+ {
+ await scope.SubmitAsync();
+ }
}
}
}
diff --git a/RxMudBlazorLightTestBase/CRUD/CRUDTable.razor b/RxMudBlazorLightTestBase/CRUD/CRUDTable.razor
index feb38df..51cd586 100644
--- a/RxMudBlazorLightTestBase/CRUD/CRUDTable.razor
+++ b/RxMudBlazorLightTestBase/CRUD/CRUDTable.razor
@@ -86,7 +86,7 @@
private static string ColorForItem(CRUDToDoItem item)
{
- return item.Completed ? $"color:{Colors.Grey.Default}" : "color:black";
+ return item.Completed ? $"color:{Colors.Gray.Default}" : "color:black";
}
private static string DateTimeForItem(CRUDToDoItem item)
@@ -121,15 +121,9 @@
};
var parameters = new DialogParameters { ["Message"] = message };
- var dialog = DialogService.Show("ToDoItem", parameters);
+ var dialog = await DialogService.ShowAsync("ToDoItem", parameters);
var res = await dialog.Result;
-
- if (res.Canceled)
- {
- return false;
- }
-
- return true;
+ return res.OK();
}
}
diff --git a/RxMudBlazorLightTestBase/Components/ButtonTest.razor b/RxMudBlazorLightTestBase/Components/ButtonTest.razor
index a87f325..f7c5c74 100644
--- a/RxMudBlazorLightTestBase/Components/ButtonTest.razor
+++ b/RxMudBlazorLightTestBase/Components/ButtonTest.razor
@@ -28,13 +28,13 @@
ConfirmExecution())>Increment
Add 5
- Service.AddObserver.ExecuteAsync(Service.AddCounterObservable))>Add 2x10 to Counter
- Service.IncrementObserver.ExecuteAsync(Service.IncrementCounterTimeoutObservable))>Increment Counter Timeout
- ObservableDialogClick(Service.IncrementCounterObservable))>Dialog Increment Counter
- ObservableDialogClick(Service.IncrementCounterTimeoutObservable))>Dialog Increment Counter Timeout
+ Service.AddObserver.ExecuteAsync(Service.AddCounterObservable))>Add 2x10 to Counter
+ Service.IncrementObserver.ExecuteAsync(Service.IncrementCounterTimeoutObservable))>Increment Counter Timeout
+ ObservableDialogClick(Service.IncrementCounterObservable))>Dialog Increment Counter
+ ObservableDialogClick(Service.IncrementCounterTimeoutObservable))>Dialog Increment Counter Timeout
IncrementAsync
- CmdDialogClick())>Dialog IncrementAsync
- CmdDialogClick(2))>Dialog AddAsync 2
+ CmdDialogClick())>Dialog IncrementAsync
+ CmdDialogClick(2))>Dialog AddAsync 2
@@ -113,8 +113,7 @@
var dialog = await DialogService.ShowAsync("Counter", parameters);
var res = await dialog.Result;
-
- return !res.Canceled;
+ return res.OK();
}
private async Task DoPrepareAddAsync(IStateCommandAsync c)
@@ -132,7 +131,7 @@
var res = await dialog.Result;
- if (!res.Canceled)
+ if (res is not null && !res.Canceled)
{
c.NotifyChanging();
await Task.Delay(4000, c.CancellationToken);
diff --git a/RxMudBlazorLightTestBase/Components/ColorsScopedGroup.razor b/RxMudBlazorLightTestBase/Components/ColorsScopedGroup.razor
index a463885..3c421cb 100644
--- a/RxMudBlazorLightTestBase/Components/ColorsScopedGroup.razor
+++ b/RxMudBlazorLightTestBase/Components/ColorsScopedGroup.razor
@@ -1,5 +1,5 @@
-
@code {
diff --git a/RxMudBlazorLightTestBase/Components/InputTest.razor b/RxMudBlazorLightTestBase/Components/InputTest.razor
index c3dc5cf..84e47d8 100644
--- a/RxMudBlazorLightTestBase/Components/InputTest.razor
+++ b/RxMudBlazorLightTestBase/Components/InputTest.razor
@@ -11,7 +11,7 @@
Current count: @Service.Counter
-
+
Size.Large) PlacementCallback=@(_ => Placement.Start) />
@@ -39,8 +39,8 @@
-
+
CanIncrementCheck is @(Service.CanIncrementCheck.Value ? "On" : "Off")
Service.NumericState.Value < 20)>IncrementValue
@@ -118,7 +118,7 @@
}
- private string[] states =
+ private string[] _states =
{
"Alabama", "Alaska", "American Samoa", "Arizona",
"Arkansas", "California", "Colorado", "Connecticut",
@@ -136,15 +136,15 @@
"Washington", "West Virginia", "Wisconsin", "Wyoming",
};
- private async Task> Search(string value)
+ private async Task> Search(string value, CancellationToken ct)
{
// In real life use an asynchronous function for fetching data from an api.
- await Task.Delay(5);
+ await Task.Delay(5, ct);
// if text is null or empty, show complete list
if (string.IsNullOrEmpty(value))
- return states;
- return states.Where(x => x.Contains(value, StringComparison.InvariantCultureIgnoreCase));
+ return _states;
+ return _states.Where(x => x.Contains(value, StringComparison.InvariantCultureIgnoreCase));
}
private string GetExceptions()
diff --git a/RxMudBlazorLightTestBase/RxMudBlazorLightTestBase.csproj b/RxMudBlazorLightTestBase/RxMudBlazorLightTestBase.csproj
index baed500..010d8f1 100644
--- a/RxMudBlazorLightTestBase/RxMudBlazorLightTestBase.csproj
+++ b/RxMudBlazorLightTestBase/RxMudBlazorLightTestBase.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/RxMudBlazorLightTestBase/Service/TestService.cs b/RxMudBlazorLightTestBase/Service/TestService.cs
index 2f1a6b2..e31372f 100644
--- a/RxMudBlazorLightTestBase/Service/TestService.cs
+++ b/RxMudBlazorLightTestBase/Service/TestService.cs
@@ -107,21 +107,18 @@ public class ColorsStateScope(TestService service) : RxBLStateScope
new(ColorEnum.BLUE)
];
- public IStateGroupAsync TestColors = service.CreateStateGroupAsync(Colors, Colors[0]);
+ public readonly IStateGroupAsync TestColors = service.CreateStateGroupAsync(Colors, Colors[0]);
- public Func ChangeTestColorAsync(int context)
+ public Func ChangeTestColorAsync(int context)
{
- return async _ =>
+ return async (_, _) =>
{
await Task.Delay(1000);
await TestColors.ChangeValueAsync(Colors[context]);
};
}
- public static Func CanChangeTestColor(int context) => () =>
- {
- return context != 1;
- };
+ public static Func CanChangeTestColor(int context) => () => context != 1;
}
public int Counter { get; set; }
diff --git a/RxMudBlazorLightTests/RxMudBlazorLightTests.csproj b/RxMudBlazorLightTests/RxMudBlazorLightTests.csproj
index 8bdf598..afc72b9 100644
--- a/RxMudBlazorLightTests/RxMudBlazorLightTests.csproj
+++ b/RxMudBlazorLightTests/RxMudBlazorLightTests.csproj
@@ -15,17 +15,17 @@
-
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
-
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all