public EventData(EventCallback p_callback, Object p_data) { callback = p_callback; data = p_data; hotkey = Keys.None; system = null; }
public void AddCallback(Type eventType, EventCallback callback) { if (eventType.GetInterface(typeof(ITradeEvent).Name) == null) throw new ArgumentException("Event type should implements " + typeof(ITradeEvent).Name); delegates.AddOrUpdate(eventType, callback, (type, eventCallback) => eventCallback + callback); }
internal void UnregisterForEvent(string a_eventKey, EventCallback a_callback) { if (_mapping.ContainsKey (a_eventKey)) { _mapping[a_eventKey] -= a_callback; } }
/// <summary>Formats a callback function with the specified event identifier.</summary> /// <param name="callback">The callback delegate.</param> /// <param name="eventIdentifier">The event identifier.</param> public string ToEventCallbackString(EventCallback callback, string eventIdentifier) { string func = String.Format("{0}('{1}');", ToCallbackString(callback), eventIdentifier); return "function(e,ui){ " + func + " }"; }
public int AttachEvent(VlcEventManagerInstance eventManagerInstance, EventTypes eventType, EventCallback callback) { if (eventManagerInstance == IntPtr.Zero) throw new ArgumentException("Event manager instance is not initialized."); if (callback == null) throw new ArgumentException("Callback for event is not initialized."); return GetInteropDelegate<AttachEvent>().Invoke(eventManagerInstance, eventType, callback, IntPtr.Zero); }
public EventCallbackType TypeForCallback(EventCallback callback) { if (callbackTypes.ContainsKey (callback)) { return callbackTypes [callback]; } return EventCallbackType.NOT_FOUND; }
/** Add a callback */ public void Listen(int id, EventCallback callback, bool deleteAfterInvoke = false) { var binding = new EventBinding() { Id = id, Callback = callback, DeleteAfterInvoke = deleteAfterInvoke }; _bindings.Add(binding); }
/// <summary> /// Subscribes the event. /// </summary> /// <param name="nID">N I.</param> /// <param name="callback">Callback.</param> public virtual void SubscribeEvent(int nID, EventCallback callback) { if (!m_dEventCallback.ContainsKey(nID)) { #if UNITY_EDITOR Debug.Log("Observer " + name + " subscribe event id : " + nID); #endif m_dEventCallback.Add(nID, callback); } }
internal void RegisterForEvent(string a_eventKey, EventCallback a_callback) { if (!_mapping.ContainsKey (a_eventKey)) { _mapping.Add (a_eventKey, a_callback); } else { _mapping[a_eventKey] += a_callback; } }
public EventRealtimeListener(Guid providerGuid, string sessionName, EtwTraceLevel level, long keyword) { if (providerGuid == Guid.Empty) throw new ArgumentException(null, "guid"); if (sessionName == null) throw new ArgumentNullException("sessionName"); _cb = OnEvent; ProviderGuid = providerGuid; SessionName = sessionName; int status; int size; IntPtr properties = BuildProperties(false, out size); try { status = StartTrace(out _handle, SessionName, properties); if (status != 0) { if (status != ERROR_ALREADY_EXISTS) throw new Win32Exception(status); // this can happen if something went wrong on another session with the same name // so let's try to stop this existing thing and restart StopTrace(); status = StartTrace(out _handle, SessionName, properties); if (status != 0) throw new Win32Exception(status); } } catch (Exception e) { #if TRACESPY_SERVICE Program.Log("EventRealtimeListener e:" + e); #else Main.Log("EventRealtimeListener e:" + e); #endif return; } finally { Marshal.FreeCoTaskMem(properties); } status = EnableTraceEx(providerGuid, IntPtr.Zero, _handle, 1, (byte)level, keyword, keyword, 0, IntPtr.Zero); if (status != 0) throw new Win32Exception(status); _traceOn = true; }
/// <summary> /// Event オブジェクトを生成する。 /// </summary> /// <param name="callback">コールバックされるメソッドのデリゲート。</param> /// <param name="duration">callback が呼び出される間隔(ミリ秒単位)。</param> /// <param name="isOneShot">true にした場合、callback は duration だけ経過後 1 回のみ呼び出される。false にした場合、callback は duration ごとに繰り返し呼び出される。</param> /// <param name="user">callback に渡すユーザ定義のデータ。</param> public Event(EventCallback callback, uint duration, bool isOneShot, object user = null) { callback_ = callback; inner_callback_ = Callback; user_ = user; // タイマ起動 var flag = isOneShot ? Win32.TIME_FLAGS.TIME_ONESHOT : Win32.TIME_FLAGS.TIME_PERIODIC; var ret = Win32.Api.timeSetEvent(duration, duration, inner_callback_, IntPtr.Zero, flag); // エラーチェック if ((uint)ret == 0) throw new MMSystemException("マルチメディアタイマの起動に失敗しました。"); timer_id_ = (uint)ret; }
public void Listen(string eventName, MonoBehaviour owner, EventCallback callback) { if (_listenersByEventName == null) _listenersByEventName = new Dictionary<string, List<Listener>>(); List<Listener> listeners = null; if (_listenersByEventName.ContainsKey(eventName)) { listeners = _listenersByEventName[eventName]; } else { listeners = new List<Listener>(); _listenersByEventName[eventName] = listeners; } listeners.Add(new Listener(owner, callback)); }
public Listener(MonoBehaviour owner, EventCallback callback) { this.Owner = owner; this.Callback = callback; }
/// <summary> /// An EventListener providing the code to be called when the visibilitychange event is fired. /// </summary> /// <param name="visibilityCallback">The action to perform when the visibility changes.</param> /// <param name="callingComponent">Pass in 'this' from the calling component.</param> /// <returns>A GUID that can be used to clear the event callback.</returns> public async Task <Guid> OnVisibilityChangeAsync(Action <VisibilityInfo> visibilityCallback, object callingComponent) { EventCallback <VisibilityInfo> eventCallback = EventCallback.Factory.Create(callingComponent, visibilityCallback); return(await AttachCallbackToDomAsync(eventCallback)); }
public void Subscribe(EventCallback callback) { NativeImports.TIO_DATA start = new NativeImports.TIO_DATA();// = NativeImports.TioDataConverter.FromObject(null); NativeImports.tio_container_subscribe( _nativeContainerHandle, ref start, delegate(int result, IntPtr cookie, IntPtr handle, uint eventCode, ref NativeImports.TIO_DATA key, ref NativeImports.TIO_DATA value, ref NativeImports.TIO_DATA metadata) { EventCode convertedEventCode = (EventCode)eventCode; callback( convertedEventCode, NativeImports.TioDataConverter.ToObject(key), NativeImports.TioDataConverter.ToObject(value), NativeImports.TioDataConverter.ToObject(metadata)); }, IntPtr.Zero); }
/// <summary> /// Registers the hook event. /// </summary> /// <param name="nID">N I.</param> /// <param name="hook">Hook.</param> public void RegisterHookEvent(int nID, EventCallback hook) { if (!m_dHook.ContainsKey(nID)) { m_dHook.Add(nID, hook); } }
public void RegisterEventCallback(EventCallback in_cb) { m_eventCallback = in_cb; }
public void RemoveEventListener(string type, EventCallback listener) { this.DeleteEventListener(type, listener); }
public void DetachEvent(VlcEventManagerInstance eventManagerInstance, EventTypes eventType, EventCallback callback) { if (eventManagerInstance == IntPtr.Zero) { throw new ArgumentException("Event manager is not initialized."); } if (callback == null) { return; } GetInteropDelegate <DetachEvent>().Invoke(eventManagerInstance, eventType, callback, IntPtr.Zero); }
public void AddEventListener <T1, T2, T3, T4, T5>(string type, EventCallback <T1, T2, T3, T4, T5> listener) { RegisterEventListener(type, listener); }
public void RemoveListener(object evt, EventCallback callback) { IBinding binding = GetBinding(evt); RemoveValue(binding, callback); }
void OnEnable() { m_ChangeEvent = OnPropertyFieldChanged; }
public IEventBinding To(EventCallback value) { base.To(value); storeMethodType(value as Delegate); return(this); }
/// <summary> /// Constructor for event handler and a model. /// </summary> /// <param name="selectedChanged">Holds the event handler for <see cref="SelectedChanged"/>.</param> /// <param name="isSelected">Indicates if the item is selected.</param> /// <param name="isIndeterminate">Indicates if the item is in indeterminate state.</param> /// <param name="item">Model associated with the row.</param> public MultiSelectContext(EventCallback <bool> selectedChanged, bool isSelected, bool isIndeterminate, TItem item) : this(selectedChanged, isSelected, isIndeterminate) { Item = item; }
/// <summary> /// Constructor for event handler. /// </summary> /// <param name="selectedChanged">Holds the event handler for <see cref="SelectedChanged"/>.</param> /// <param name="isSelected">Indicates if the item is selected.</param> /// <param name="isIndeterminate">Indicates if the item is in indeterminate state.</param> public MultiSelectContext(EventCallback <bool> selectedChanged, bool isSelected, bool isIndeterminate) { SelectedChanged = selectedChanged; IsSelected = isSelected; IsIndeterminate = isIndeterminate; }
public void RemoveEventListener <T1, T2, T3>(string type, EventCallback <T1, T2, T3> listener) { this.DeleteEventListener(type, listener); }
public void AddEventListener <T1>(string type, EventCallback <T1> listener) { RegisterEventListener(type, listener); }
public void DeregisterEventCallback() { m_eventCallback = null; }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { EndStream(); friendsCallback = null; streamStoppedCallback = null; statusCreatedCallback = null; statusDeletedCallback = null; directMessageCreatedCallback = null; directMessageDeletedCallback = null; eventCallback = null; rawJsonCallback = null; }
public void RemoveOnValueChanged(EventCallback <ChangeEvent <T> > callback) { UnregisterCallback(callback); }
internal void UnregisterForEvent(EEventType a_type, EventCallback a_callback) { UnregisterForEvent(a_type.ToString(), a_callback); }
public IEventBinding To(EventCallback value) { base.To (value); storeMethodType(value as Delegate); return this; }
public void ListenForEvent(string eventName, EventCallback callback, bool callWhenInactive = false, int priority = 0) { EventListenerData eld = new EventListenerData(); eld.Callback = callback; eld.CallWhenInactive = callWhenInactive; m_eventListeners[eventName] = eld; ServiceLocator<EventManager>.Instance.RegisterListener (eventName, this, priority); }
public Listener(MonoBehaviour owner, EventCallback callback) { this.Owner = owner; this.Callback = callback; }
public ThrottledQueue(float eventsPerSecond, int timerIntervalMS, bool timeEvents, EventCallback callback, int capacity) { m_pendingEvents = new OrderedDictionary(capacity); m_eventsPerSecond = eventsPerSecond; m_timerIntervalMS = timerIntervalMS; m_timeEvents = timeEvents; m_callback = callback; }
/// <summary> /// Starts the user stream. /// </summary> public async void StartUserStream( InitUserStreamCallback friendsCallback, StreamStoppedCallback streamStoppedCallback, StatusCreatedCallback statusCreatedCallback, StatusDeletedCallback statusDeletedCallback, DirectMessageCreatedCallback directMessageCreatedCallback, DirectMessageDeletedCallback directMessageDeletedCallback, EventCallback eventCallback, RawJsonCallback rawJsonCallback = null ) { if (request != null) { throw new InvalidOperationException("Stream is already open"); } WebRequestBuilder builder = new WebRequestBuilder(new Uri("https://userstream.twitter.com/2/user.json"), HttpMethod.Get, Tokens, userAgent); PrepareStreamOptions(builder); if (StreamOptions != null && StreamOptions is UserStreamOptions) { if ((StreamOptions as UserStreamOptions).AllReplies) builder.Parameters.Add("replies", "all"); } request = await builder.PrepareRequestAsync(); this.friendsCallback = friendsCallback; this.streamStoppedCallback = streamStoppedCallback; this.statusCreatedCallback = statusCreatedCallback; this.statusDeletedCallback = statusDeletedCallback; this.directMessageCreatedCallback = directMessageCreatedCallback; this.directMessageDeletedCallback = directMessageDeletedCallback; this.eventCallback = eventCallback; this.rawJsonCallback = rawJsonCallback; stopReceived = false; //request.DefaultRequestHeaders.Timeout = 10000; return client.GetAsync(request);..BeginGetResponse(StreamCallback, request); return null; }
/// <summary> /// Starts UserStream. /// </summary> /// <param name="friendsCallback">A callback called when UserStream is intialized. This can be null.</param> /// <param name="errorCallback">A callback called when UserStream is stopped. This can be null.</param> /// <param name="statusCreatedCallback">A callback when receive a new status. This can be null.</param> /// <param name="statusDeletedCallback">A callback when a status is deleted. This can be null.</param> /// <param name="dmCreatedCallback">A callback when receive a new direct message. This can be null.</param> /// <param name="dmDeletedCallback">A callback when a direct message is deleted. This can be null.</param> /// <param name="eventCallback">A callback when a new event is raised. This can be null.</param> public void StartStreaming(InitUserStreamCallback friendsCallback, StreamStoppedCallback errorCallback, StatusCreatedCallback statusCreatedCallback, StatusDeletedCallback statusDeletedCallback, DirectMessageCreatedCallback dmCreatedCallback, DirectMessageDeletedCallback dmDeletedCallback, EventCallback eventCallback) { var option = new StreamOptions() { Count = 0 }; stream = new TwitterStream(token, UserAgent, option); stream.StartUserStream(friendsCallback, errorCallback, statusCreatedCallback, statusDeletedCallback, dmCreatedCallback, dmDeletedCallback, eventCallback, null); }
/// <summary> /// Starts the public stream. /// </summary> public IAsyncResult StartPublicStream( StreamStoppedCallback streamStoppedCallback, StatusCreatedCallback statusCreatedCallback, StatusDeletedCallback statusDeletedCallback, EventCallback eventCallback, RawJsonCallback rawJsonCallback = null ) { if (request != null) { throw new InvalidOperationException("Stream is already open"); } WebRequestBuilder builder; if (Tokens == null) builder = new WebRequestBuilder(new Uri("https://stream.twitter.com/1/statuses/filter.json"), HTTPVerb.POST, userAgent, NetworkCredentials); else builder = new WebRequestBuilder(new Uri("https://stream.twitter.com/1/statuses/filter.json"), HTTPVerb.POST, Tokens, userAgent); PrepareStreamOptions(builder); request = builder.PrepareRequest(); this.streamStoppedCallback = streamStoppedCallback; this.statusCreatedCallback = statusCreatedCallback; this.statusDeletedCallback = statusDeletedCallback; this.eventCallback = eventCallback; this.rawJsonCallback = rawJsonCallback; stopReceived = false; #if SILVERLIGHT request.AllowReadStreamBuffering = false; #endif return request.BeginGetResponse(StreamCallback, request); }
public BooleanSetTest() { _eventCallback = args => { }; }
public void OnValueChanged(EventCallback <ChangeEvent <T> > callback) { RegisterCallback(callback); }
/// <summary> /// Starts the public stream. /// </summary> public IAsyncResult StartPublicStream( StreamStoppedCallback streamErrorCallback, StatusCreatedCallback statusCreatedCallback, StatusDeletedCallback statusDeletedCallback, EventCallback eventCallback, RawJsonCallback rawJsonCallback = null ) { WebRequestBuilder builder; if (this.Tokens == null) builder = new WebRequestBuilder(new Uri("https://stream.twitter.com/1/statuses/filter.json"), HTTPVerb.POST, true, this.UserAgent, this.NetworkCredentials); else builder = new WebRequestBuilder(new Uri("https://stream.twitter.com/1/statuses/filter.json"), HTTPVerb.POST, this.Tokens, true, this.UserAgent); PrepareStreamOptions(builder); HttpWebRequest request = builder.PrepareRequest(); this.streamStoppedCallback = streamErrorCallback; this.statusCreatedCallback = statusCreatedCallback; this.statusDeletedCallback = statusDeletedCallback; this.eventCallback = eventCallback; this.rawJsonCallback = rawJsonCallback; this.stopReceived = false; #if SILVERLIGHT request.AllowReadStreamBuffering = false; #endif return request.BeginGetResponse(StreamCallback, request); }
public EventCallbackFunctor(EventCallback <TEventType> callback, CallbackPhase phase) : base(phase) { this.m_Callback = callback; this.m_EventTypeId = EventBase <TEventType> .TypeId(); }
/// <summary> /// Propagate all events trigger by this entity to a given other entity. /// For example, if "OnClick" will be called on this entity, it will trigger OnClick on 'other' as well. /// </summary> /// <param name="other">Entity to propagate events to.</param> public void PropagateEventsTo(DropDown other) { PropagateEventsTo((Entity)other); OnListChange += (Entity entity) => { other.OnListChange?.Invoke(other); }; }
/// <summary> /// Starts the user stream. /// </summary> public IAsyncResult StartUserStream( InitUserStreamCallback friendsCallback, StreamStoppedCallback streamStoppedCallback, StatusCreatedCallback statusCreatedCallback, StatusDeletedCallback statusDeletedCallback, DirectMessageCreatedCallback directMessageCreatedCallback, DirectMessageDeletedCallback directMessageDeletedCallback, EventCallback eventCallback, RawJsonCallback rawJsonCallback = null ) { if (request != null) { throw new InvalidOperationException("Stream is already open"); } WebRequestBuilder builder = new WebRequestBuilder(new Uri("https://userstream.twitter.com/2/user.json"), HTTPVerb.GET, Tokens, userAgent); PrepareStreamOptions(builder); if (StreamOptions != null && StreamOptions is UserStreamOptions) { if ((StreamOptions as UserStreamOptions).AllReplies) builder.Parameters.Add("replies", "all"); } request = builder.PrepareRequest(); this.friendsCallback = friendsCallback; this.streamStoppedCallback = streamStoppedCallback; this.statusCreatedCallback = statusCreatedCallback; this.statusDeletedCallback = statusDeletedCallback; this.directMessageCreatedCallback = directMessageCreatedCallback; this.directMessageDeletedCallback = directMessageDeletedCallback; this.eventCallback = eventCallback; this.rawJsonCallback = rawJsonCallback; stopReceived = false; #if SILVERLIGHT request.AllowReadStreamBuffering = false; #else request.Timeout = 10000; #endif return request.BeginGetResponse(StreamCallback, request); }
public FutureEvent( Action initialize, EventCallback callback) : this(Normal, TimeSpan.MaxValue, initialize, callback) { /* do nothing */ }
public FutureEvent( Adaptivity adaptivity, TimeSpan timeout, Action initialize, EventCallback callback) { this._adaptivity = adaptivity; this._limit = DateTime.Now + timeout; this._callback = callback; this._status = EventStatus.Running; if (initialize != null) initialize(); }
protected void mapEvent(string evt, EventCallback callback) { getEventDispatcher().mapEvent(evt, this, callback); }
/// <summary> /// Starts the user stream. /// </summary> public IAsyncResult StartUserStream( InitUserStreamCallback friendsCallback, StreamStoppedCallback streamErrorCallback, StatusCreatedCallback statusCreatedCallback, StatusDeletedCallback statusDeletedCallback, DirectMessageCreatedCallback directMessageCreatedCallback, DirectMessageDeletedCallback directMessageDeletedCallback, EventCallback eventCallback, RawJsonCallback rawJsonCallback = null ) { WebRequestBuilder builder = new WebRequestBuilder(new Uri("https://userstream.twitter.com/2/user.json"), HTTPVerb.GET, this.Tokens, true, this.UserAgent); PrepareStreamOptions(builder); if (this.StreamOptions != null && this.StreamOptions is UserStreamOptions) { if ((this.StreamOptions as UserStreamOptions).AllReplies) builder.Parameters.Add("replies", "all"); } HttpWebRequest request = builder.PrepareRequest(); this.friendsCallback = friendsCallback; this.streamStoppedCallback = streamErrorCallback; this.statusCreatedCallback = statusCreatedCallback; this.statusDeletedCallback = statusDeletedCallback; this.directMessageCreatedCallback = directMessageCreatedCallback; this.directMessageDeletedCallback = directMessageDeletedCallback; this.eventCallback = eventCallback; this.rawJsonCallback = rawJsonCallback; this.stopReceived = false; #if SILVERLIGHT request.AllowReadStreamBuffering = false; #endif return request.BeginGetResponse(StreamCallback, request); }
public static extern MLResult.Code MLAppConnectRegisterEventCallback([MarshalAs(UnmanagedType.LPStr)] string connectionName, ref EventCallback eventCallback, ref ulong outCallbackHandle);