diff --git a/KoogleApp/Components/Controls/BellButton.razor b/KoogleApp/Components/Controls/BellButton.razor
index 48aa495..e4498bc 100644
--- a/KoogleApp/Components/Controls/BellButton.razor
+++ b/KoogleApp/Components/Controls/BellButton.razor
@@ -1,52 +1,51 @@
-@if (!Value)
-{
-
-
-
-}
-else
-{
-
-
-
-}
+@using KoogleApp.Model
+@using KoogleApp.Store.Game.ThrowPanel
-
+@inherits FluxorComponent
+
+@inject IDispatcher Dispatcher
+@inject IState State
+
+
+
+
+
+
+@* *@
@code {
- private bool _value;
+ // private bool _mudSwitchValue;
- [Parameter]
- public bool Value
+ // private bool MudSwitchValue
+ // {
+ // get => _mudSwitchValue;
+ // set
+ // {
+ // if (_mudSwitchValue == value)
+ // {
+ // return;
+ // }
+
+ // _mudSwitchValue = value;
+ // Dispatcher.Dispatch(new ToggleBellAction());
+ // }
+ // }
+
+ // protected override void OnAfterRender(bool firstRender)
+ // {
+ // base.OnAfterRender(firstRender);
+ // _mudSwitchValue = State.Value.BellValue;
+ // }
+
+ private void ToggleClick(MouseEventArgs obj)
{
- get => _value;
- set
- {
- if (_value == value) return;
- _value = value;
- InvokeAsync(async () => await ValueChanged.InvokeAsync(value));
-
- InvokeAsync(async () => await OnStateChanged.InvokeAsync(Value));
- }
- }
-
- [Parameter]
- public EventCallback ValueChanged { get; set; }
-
-
- [Parameter]
- public EventCallback OnStateChanged { get; set; }
-
- [Parameter]
- public bool Disabled { get; set; } = false;
-
- private async Task ToggleClick(MouseEventArgs obj)
- {
- Value = !Value;
+ Dispatcher.Dispatch(new ToggleBellAction());
}
}
diff --git a/KoogleApp/Components/Controls/NumberPanel.razor b/KoogleApp/Components/Controls/NumberPanel.razor
index 6ebd19b..8653108 100644
--- a/KoogleApp/Components/Controls/NumberPanel.razor
+++ b/KoogleApp/Components/Controls/NumberPanel.razor
@@ -6,7 +6,6 @@
@inherits FluxorComponent
-@inject IMyEventAggregator EventAggregator
@inject IState ThrowPanelState
@inject IDispatcher Dispatcher
@@ -33,8 +32,7 @@
-
+
@@ -138,12 +136,7 @@
@code {
- // [Parameter]
- // public ThrowPanelState? ThrowPanelState { get; set; }
-
- [Parameter]
- public EventCallback OnStateChanged { get; set; }
-
+
[Parameter]
public bool ShowNumbers
{
@@ -161,19 +154,10 @@
private void ToggleClick(MouseEventArgs obj)
{
Dispatcher.Dispatch(new ToggleAllPinsAction());
- // await EventAggregator.PublishAsync(new PinToggleMessage());
}
private async Task OneClick(int number)
{
- Dispatcher.Dispatch(new UpdatePinStateByNumber(number));
- // await EventAggregator.PublishAsync(new NumberPanelMessage(number));
+ Dispatcher.Dispatch(new UpdatePinStateByNumberAction(number));
}
-
- private async Task OnBellStateChanged(bool obj)
- {
- Dispatcher.Dispatch(new ToggleBellAction());
- // await OnStateChanged.InvokeAsync(ThrowPanelState);
- }
-
}
diff --git a/KoogleApp/Components/Controls/NumberPinPanel.razor b/KoogleApp/Components/Controls/NumberPinPanel.razor
index 1dc1392..9cb9909 100644
--- a/KoogleApp/Components/Controls/NumberPinPanel.razor
+++ b/KoogleApp/Components/Controls/NumberPinPanel.razor
@@ -6,7 +6,6 @@
@@ -21,8 +20,7 @@
// [Parameter]
// public ThrowPanelState? ThrowPanelState { get; set; }
- [Parameter]
- public EventCallback OnStateChanged { get; set; }
+
PinPanel _pinPanel;
NumberPanel _numberPanel;
@@ -47,9 +45,5 @@
// }
- private async Task OnThrowPanelStateChanged(ThrowPanelState arg)
- {
- await OnStateChanged.InvokeAsync(arg);
- }
-
+
}
diff --git a/KoogleApp/Components/Controls/ThrowPanel.razor b/KoogleApp/Components/Controls/ThrowPanel.razor
index 250bfb7..b409822 100644
--- a/KoogleApp/Components/Controls/ThrowPanel.razor
+++ b/KoogleApp/Components/Controls/ThrowPanel.razor
@@ -11,9 +11,7 @@
{
-
@@ -49,7 +47,6 @@
@code {
- private NumberPinPanel _numberPinPanel;
[Parameter]
public EventCallback OnClick { get; set; }
@@ -106,11 +103,5 @@
}
- // public void UpdatePanelState(ThrowPanelState state)
- // {
- // _numberPinPanel.UpdatePanelState(state);
- // }
-
-
}
diff --git a/KoogleApp/Hub/SharedModelHub.cs b/KoogleApp/Hub/SharedModelHub.cs
index 1acad82..b3e4222 100644
--- a/KoogleApp/Hub/SharedModelHub.cs
+++ b/KoogleApp/Hub/SharedModelHub.cs
@@ -40,7 +40,7 @@ namespace KoogleApp.Hub
_hubConnection.On("ReceiveThrowPanelState", state =>
{
- dispatcher.Dispatch(new ReceiveStateFromServer(state));
+ dispatcher.Dispatch(new ReceiveStateFromServerAction(state));
});
// _hubConnection.On("ReceiveTextUpdate", (newText) =>
diff --git a/KoogleApp/Store/Game/ThrowPanel/Actions.cs b/KoogleApp/Store/Game/ThrowPanel/Actions.cs
index b47226d..127d9b4 100644
--- a/KoogleApp/Store/Game/ThrowPanel/Actions.cs
+++ b/KoogleApp/Store/Game/ThrowPanel/Actions.cs
@@ -12,9 +12,9 @@ namespace KoogleApp.Store.Game.ThrowPanel
public record ToggleBellAction();
- public record UpdatePinStateByNumber(int Number);
+ public record UpdatePinStateByNumberAction(int Number);
- public record ReceiveStateFromServer(ThrowPanelState State);
+ public record ReceiveStateFromServerAction(ThrowPanelState State);
public record LoadStateFromSessionAction();
diff --git a/KoogleApp/Store/Game/ThrowPanel/Effects.cs b/KoogleApp/Store/Game/ThrowPanel/Effects.cs
index c6f57a4..fa35dbb 100644
--- a/KoogleApp/Store/Game/ThrowPanel/Effects.cs
+++ b/KoogleApp/Store/Game/ThrowPanel/Effects.cs
@@ -37,6 +37,31 @@ namespace KoogleApp.Store.Game.ThrowPanel
dispatcher.Dispatch(new BroadcastThrowPanelStateAction(_state.Value));
}
+ [EffectMethod]
+ public async Task HandleToggleAllPinsAction(ToggleAllPinsAction stopAction, IDispatcher dispatcher)
+ {
+ dispatcher.Dispatch(new BroadcastThrowPanelStateAction(_state.Value));
+ }
+
+ [EffectMethod]
+ public async Task HandleTogglePinValueAction(TogglePinValueAction stopAction, IDispatcher dispatcher)
+ {
+ dispatcher.Dispatch(new BroadcastThrowPanelStateAction(_state.Value));
+ }
+
+ [EffectMethod]
+ public async Task HandleUpdatePinStateByNumberAction(UpdatePinStateByNumberAction stopAction, IDispatcher dispatcher)
+ {
+ dispatcher.Dispatch(new BroadcastThrowPanelStateAction(_state.Value));
+ }
+
+ [EffectMethod]
+ public async Task HandleToggleBellAction(ToggleBellAction stopAction, IDispatcher dispatcher)
+ {
+ dispatcher.Dispatch(new BroadcastThrowPanelStateAction(_state.Value));
+ }
+
+
[EffectMethod]
public async Task HandleConnectToHubAction(ConnectToHubAction action, IDispatcher dispatcher)
{
diff --git a/KoogleApp/Store/Game/ThrowPanel/Reducers.cs b/KoogleApp/Store/Game/ThrowPanel/Reducers.cs
index b0e5462..46d4a1c 100644
--- a/KoogleApp/Store/Game/ThrowPanel/Reducers.cs
+++ b/KoogleApp/Store/Game/ThrowPanel/Reducers.cs
@@ -7,13 +7,13 @@ namespace KoogleApp.Store.Game.ThrowPanel
public static class ThrowPanelStateReducer
{
[ReducerMethod]
- public static ThrowPanelState ReceiveStateFromServer(ThrowPanelState state, ReceiveStateFromServer action)
+ public static ThrowPanelState OnReceiveStateFromServer(ThrowPanelState state, ReceiveStateFromServerAction action)
{
return action.State;
}
[ReducerMethod]
- public static ThrowPanelState OnToggleDevice(ThrowPanelState state, TogglePinValueAction action)
+ public static ThrowPanelState OnTogglePinValue(ThrowPanelState state, TogglePinValueAction action)
{
switch (action.PinNumber)
{
@@ -41,7 +41,7 @@ namespace KoogleApp.Store.Game.ThrowPanel
}
[ReducerMethod]
- public static ThrowPanelState OnStart(ThrowPanelState state, StartStopAction stopAction)
+ public static ThrowPanelState OnStartStop(ThrowPanelState state, StartStopAction stopAction)
{
return state with { IsStated = !state.IsStated };
}
@@ -70,7 +70,7 @@ namespace KoogleApp.Store.Game.ThrowPanel
}
[ReducerMethod]
- public static ThrowPanelState OnUpdatePinStateByNumber(ThrowPanelState state, UpdatePinStateByNumber action)
+ public static ThrowPanelState OnUpdatePinStateByNumber(ThrowPanelState state, UpdatePinStateByNumberAction action)
{
var chgCnt = 0;
@@ -112,13 +112,13 @@ namespace KoogleApp.Store.Game.ThrowPanel
}
[ReducerMethod]
- public static ThrowPanelState OnUpdatePinStateByNumber(ThrowPanelState state, ToggleBellAction action)
+ public static ThrowPanelState OnToggleBell(ThrowPanelState state, ToggleBellAction action)
{
return state with { BellValue = !state.BellValue };
}
[ReducerMethod]
- public static ThrowPanelState OnLoadState(ThrowPanelState state, StateLoadedAction action)
+ public static ThrowPanelState OnStateLoaded(ThrowPanelState state, StateLoadedAction action)
{
return action.State;
}
diff --git a/KoogleApp/ThrowPanelState.json b/KoogleApp/ThrowPanelState.json
index e231980..36856cc 100644
--- a/KoogleApp/ThrowPanelState.json
+++ b/KoogleApp/ThrowPanelState.json
@@ -1,15 +1,15 @@
{
- "IsStated": false,
- "BellValue": false,
- "Pin1Value": false,
- "Pin2Value": false,
- "Pin3Value": false,
- "Pin4Value": false,
- "Pin5Value": false,
- "Pin6Value": false,
+ "IsStated": true,
+ "BellValue": true,
+ "Pin1Value": true,
+ "Pin2Value": true,
+ "Pin3Value": true,
+ "Pin4Value": true,
+ "Pin5Value": true,
+ "Pin6Value": true,
"Pin7Value": false,
- "Pin8Value": false,
- "Pin9Value": false,
+ "Pin8Value": true,
+ "Pin9Value": true,
"Pin1Disabled": false,
"Pin2Disabled": false,
"Pin3Disabled": false,