public void ScriptUpdateWait(SeparationMethodStage stageType, string waitForSymbolName, bool addCommand) { ITimeStep stage = m_EditMethod.Stages.GetFirstTimeStepOfStage(stageType, addCommand); if (!addCommand && stage == null) { return; } string waitForSymbolPath = GetSymbolPath(m_Page, waitForSymbolName); ISymbolStep waitForSymbolStep = DDKHelper.FindStepInStage(CommandName.Wait, stage, new string[] { waitForSymbolPath }); if (addCommand) { if (waitForSymbolStep == null) { // System Wait always exist, therefore not checking for nulls ICommand command = m_EditMethod.SymbolTable.Child(CommandName.Wait) as ICommand; ICommandStep commandStep = m_Page.Component.CreateStep(command) as ICommandStep; string path = m_DeviceSymbol.Child(waitForSymbolName).Path; commandStep.Parameters[0].ValueExpression.Parse(path, ExpressionParseOptions.None); stage.SymbolSteps.Add(commandStep); } } else { if (waitForSymbolStep != null) { waitForSymbolStep.Remove(); } } }
public bool IsInScript(SeparationMethodStage stageType, string commandName, ICommand command = null) { if (command == null) { if (string.IsNullOrEmpty(commandName)) { throw new ArgumentNullException("At least one of the parameters commandName or command must be provided"); } } ITimeStep stage = m_EditMethod.Stages.GetFirstTimeStepOfStage(stageType, false); if (stage == null) { return(false); } if (command == null) { command = m_DeviceSymbol.Children[commandName] as ICommand; if (command == null) { return(false); } } ISymbolStep symbolStep = DDKHelper.FindStepInStage(command.Path, stage); if (symbolStep == null) { return(false); } return(true); }
public void ScriptUpdate(SeparationMethodStage stageType, string commandName, bool addCommand) { ITimeStep stage = m_EditMethod.Stages.GetFirstTimeStepOfStage(stageType, true); ICommand command = m_DeviceSymbol.Children[commandName] as ICommand; ISymbolStep commandStep = DDKHelper.FindStepInStage(command.Path, stage); if (addCommand) { if (commandStep == null) // The command is not in the script { command = m_DeviceSymbol.Child(commandName) as ICommand; commandStep = m_Page.Component.CreateStep(command) as ICommandStep; stage.SymbolSteps.Add(commandStep); } } else // Remove Command { if (commandStep != null) // The command is in the script { commandStep.Remove(); } } }