//If set "single config", support full command. private void SingleChannelRadioButton_CheckedChanged(object sender, EventArgs e) { FunctionControl.FunctionState State = m_mainForm.ActiveControler == null ? FunctionControl.FunctionState.Unknown : m_mainForm.ActiveControler.State; //If start testing, can't change button. if (State == FunctionControl.FunctionState.Idle && m_bInRfOn == false) { CheckChannel(); } }
//"Pulse" and "Inventory" use "Tag Access flow". So they can enter this event function. //"RF ON/OFF" doesn't use "Tag Access flow". It doesn't't enter this flow. private void SetButtonState() { try { if (this.InvokeRequired) { Invoke(new MethodInvoker(SetButtonState)); return; } } catch (Exception e) { return; } FunctionControl.FunctionState newState = m_mainForm.ActiveControler == null ? FunctionControl.FunctionState.Unknown : m_mainForm.ActiveControler.State; //Completed inventory or pulse. Reset the dialog. if (newState == FunctionControl.FunctionState.Idle) { //If set "hopping config", only support "inventory" command. CheckChannel(); //Enable Button btnInventory.Enabled = true; btnClear.Enabled = true; btnInventory.Text = "Inventory On"; btnPulse.Text = "Pulse On"; //Enable numPulseOnTime.Enabled = true; numPulseOffTime.Enabled = true; cmbAntPort.Enabled = true; numPowerLevel.Enabled = true; rdoBtnMultiChannel.Enabled = true; rdoBtnSingleChannel.Enabled = true; ckboxErrorKeepRunning.Enabled = true; this.ControlBox = true; rdoBtnContinuous.Enabled = true; rdoBtnNonContinuous.Enabled = true; TemperatureBTN.Enabled = true; textBoxTemperature.Enabled = true; cmbBoxRegion.Enabled = true; } }
private void SetButtonState() { if (this.InvokeRequired) { Invoke(new MethodInvoker(SetButtonState)); return; } String ctrlname = MainForm.ActiveControler == null ? "not active" : MainForm.ActiveControler.Name; FunctionControl.FunctionState newState = MainForm.ActiveControler == null ? FunctionControl.FunctionState.Unknown : MainForm.ActiveControler.State; pauseButton.Checked = newState == FunctionControl.FunctionState.Paused; foreach (ToolStripItem item in toolStrip1.Items) { ToolStripButton b = item as ToolStripButton; if (b != null) { // string s = b.Text; bool newEnabledState = newState != FunctionControl.FunctionState.Unknown && (int)(((FunctionControl.FunctionState)b.Tag) & newState) != 0; if (newEnabledState && MainForm.IsVirtualReaderActiveContext) { if (!(b == inventoryButton || /* * b == inventoryOnceButton || //clark 2011.2.8 copied from R1000 Tracer */ b == stopButton || b == pauseButton || b == abortButton || b == clearButton)) { newEnabledState = false; } } if (b.Enabled != newEnabledState) { b.Enabled = newEnabledState; } } } }
//===============================Event============================================== private void RFTest_FormClosing(object sender, FormClosingEventArgs e) { //If do something, can't close the window. FunctionControl.FunctionState newState = m_mainForm.ActiveControler == null ? FunctionControl.FunctionState.Unknown : m_mainForm.ActiveControler.State; if (newState == FunctionControl.FunctionState.Unknown || newState != FunctionControl.FunctionState.Idle || m_bInRfOn == true) { e.Cancel = true; return; } //Set Frequency to hopping m_btChannelFlag = 0; m_reader.API_TestSetFrequencyConfiguration(m_btChannelFlag, m_uiExactFrequecny); //Remove Event m_mainForm.BindAllFunctionControlers(FunctionStateChanged, false); }