public bool TryRegister(Action <WindowMessageEventArgs> callback, out uint message) { message = 0; if (Callbacks.Count < ushort.MaxValue - MessageListener.BaseUserMessage) { uint i = _lastMessage + 1; while (i != _lastMessage) { if (i > ushort.MaxValue) { i = MessageListener.BaseUserMessage; } if (!Callbacks.ContainsKey(i)) { _lastMessage = message = i; Callbacks.Add(i, callback); return(true); } i++; } } return(false); }
public void SetToastr( string title, string text, string type = "Success", bool closeButton = true, string positionClass = "toast-top-right", int showDuration = 300, int hideDuration = 300, int timeOut = 5000, int extendedTimeout = 1000, string showEasing = "swing", string hideEasing = "linear", string showMethod = "fadeIn", string hideMethod = "fadeOut") { Callbacks.Add( $"XGeneral.toastr{type}", new { title, text, closeButton, debug = false, positionClass, showDuration, hideDuration, timeOut, extendedTimeout, showEasing, hideEasing, showMethod, hideMethod }); }
public void On(string eventName, FunctionInstance fn) { Callbacks.Add(new EventCallback() { EventName = eventName, Callback = fn }); }
internal void AddCallback() { var callback = new Callback(); Callbacks.Add(callback); SelectedCallback = callback; }
public void SetHtml(string target, string message) { Callbacks.Add("XGeneral.Html", new { target, message }); }
public void SetRedirect(Uri url, object vars = null) { Callbacks.Add("XGeneral.redirect", new { url, vars }); }
public static void DrawPoint(Vector3 pos, float pixelsPerUnit = 1, float duration = 3) { var trans = Instantiate(t.debugSprite); trans.position = pos; trans.localScale = new Vector3(1 / pixelsPerUnit, 1 / pixelsPerUnit, 1 / pixelsPerUnit); Callbacks.Add(() => Destroy(trans.gameObject), duration); }
public void SetModalWithPartial(ModalType type, string path, string selector = null) { Callbacks.Add("XModal.initModal", new { type, selector = selector ?? $"#domModalGeneric{type}", path }); }
public void On <T>(Func <T, Task> callback) { if (!Callbacks.ContainsKey(typeof(T))) { Callbacks.Add(typeof(T), new List <MulticastDelegate>()); } Callbacks[typeof(T)].Add(callback); }
internal RegisterResult Register(string name, System.Delegate callback) { var thunk = (name != "all")? CreateCallback(callback) : CreateGenericCallback(callback); var result = new RegisterResult { thunk = CallbackThunk, id = Callbacks.Count }; Callbacks.Add(thunk); return(result); }
public IDisposable OnReceived(Func <byte[], object, Task> callback, object state) { var receiveCallBack = new ReceiveCallback(callback, state); lock (Callbacks) { Callbacks.Add(receiveCallBack); } return(new Subscription(receiveCallBack, Callbacks)); }
public void SetPartial(Uri url, string target, object vars, string loadtext = "Actualizando...") { Callbacks.Add("XGeneral.renderpartial", new { url, target, loadtext, vars }); }
public void Confirm(Action <bool> onConfirm, bool left = true, bool once = true) { switch (inputDevice) { #if SENSEGLOVE case InputDevice.SENSE_GLOVE: { onConfirmCallbacks.Add(onConfirm, once); if (coroutine == null) { dwellTimer.SetTimer(confirmationDwellTime, () => { Debug.Log("UserInteractionManager, SenseGlove done"); StopCoroutine(coroutine); coroutine = null; Cleanup(); onConfirmCallbacks.Call(true); }); coroutine = StartCoroutine(SenseGloveConfirm(left)); } break; } #endif case InputDevice.CONTROLLERS: onConfirmCallbacks.Add(onConfirm, once); if (coroutine == null) { coroutine = StartCoroutine(ControllerConfirm()); } break; case InputDevice.KEYBOARD: { onConfirmCallbacks.Add(onConfirm, once); if (coroutine == null) { coroutine = StartCoroutine(KeyboardConfirm()); } break; } } }
/// <summary> /// Constructor to create an EventDescriptor instance and set the meta-datas. /// </summary> public EventDescriptor(bool onlyOnce, bool autoDecodePayload, SocketIOCallback callback) { this.OnlyOnce = onlyOnce; this.AutoDecodePayload = autoDecodePayload; this.Callbacks = new List <SocketIOCallback>(1); if (callback != null) { Callbacks.Add(callback); } }
public void SetGlitter(string title, string text, string className = "gritter-primary", string beforeClose = "") { Callbacks.Add("XGeneral.gritter", new { title, text, class_name = className, before_close = beforeClose }); }
public async Task SendMessageAsync(string method, object requestParams, Action <JToken> callBack) { var requestId = StringExtensions.RandomString; if (callBack != null) { Callbacks.Add(requestId, callBack); } await Websocket.SendAsync(PackMessage(method, requestId, requestParams), WebSocketMessageType.Text, true, CancellationToken.None); }
/// <summary> /// Registers the member definitions. /// </summary> /// <param name="memberDefinitions">The member definitions.</param> private void RegisterMemberDefinitions(IEnumerable <IMemberDefinition> memberDefinitions) { lock (Callbacks) { InterceptedMembers = memberDefinitions.ToList(); var members = InterceptedMembers.Where(member => !Callbacks.Contains(member)); members.ForEach(member => Callbacks.Add(member, new CallbackCollection())); } }
/// <summary> /// Adds the callback. /// </summary> /// <param name="callbackFunction">The callback function.</param> /// <param name="context">The context.</param> /// <returns></returns> private Guid?AddCallback(CefV8Value callbackFunction, CefV8Context context) { if (callbackFunction != null && callbackFunction.IsFunction) { var callback = new JavascriptFunction(callbackFunction, context); Callbacks.Add(callback.Id, callback); return(callback.Id); } return(null); }
public static void DrawPoints(IEnumerable <Vector2> points, Vector3 offset, float width, float height, float duration, float pixelsPerUnit = 1f) { List <Transform> transArr = new List <Transform>(); points.ForEach(point => { var trans = Instantiate(t.debugSprite); trans.position = new Vector3( (point.x - width / 2) / pixelsPerUnit, (point.y - height / 2) / pixelsPerUnit, 0) + offset + new Vector3((1 / pixelsPerUnit) / 2, (1 / pixelsPerUnit) / 2, 0); trans.localScale = new Vector3(1 / pixelsPerUnit, 1 / pixelsPerUnit, 1 / pixelsPerUnit); transArr.Add(trans); }); Callbacks.Add(() => transArr.ForEach(trans => Destroy(trans.gameObject)), duration); }
public void RegisterForCallback() { try { Client clientCallback = OpContext.GetCallbackChannel(); Debug.Assert(clientCallback != null); lock (CallbackLock) { if (!Callbacks.Contains(clientCallback)) { Log.Debug("Callback registration."); Callbacks.Add(clientCallback); } } } catch (Exception e) { throw GetFault(e); } }
public Guid On <T>(Action <T> callback) { lock (Callbacks) { if (!Callbacks.ContainsKey(typeof(T))) { Callbacks.Add(typeof(T), new Dictionary <Guid, MulticastDelegate>()); } var id = Guid.NewGuid(); Callbacks[typeof(T)].Add(id, callback); lock (CallbackTypes) { CallbackTypes.Add(id, typeof(T)); } return(id); } }
/* * BeginProcessRequest gets called automatically when the request comes in * We don't have to handle things in ProcessRequest/PageLoad and then set * everything up manually using RegisterAsyncTask like we do with an async * aspx page. We ignore */ public IAsyncResult BeginProcessRequest( HttpContext context, AsyncCallback callback, Object extraData ) { context.Response.Write( "<p>BeginProcessReqeust: Thread " + Thread.CurrentThread.ManagedThreadId + "</p>" ); // async is a dummy IAsyncResult to satisfy the method signature AsyncOperation async = new AsyncOperation( null, null, null ); // Callback context holds a callback and the httpcontext. // In hindsight we could have done this without the callback // so this is a possible point of refactoring. (TODO) CallbackContext callbackContext = new CallbackContext( new NotificationCallback( Callback ), context ); /** * TODO: this is too coarse of a lock, should be locking 'callbacks' */ lock( typeof( Register ) ) { Callbacks.Add( Guid.NewGuid().ToString(), callbackContext ); } return async; }
private Guid?AddCallback(CefV8Value callbackFunction, CefV8Context context) { if (callbackFunction != null) { if (context == null) { throw new ArgumentNullException("context"); } if (!callbackFunction.IsFunction) { throw new ArgumentException("Not a function.", "callbackFunction"); } var callback = new JavascriptFunction(callbackFunction, context); Callbacks.Add(callback.Id, callback); return(callback.Id); } return(null); }
public virtual void OnMessageReceived(Func <IModel, BasicDeliverEventArgs, Task> callback) { Callbacks.Add(callback); }
public virtual void OnMessageReceived(Func <Message <string, byte[]>, Task> callback) { Callbacks.Add(callback); }
// Start is called before the first frame update void Start() { Callbacks.Add(() => Debug.Log("Ran!"), 3); Destroy(gameObject); }
public bool AddCallback(TaskCompletionSource <Ice.IObjectPrx> cb) { Callbacks.Add(cb); return(Callbacks.Count == 1); }
private void OnLoginWithCustomId(LoginWithCustomIDRequest request) { Callbacks.Add("OnRequest_InstLogin"); }
private void OnLoginResult(LoginResult result) { Callbacks.Add("OnResponse_InstLogin"); }
public void TriggerEnterCallback(System.Action <Vector3> callback, bool once = false) => onTriggerEnter.Add(callback, once);