Ejemplo n.º 1
0
        /// <summary>
        /// 数字ボタンがクリックされた
        /// </summary>
        /// <param name="sender">イベントのソース</param>
        /// <param name="e">イベントデータ</param>
        private void NumberButton_Click(object sender, EventArgs e)
        {
            Button clickedBtn = (Button)sender;

            switch (state.GetState())
            {
            case ConstDefines.CalcState.Initaial:
            {
                state.InputNumberInitialState(clickedBtn.Text);
                break;
            }

            case ConstDefines.CalcState.WaitOperation:
            {
                state.InputNumberWaitOperationInputState(clickedBtn.Text);
                break;
            }

            case ConstDefines.CalcState.WaitNumInputAfterOperation:
            {
                state.InputNumberWaitNumInputAfterOperationState(clickedBtn.Text);
                break;
            }

            case ConstDefines.CalcState.Calulable:
            {
                state.InputNumberCalculableState(clickedBtn.Text);
                break;
            }

            default:
            {
                state.SetState(ConstDefines.CalcState.Initaial);
                break;
            }
            }
        }