private void Commit(object sender, EventArgs e)
 {
     try
     {
         gameFlowHandler.Commit();
         OnCommitted?.Invoke();
         ResetControl();
     }
     catch (ArgumentException exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
Beispiel #2
0
    protected virtual async Task OnCommitClicked()
    {
        Debug.Assert(EditContext != null, "EditContext != null");
        bool valid = EditContext.Validate();

        if (!valid)
        {
            return;
        }

        bool success = await Commit();

        await Modal.HideAsync();

        Debug.Assert(ViewModel != null, "ViewModel != null");
        if (success)
        {
            await OnCommitted.InvokeAsync(ViewModel);
        }
    }
Beispiel #3
0
        private void InvokeStateEvent(GameState state)
        {
            switch (state)
            {
            case GameState.Deploying:
                OnDeploying?.Invoke();
                break;

            case GameState.Attacking:
                OnAttacking?.Invoke();
                break;

            case GameState.Committing:
                OnCommitting?.Invoke();
                break;

            case GameState.Committed:
                OnCommitted?.Invoke();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(state), state, null);
            }
        }