public KeyMap <TTarget> SetPrefix( Keys key, Action <Keys, TTarget> transitAction, Action <Keys, TTarget> returnAction, Func <Keys, TTarget, bool> returnJudge, bool isConsumeKeyOnReturn ) { var keyMap = new KeyMap <TTarget>(); SetAction( key, (target) => { if (transitAction != null) { transitAction(key, target); } _currentPrefix = _PrefixedKeyMaps[key]; } ); _PrefixedKeyMaps[key] = new PrefixRegistration( keyMap, returnAction, returnJudge, isConsumeKeyOnReturn ); return(keyMap); }
private void RegisterPrefixes(IEnumerable <NsPrefix> prefixRegistrations) { foreach (var prefixRegistration in prefixRegistrations) { var registration = new PrefixRegistration(prefixRegistration.Prefix, prefixRegistration.Namespace); wiringContext.TypeContext.RegisterPrefix(registration); } }
private void RegisterPrefixes(IEnumerable <NsPrefix> prefixRegistrations) { foreach (var prefixRegistration in prefixRegistrations) { var registration = new PrefixRegistration(prefixRegistration.Prefix, prefixRegistration.Namespace); typeSource.RegisterPrefix(registration); } }
public void Clear() { _keyToActions.Clear(); if (_prefixedKeyMaps != null) { _prefixedKeyMaps.Clear(); } _currentPrefix = null; }
public ProtoInstruction NamespacePrefixDeclaration(string prefix, string ns) { if (PrefixRegistrationMode == PrefixRegistrationMode.Automatic) { var prefixRegistration = new PrefixRegistration(prefix, ns); if (!typeSource.RegisteredPrefixes.Contains(prefixRegistration)) { typeSource.RegisterPrefix(prefixRegistration); } } return(new ProtoInstruction { Namespace = ns, XamlType = null, NodeType = NodeType.PrefixDefinition, Prefix = prefix, }); }
public void RegisterPrefix(PrefixRegistration prefixRegistration) { nsRegistry.RegisterPrefix(prefixRegistration); }
private void RegisterPrefixes(IEnumerable<NsPrefix> prefixRegistrations) { foreach (var prefixRegistration in prefixRegistrations) { var registration = new PrefixRegistration(prefixRegistration.Prefix, prefixRegistration.Namespace); wiringContext.TypeContext.RegisterPrefix(registration); } }
protected bool Equals(PrefixRegistration other) { return string.Equals(prefix, other.prefix) && string.Equals(ns, other.ns); }
public void RegisterPrefix(PrefixRegistration prefixRegistration) { NamespaceRegistry.RegisterPrefix(prefixRegistration); }
public Func <TTarget, bool> GetAction(Keys key) { if (_currentPrefix == null) { ActionRegistration ret; if (_keyToActions.TryGetValue(key, out ret)) { return((target) => { ret.Action(target); return ret.IsConsumeKey; }); } else { return(null); } } else { var currentKeyMap = _currentPrefix.KeyMap; if (currentKeyMap.IsDefined(key)) { Func <TTarget, bool> action = currentKeyMap.GetAction(key); return((target) => { var ret = action(target); var retJudge = _currentPrefix.ReturnJudge; var retAct = _currentPrefix.ReturnAction; var isConsumeKey = _currentPrefix.IsConsumeKeyOnReturn; if (retJudge == null || retJudge(key, target)) { _currentPrefix = null; if (retAct != null) { retAct(key, target); } return ret || isConsumeKey; } else { return ret; } }); } else { return((target) => { var retJudge = _currentPrefix.ReturnJudge; var retAct = _currentPrefix.ReturnAction; var isConsumeKey = _currentPrefix.IsConsumeKeyOnReturn; if (retJudge == null || retJudge(key, target)) { _currentPrefix = null; if (retAct != null) { retAct(key, target); } } return isConsumeKey; }); } } }
public void ClearPrefixInput() { _currentPrefix = null; }
private void RegisterPrefixes(IEnumerable<NsPrefix> prefixRegistrations) { foreach (var prefixRegistration in prefixRegistrations) { var registration = new PrefixRegistration(prefixRegistration.Prefix, prefixRegistration.Namespace); typeSource.RegisterPrefix(registration); } }
public void RegisterPrefix(PrefixRegistration prefixRegistration) { _prefixes[prefixRegistration.Prefix] = prefixRegistration.Ns; }
public void RegisterPrefix(PrefixRegistration prefixRegistration) { inner.RegisterPrefix(prefixRegistration); }
protected bool Equals(PrefixRegistration other) { return(string.Equals(prefix, other.prefix) && string.Equals(ns, other.ns)); }