public void OnDialogOk(string message, object workingObject = null, object workingObjectSecond = null) { if (string.IsNullOrEmpty(message)) { return; } Controller.Instance.VarFlagSummary.addVar(message); if (condition == null) { condition = new VarCondition(message, 0, 0); } else { if (!string.IsNullOrEmpty(condition.getId())) { Controller.Instance.VarFlagSummary.deleteVarReference(condition.getId()); } condition.setId(message); } Controller.Instance.VarFlagSummary.addVarReference(message); Controller.Instance.DataModified(); }
private static XmlElement createConditionElement(XmlDocument doc, Condition condition) { XmlElement conditionElement = null; if (condition.getType() == Condition.FLAG_CONDITION) { // Create the tag if (condition.getState() == FlagCondition.FLAG_ACTIVE) { conditionElement = doc.CreateElement("active"); } else if (condition.getState() == FlagCondition.FLAG_INACTIVE) { conditionElement = doc.CreateElement("inactive"); } // Set the target flag and append it conditionElement.SetAttribute("flag", condition.getId()); } else if (condition.getType() == Condition.VAR_CONDITION) { VarCondition varCondition = (VarCondition)condition; // Create the tag if (varCondition.getState() == VarCondition.VAR_EQUALS) { conditionElement = doc.CreateElement("equals"); } else if (varCondition.getState() == VarCondition.VAR_NOT_EQUALS) { conditionElement = doc.CreateElement("not-equals"); } else if (condition.getState() == VarCondition.VAR_GREATER_EQUALS_THAN) { conditionElement = doc.CreateElement("greater-equals-than"); } else if (condition.getState() == VarCondition.VAR_GREATER_THAN) { conditionElement = doc.CreateElement("greater-than"); } else if (condition.getState() == VarCondition.VAR_LESS_EQUALS_THAN) { conditionElement = doc.CreateElement("less-equals-than"); } else if (condition.getState() == VarCondition.VAR_LESS_THAN) { conditionElement = doc.CreateElement("less-than"); } // Set the target flag and append it conditionElement.SetAttribute("var", varCondition.getId()); conditionElement.SetAttribute("value", varCondition.getValue().ToString()); } else if (condition.getType() == Condition.GLOBAL_STATE_CONDITION) { GlobalStateCondition globalStateCondition = (GlobalStateCondition)condition; // Create the tag conditionElement = doc.CreateElement("global-state-ref"); // Set the target flag and append it conditionElement.SetAttribute("id", globalStateCondition.getId()); conditionElement.SetAttribute("value", globalStateCondition.getState() == GlobalStateCondition.GS_SATISFIED ? "true" : "false"); } return(conditionElement); }