private void updateByStateChange(VTRState newState) { setStatePanels(newState); setStateLabel(newState); setButtonsEnableState(newState); setOtherElementsEnableState(newState); }
private static void currentVTRStateChangedHandler(VTR vtr, VTRState newState) { if ((newState == VTRState.ManuallyStopped) || (newState == VTRState.ManuallyStopped) || (newState == VTRState.Failure)) { currentVTR.StateChanged -= currentVTRStateChangedHandler; startNextVTR(); } }
private void setStatePanels(VTRState state) { statePanel_Reset.BackColor = (state == VTRState.Reset) ? Color.Aqua : Color.White; statePanel_Starting.BackColor = (state == VTRState.Starting) ? Color.Yellow : Color.White; statePanel_Capturing.BackColor = (state == VTRState.Capturing) ? Color.DarkOrange : Color.White; statePanel_Stopping.BackColor = (state == VTRState.Stopping) ? Color.Yellow : Color.White; statePanel_Ready.BackColor = (state == VTRState.Ready) ? Color.Lime : Color.White; statePanel_ManuallyStopped.BackColor = (state == VTRState.ManuallyStopped) ? Color.SeaGreen : Color.White; statePanel_Failure.BackColor = (state == VTRState.Failure) ? Color.Red : Color.White; }
private void setStateLabel(VTRState state) { string stateLabelText = ""; switch (state) { case VTRState.Reset: stateLabelText = "reset"; break; case VTRState.Starting: stateLabelText = "starting capturing"; break; case VTRState.Capturing: stateLabelText = "capturing"; break; case VTRState.Stopping: stateLabelText = "stopping capturing"; break; case VTRState.Ready: stateLabelText = "ready"; break; case VTRState.ManuallyStopped: stateLabelText = "ready (manually stopped)"; break; case VTRState.Failure: stateLabelText = "failure"; break; } stateLabel.Text = "State: " + stateLabelText; captureFilenameLabel.Visible = (state == VTRState.Starting); }
private static void vtrStateChangedHandler(VTR vtr, VTRState newState) { calculateGlobalState(); }
private void vtrStateChangedHandler(VTR vtr, VTRState newState) { this.InvokeIfRequired(vtrControl => { vtrControl.updateByStateChange(newState); }); }
private void setOtherElementsEnableState(VTRState state) { captureFilenameTextbox.Enabled = (state == VTRState.Reset); useInNextBatchCheckbox.Enabled = (state == VTRState.Reset); editDetailsButton.Enabled = (state == VTRState.Reset); }
private void setButtonsEnableState(VTRState state) { startButton.Enabled = (state == VTRState.Reset); stopButton.Enabled = (state == VTRState.Capturing); resetButton.Enabled = (state != VTRState.Capturing) && (state != VTRState.Starting) && (state != VTRState.Stopping); }