public static GetFailedAction ( IEnumerable |
||
conditionList | IEnumerable |
|
caller | object | |
return | ConditionFailedAction |
public bool CanExecute(object parameter) { if (Condition.GetFailedAction(conditions, parameter) != ConditionFailedAction.Nothing) { return(false); } if (!commandCreated) { return(true); } return(addInCommand != null && addInCommand.CanExecute(parameter)); }
internal static List <Runtime> ReadSection(XmlReader reader, AddIn addIn, string hintPath) { List <Runtime> runtimes = new List <Runtime>(); Stack <ICondition> conditionStack = new Stack <ICondition>(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.EndElement: if (reader.LocalName == "Condition" || reader.LocalName == "ComplexCondition") { conditionStack.Pop(); } else if (reader.LocalName == "Runtime") { return(runtimes); } break; case XmlNodeType.Element: switch (reader.LocalName) { case "Condition": conditionStack.Push(Condition.Read(reader, addIn)); break; case "ComplexCondition": conditionStack.Push(Condition.ReadComplexCondition(reader, addIn)); break; case "Import": runtimes.Add(Runtime.Read(addIn, reader, hintPath, conditionStack)); break; case "DisableAddIn": if (Condition.GetFailedAction(conditionStack, addIn) == ConditionFailedAction.Nothing) { // The DisableAddIn node not was not disabled by a condition addIn.CustomErrorMessage = reader.GetAttribute("message"); } break; default: throw new AddInLoadException("Unknown node in runtime section :" + reader.LocalName); } break; } } return(runtimes); }
// // public void BinarySerialize(BinaryWriter writer) // { // writer.Write(AddInTree.GetNameOffset(name)); // writer.Write(AddInTree.GetAddInOffset(addIn)); // properties.BinarySerialize(writer); // } // internal object BuildItem(BuildItemArgs args) { IDoozer doozer; if (!AddInTree.Doozers.TryGetValue(Name, out doozer)) { throw new CoreException("Doozer " + Name + " not found! " + ToString()); } if (!doozer.HandleConditions) { ConditionFailedAction action = Condition.GetFailedAction(args.Conditions, args.Caller); if (action != ConditionFailedAction.Nothing) { return(null); } } return(doozer.BuildItem(args)); }
public ConditionFailedAction GetFailedAction(object caller) { return(Condition.GetFailedAction(conditions, caller)); }
internal static void ReadSection(XmlReader reader, AddIn addIn, string hintPath) { Stack <ICondition> stack = new Stack <ICondition>(); while (reader.Read()) { XmlNodeType nodeType = reader.NodeType; if (nodeType != XmlNodeType.Element) { if (nodeType == XmlNodeType.EndElement) { if (reader.LocalName == "Condition" || reader.LocalName == "ComplexCondition") { stack.Pop(); } else { if (reader.LocalName == "Runtime") { return; } } } } else { string localName; if ((localName = reader.LocalName) != null) { if (!(localName == "Condition")) { if (!(localName == "ComplexCondition")) { if (!(localName == "Import")) { if (localName == "DisableAddIn") { if (Condition.GetFailedAction(stack, addIn) == ConditionAction.Nothing) { addIn.CustomErrorMessage = reader.GetAttribute("message"); } } } else { addIn.Runtimes.Add(Runtime.Read(addIn, reader, hintPath, stack)); } } else { stack.Push(Condition.ReadComplexCondition(reader)); } } else { stack.Push(Condition.Read(reader)); } } } } }