public async Task <string> teachingStateRefresh([FromBody] TeachingState teachingState) { Console.WriteLine("TeachingStateRefresh: " + teachingState.ToString()); var result = await produce("TeachingStateRefresh", teachingState.ToString()); return(result); }
private void UpdateButtonState(TeachingState state) { currentState = state; switch (state) { case TeachingState.Init: btnStart.Enabled = false; btnCancel.Enabled = false; btnReplay.Enabled = false; btnReset.Enabled = false; btnSave.Enabled = false; break; case TeachingState.Start: btnStart.Enabled = false; btnCancel.Enabled = true; btnReplay.Enabled = false; btnReset.Enabled = false; btnSave.Enabled = false; break; case TeachingState.Stop: case TeachingState.Save: case TeachingState.Ready: case TeachingState.Reset: btnStart.Enabled = true; btnCancel.Enabled = (!m_bUploadMode && cmbShotHistory.SelectedIndex >= 0); btnReplay.Enabled = (!m_bUploadMode && cmbShotHistory.SelectedIndex >= 0) || m_bShotFinished; btnReset.Enabled = true; btnSave.Enabled = false; break; case TeachingState.Cancel: //save cancelled btnStart.Enabled = true; btnCancel.Enabled = false; btnReplay.Enabled = false; btnReset.Enabled = true; btnSave.Enabled = false; break; case TeachingState.Replay: btnStart.Enabled = false; btnCancel.Enabled = false; btnReplay.Enabled = false; btnReset.Enabled = false; btnSave.Enabled = false; break; case TeachingState.ShotFinish: if (m_bShotSaved) //replay finished { btnStart.Enabled = true; btnCancel.Enabled = false; btnReplay.Enabled = true; btnReset.Enabled = false; btnSave.Enabled = false; } else { btnStart.Enabled = false; btnCancel.Enabled = true; btnReplay.Enabled = true; btnReset.Enabled = false; btnSave.Enabled = true; } break; case TeachingState.SearchOK: btnReplay.Enabled = true; break; case TeachingState.SearchFail: btnReplay.Enabled = false; break; default: break; } btnStart.Image = btnStart.Enabled ? BilliardWindowsApplication.Properties.Resources.start_button : BilliardWindowsApplication.Properties.Resources.start_disabled_button; btnCancel.Image = btnCancel.Enabled ? BilliardWindowsApplication.Properties.Resources.cancel_button : BilliardWindowsApplication.Properties.Resources.cancel_disabled_button; btnReplay.Image = btnReplay.Enabled ? BilliardWindowsApplication.Properties.Resources.replay_button : BilliardWindowsApplication.Properties.Resources.replay_disabled_button; btnReset.Image = btnReset.Enabled ? BilliardWindowsApplication.Properties.Resources.reset_button : BilliardWindowsApplication.Properties.Resources.reset_disabled_button; btnSave.Image = btnSave.Enabled ? BilliardWindowsApplication.Properties.Resources.save_button : BilliardWindowsApplication.Properties.Resources.save_disabled_button; }