start -> start/stop
This commit is contained in:
parent
0b0218824a
commit
b93a7048fd
|
|
@ -42,10 +42,11 @@
|
|||
Class="mr-5" OnClick="RedoClick"/>
|
||||
</MudTooltip>
|
||||
|
||||
<MudTooltip Text="Start" Color="Color.Primary" Placement="Placement.Bottom" Arrow="true">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Start" Variant="Variant.Filled" Color="Color.Primary"
|
||||
Disabled="@(ThrowPanelState.Value.IsStated)"
|
||||
Class="mr-5" OnClick="StartClick"/>
|
||||
<MudTooltip Text="@(ThrowPanelState.Value.IsStated ? "Stop" : "Start")"
|
||||
Color="Color.Primary" Placement="Placement.Bottom" Arrow="true">
|
||||
<MudIconButton Icon="@(ThrowPanelState.Value.IsStated ? Icons.Material.Filled.Stop : Icons.Material.Filled.Start)"
|
||||
Variant="Variant.Filled" Color="Color.Primary"
|
||||
Class="mr-5" OnClick="StartStopClick"/>
|
||||
</MudTooltip>
|
||||
|
||||
</MudToolBar>
|
||||
|
|
@ -250,9 +251,9 @@
|
|||
// }
|
||||
}
|
||||
|
||||
private void StartClick()
|
||||
private void StartStopClick()
|
||||
{
|
||||
var action = new StartAction(ThrowPanelState.Value);
|
||||
var action = new StartStopAction(ThrowPanelState.Value);
|
||||
Dispatcher.Dispatch(action);
|
||||
|
||||
// _throwPanelState = ThrowPanelState.Create();
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace KoogleApp.Hub
|
|||
await _hubConnection.StartAsync();
|
||||
}
|
||||
|
||||
public async Task HandleStartAction(StartAction action, IDispatcher dispatcher)
|
||||
public async Task HandleStartAction(StartStopAction stopAction, IDispatcher dispatcher)
|
||||
{
|
||||
if (_hubConnection?.State != HubConnectionState.Connected)
|
||||
{
|
||||
|
|
@ -64,12 +64,12 @@ namespace KoogleApp.Hub
|
|||
{
|
||||
if (_hubConnection is not null)
|
||||
{
|
||||
await _hubConnection.SendAsync("BroadcastThrowPanelState", action.State);
|
||||
await _hubConnection.SendAsync("BroadcastThrowPanelState", stopAction.State);
|
||||
}
|
||||
|
||||
//await Clients.Others.SendAsync("ReceiveThrowPanelState", new ThrowPanelState());
|
||||
|
||||
//await _hubConnection.InvokeAsync("StartAction", action);
|
||||
//await _hubConnection.InvokeAsync("StartStopAction", stopAction);
|
||||
|
||||
// Der Server wird ActivityAdded an alle Clients senden,
|
||||
// einschließlich diesem. Dann wird ActivityAddedAction dispatched.
|
||||
|
|
@ -198,7 +198,7 @@ namespace KoogleApp.Hub
|
|||
{
|
||||
await Clients.Others.SendAsync("ReceiveThrowPanelState", state);
|
||||
|
||||
//await _hubConnection.InvokeAsync("StartAction", action);
|
||||
//await _hubConnection.InvokeAsync("StartStopAction", action);
|
||||
|
||||
// Der Server wird ActivityAdded an alle Clients senden,
|
||||
// einschließlich diesem. Dann wird ActivityAddedAction dispatched.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
{
|
||||
public record TogglePinValueAction(bool IsOn, int PinNumber);
|
||||
|
||||
public record StartAction(ThrowPanelState State);
|
||||
public record StartStopAction(ThrowPanelState State);
|
||||
|
||||
public record ConnectToHubAction();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
//_sharedModelHub?.Dispose();
|
||||
}
|
||||
|
||||
//[EffectMethod(typeof(StartAction))]
|
||||
//[EffectMethod(typeof(StartStopAction))]
|
||||
[EffectMethod]
|
||||
public async Task HandleStartAction(StartAction action, IDispatcher dispatcher)
|
||||
public async Task HandleStartAction(StartStopAction stopAction, IDispatcher dispatcher)
|
||||
{
|
||||
dispatcher.Dispatch(new BroadcastThrowPanelStateAction(_state.Value));
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
// TODO error handling
|
||||
}
|
||||
|
||||
await _sharedModelHub.HandleStartAction(new StartAction(_state.Value), dispatcher);
|
||||
await _sharedModelHub.HandleStartAction(new StartStopAction(_state.Value), dispatcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ namespace KoogleApp.Store.Game.ThrowPanel
|
|||
}
|
||||
|
||||
[ReducerMethod]
|
||||
public static ThrowPanelState OnStart(ThrowPanelState state, StartAction action)
|
||||
public static ThrowPanelState OnStart(ThrowPanelState state, StartStopAction stopAction)
|
||||
{
|
||||
return state with { IsStated = true };
|
||||
return state with { IsStated = !state.IsStated };
|
||||
}
|
||||
|
||||
[ReducerMethod]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"IsStated": true,
|
||||
"IsStated": false,
|
||||
"BellValue": false,
|
||||
"Pin1Value": false,
|
||||
"Pin2Value": false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue