static int RemoveCallback(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes <LuaEventCallback>(L, 2)) { QKEvent obj = (QKEvent)ToLua.CheckObject <QKEvent>(L, 1); LuaEventCallback arg0 = (LuaEventCallback)ToLua.ToObject(L, 2); obj.RemoveCallback(arg0); return(0); } else if (count == 2 && TypeChecker.CheckTypes <IEventCallback>(L, 2)) { QKEvent obj = (QKEvent)ToLua.CheckObject <QKEvent>(L, 1); IEventCallback arg0 = (IEventCallback)ToLua.ToObject(L, 2); obj.RemoveCallback(arg0); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: QKEvent.RemoveCallback")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int AddCallback(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { QKEvent obj = (QKEvent)ToLua.CheckObject <QKEvent>(L, 1); IEventCallback arg0 = (IEventCallback)ToLua.CheckObject <IEventCallback>(L, 2); obj.AddCallback(arg0); return(0); } else if (count == 3) { QKEvent obj = (QKEvent)ToLua.CheckObject <QKEvent>(L, 1); object arg0 = ToLua.ToVarObject(L, 2); LuaFunction arg1 = ToLua.CheckLuaFunction(L, 3); LuaEventCallback o = obj.AddCallback(arg0, arg1); ToLua.PushObject(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: QKEvent.AddCallback")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void RemoveCallback(IEventCallback callBack) { callBack.Dispose(); if (m_Callbacks.Contains(callBack)) { m_Callbacks.Remove(callBack); } }
public void Subscribe(string tagEvent, IEventCallback eventCallback) { if (!TXmlConnectorHelper.SetCallback(connectorCallback)) { throw (new TransaqConnectorException()); } if (!TXmlConnectorHelper.SetCallbackEx(connectorCallbackEx, IntPtr.Zero)) { throw (new TransaqConnectorException()); } callbacks.Add(tagEvent, eventCallback); }
public static int register(ref MyEvent p_event, IEventCallback p_callback) { p_callback.Handle = p_event.HandleCounter; p_event.HandleCounter += 1; if (p_event.IsBroadcasting) { if (p_event.AddedCallbackQueue == null) { p_event.AddedCallbackQueue = new RefList <IEventCallback>(); } p_event.AddedCallbackQueue.AddRef(ref p_callback); } else { p_event.Callbacks[p_callback.Handle] = p_callback; } return(p_event.HandleCounter - 1); }
/// <summary> /// 绑定值改变事件 /// </summary> public void BindValueChangedEvent(uint sid, string objPath, string attrName, IEventCallback callBack) { if (!m_ValueChangedEvents.ContainsKey(sid)) { m_ValueChangedEvents.Add(sid, new Dictionary <string, Dictionary <string, QKEvent> >()); } var l1 = m_ValueChangedEvents[sid]; if (!l1.ContainsKey(objPath)) { l1.Add(objPath, new Dictionary <string, QKEvent>()); } var l2 = l1[objPath]; if (!l2.ContainsKey(attrName)) { l2.Add(attrName, new QKEvent()); } l2[attrName].AddCallback(callBack); }
public static void broadcast(ref MyEvent p_event) { p_event.IsBroadcasting = true; var l_eventInterator = p_event.Callbacks.GetRefEnumerator(); while (l_eventInterator.MoveNext()) { if (l_eventInterator.GetCurrentRef().value.Execute() == EventCallbackResponse.REMOVE) { if (p_event.RemoveQueue == null) { p_event.RemoveQueue = new List <int>(); } p_event.RemoveQueue.Add(l_eventInterator.GetCurrentRef().value.Handle); } } p_event.IsBroadcasting = false; if (p_event.RemoveQueue != null && p_event.RemoveQueue.Count > 0) { for (int i = 0; i < p_event.RemoveQueue.Count; i++) { unRegister(ref p_event, p_event.RemoveQueue[i]); } p_event.RemoveQueue.Clear(); } if (p_event.AddedCallbackQueue != null && p_event.AddedCallbackQueue.Count > 0) { for (int i = 0; i < p_event.AddedCallbackQueue.Count; i++) { ref IEventCallback l_callback = ref p_event.AddedCallbackQueue.ValueRef(i); p_event.Callbacks[l_callback.Handle] = l_callback; } p_event.AddedCallbackQueue.Clear(); }
public void RemoveValueChangedEvent(uint sid, string objPath, string attrName, IEventCallback callBack) { if (!m_ValueChangedEvents.ContainsKey(sid)) { return; } var l1 = m_ValueChangedEvents[sid]; if (!l1.ContainsKey(objPath)) { return; } var l2 = l1[objPath]; if (!l2.ContainsKey(attrName)) { return; } l2[attrName].RemoveCallback(callBack); if (!l2[attrName].HasCallback) { l2[attrName].Dispose(); l2.Remove(attrName); if (l2.Count < 1) { l1.Remove(objPath); if (l1.Count < 1) { m_ValueChangedEvents.Remove(sid); } } } }
Java.Lang.Object IUseCaseEventConfigBuilder.SetUseCaseEventCallback(IEventCallback p0) { return(SetUseCaseEventCallback(p0)); }
public void AddCallback(IEventCallback callBack) { m_Callbacks.Add(callBack); }