コード例 #1
0
ファイル: KeyMap.cs プロジェクト: rajeshwarn/MochaNote
        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);
        }
コード例 #2
0
 private void RegisterPrefixes(IEnumerable <NsPrefix> prefixRegistrations)
 {
     foreach (var prefixRegistration in prefixRegistrations)
     {
         var registration = new PrefixRegistration(prefixRegistration.Prefix, prefixRegistration.Namespace);
         wiringContext.TypeContext.RegisterPrefix(registration);
     }
 }
コード例 #3
0
 private void RegisterPrefixes(IEnumerable <NsPrefix> prefixRegistrations)
 {
     foreach (var prefixRegistration in prefixRegistrations)
     {
         var registration = new PrefixRegistration(prefixRegistration.Prefix, prefixRegistration.Namespace);
         typeSource.RegisterPrefix(registration);
     }
 }
コード例 #4
0
ファイル: KeyMap.cs プロジェクト: rajeshwarn/MochaNote
 public void Clear()
 {
     _keyToActions.Clear();
     if (_prefixedKeyMaps != null)
     {
         _prefixedKeyMaps.Clear();
     }
     _currentPrefix = null;
 }
コード例 #5
0
        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,
            });
        }
コード例 #6
0
ファイル: TypeContext.cs プロジェクト: gitter-badger/OmniXAML
 public void RegisterPrefix(PrefixRegistration prefixRegistration)
 {
     nsRegistry.RegisterPrefix(prefixRegistration);
 }
コード例 #7
0
 private void RegisterPrefixes(IEnumerable<NsPrefix> prefixRegistrations)
 {
     foreach (var prefixRegistration in prefixRegistrations)
     {
         var registration = new PrefixRegistration(prefixRegistration.Prefix, prefixRegistration.Namespace);
         wiringContext.TypeContext.RegisterPrefix(registration);
     }
 }
コード例 #8
0
 protected bool Equals(PrefixRegistration other)
 {
     return string.Equals(prefix, other.prefix) && string.Equals(ns, other.ns);
 }
コード例 #9
0
 public void RegisterPrefix(PrefixRegistration prefixRegistration)
 {
     NamespaceRegistry.RegisterPrefix(prefixRegistration);
 }
コード例 #10
0
ファイル: KeyMap.cs プロジェクト: rajeshwarn/MochaNote
 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;
             });
         }
     }
 }
コード例 #11
0
ファイル: KeyMap.cs プロジェクト: rajeshwarn/MochaNote
 public void ClearPrefixInput()
 {
     _currentPrefix = null;
 }
コード例 #12
0
 private void RegisterPrefixes(IEnumerable<NsPrefix> prefixRegistrations)
 {
     foreach (var prefixRegistration in prefixRegistrations)
     {
         var registration = new PrefixRegistration(prefixRegistration.Prefix, prefixRegistration.Namespace);
         typeSource.RegisterPrefix(registration);
     }
 }
コード例 #13
0
 public void RegisterPrefix(PrefixRegistration prefixRegistration)
 {
     _prefixes[prefixRegistration.Prefix] = prefixRegistration.Ns;
 }
コード例 #14
0
 public void RegisterPrefix(PrefixRegistration prefixRegistration)
 {
     inner.RegisterPrefix(prefixRegistration);
 }
コード例 #15
0
ファイル: TypeContext.cs プロジェクト: keichinger/OmniXAML
 public void RegisterPrefix(PrefixRegistration prefixRegistration)
 {
     nsRegistry.RegisterPrefix(prefixRegistration);
 }
コード例 #16
0
 public void RegisterPrefix(PrefixRegistration prefixRegistration)
 {
     NamespaceRegistry.RegisterPrefix(prefixRegistration);
 }
コード例 #17
0
 protected bool Equals(PrefixRegistration other)
 {
     return(string.Equals(prefix, other.prefix) && string.Equals(ns, other.ns));
 }