示例#1
0
        public void RemoveAt(KeyType id, Delegates.Callback callback)
        {
            var delegateList = (DelegateList)null;

            if (callbacksByKey.TryGetValue(id, out delegateList))
            {
                delegateList.Remove(callback);
            }
        }
示例#2
0
        public void AddAt(KeyType id, Delegates.Callback callback)
        {
            var delegateList = (DelegateList)null;

            if (!callbacksByKey.TryGetValue(id, out delegateList))
            {
                delegateList       = new DelegateList();
                callbacksByKey[id] = delegateList;
            }
            delegateList.Add(callback);
        }
示例#3
0
 public void Remove(Delegates.Callback callback)
 {
     if (Delegates.runningModificationDebug)
     {
         if (running)
         {
             Logs.errorOnChannel("Nanome.Core", "Changing delegate list while being invoked", "Remove");
             return;
         }
     }
     callbacks.Remove(callback);
 }
示例#4
0
 public void trigger(Delegates.Callback task)
 {
     if (!available)
     {
         return;
     }
     available = false;
     Nanome.Core.Daemon.Dispatcher.queue(delegate()
     {
         task();
         available = true;
     });
 }
示例#5
0
        public bool Set(KeyType id, Delegates.Callback <ParamType> callback)
        {
            var hasKey = callbackByKey.ContainsKey(id);

            if (callback != null)
            {
                callbackByKey[id] = callback;
            }
            else
            {
                callbackByKey.Remove(id);
            }
            return(hasKey);
        }
示例#6
0
        public WatcherManagerNativeLibrary(string library, Delegates.Callback callback)
        {
            // some sanity checks.
            if (library == null)
            {
                throw new ArgumentNullException(nameof(library));
            }
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            _handle   = CreatePtrFromFileSystem(library);
            _callback = callback;
        }