private void LookupSeparatorStateStrings(Type resourceType, SeparatorState separatorState, out string stateName, out string stateDescription) { string resourceLookupString = string.Empty; try { // Build up the resource base lookup string string resourcePrefix = theSeparatorTypePattern.Match( resourceType.ToString()).Value + theResourcesSeparator; resourceLookupString = resourcePrefix + Enum.GetName(resourceType, separatorState); // Get the string for the SeparatorState itself stateName = theSeparatorResources.GetString(resourceLookupString); } catch { stateName = String.Empty; } try { // Get the string for the SeparatorState description stateDescription = theSeparatorResources.GetString(resourceLookupString + theResourcesDescriptionSuffix); } catch { stateDescription = String.Empty; } }
// Recalculate the quadrant's state. // This is called any time something has changed that may cause the state to change. // NOTE: This doesn't allow for transitions after the Configured state - presently // they are not used. public void UpdateState(bool notifyStateChange) { SeparatorState prevState = myState; // No protocol selected if (myProtocolId == 0) { myState = SeparatorState.SeparatorUnloaded; } // If this isn't the initial quadrant, we relax the requirements for the quadrant to // have a sample volume and be configured, as this is taken care of by the initial // quadrant for the protocol. else if (!myProtocolInitialQuadrant) { myState = SeparatorState.Configured; } // We have everything that is required. else if (isConfigured) { myState = SeparatorState.Configured; } // We have the protocol, and sample volume (if required), but it is not configured, // so we should be in the selected state else { myState = SeparatorState.Selected; } // Check if the state has changed if ((prevState != myState) && notifyStateChange) { FireQuadrantStateUpdate(); } }
public void AtQuadrantStateUpdate(QuadrantId quadrant, SeparatorState newState) { if (UpdateQuadrantState != null) { UpdateQuadrantState(quadrant, newState); } }
public void AtSeparatorStateUpdate(SeparatorState newState) { System.Diagnostics.Debug.WriteLine(String.Format("------------------------------ SeparatorEventSink: AtSeparatorStatusUpdate-------------------------")); if (UpdateSeparatorState != null) { UpdateSeparatorState(newState); } }
private SeparatorState FindSeparator(string value, Dictionary <string, TokenType> dictionary) { SeparatorState state = SeparatorState.NotFound; foreach (var item in PunctuationSymbols.Keys.Where(key => key.StartsWith(value))) { if (item.Length == value.Length) { return(SeparatorState.Completed); } else { state = SeparatorState.Started; } } return(state); }
/// <summary> /// Updates the dialog when the Paused state is reached. /// </summary> /// <param name="newState"></param> private void AtSeparatorStateUpdate(SeparatorState newState) { System.Diagnostics.Debug.WriteLine(String.Format("------------------------------ AtSeparatorStateUpdate 1------------------------------")); try { if (this.InvokeRequired) { SeparatorStatusDelegate eh = new SeparatorStatusDelegate(this.AtSeparatorStateUpdate); this.Invoke(eh, new object[] { newState }); } else { switch (newState) { default: break; case SeparatorState.Paused: System.Diagnostics.Debug.WriteLine("------------------------------ - AtSepStateUpdate in PauseResumeDialog, State is PAUSED...call SetPausedMode lidClosed"); // bdr #if bdr15 SetPausedMode(true, false, ""); // bdr new #else SetPausedMode(); #endif break; // The instrument has either resumed or the batch run has // completed. Since this was an instrument-initiated event, // use a different return code (that is, we do not want to // send Resume or Halt commands to the instrument). case SeparatorState.Running: case SeparatorState.BatchComplete: case SeparatorState.BatchHalted: DialogResult = DialogResult.Abort; break; } //switch } } catch (Exception ex) { LogFile.LogException(TraceLevel.Error, ex); } }
// FUTURE: consider implementing a cache (hashtable?) based on the resource lookup // string. You'd need to flush the cache if the thread culture changed, or have the // cache as thread-local storage (and then control the 'thread caches' individually). public static void GetSeparatorStateStrings(Type resourceType, SeparatorState separatorState, out string stateName, out string stateDescription) { SeparatorResourceManager.GetInstance().LookupSeparatorStateStrings(resourceType, separatorState, out stateName, out stateDescription); }