public void RegisterCallback(String cmdname, CallbackType func, Type vartype, String desc) { CallbackItem cb; String vartypename = "null"; String cmd = cmdname; if (vartype != null) { vartypename = vartype.ToString(); cmd += "|" + vartypename; } if (CallbackDB.ContainsKey(cmdname)) { cb = CallbackDB[cmd]; } else { cb = new CallbackItem(); cb.name = cmdname; cb.type = vartypename; cb.description = desc; CallbackDB[cmd] = cb; } cb.RetCallback = null; cb.retType = "void"; cb.Callback += new CallbackType(func); }
public CallbackCommand(XmlElement el) { type = (CallbackType)Enum.Parse(typeof(CallbackType), el.Name.Replace('-', '_'), true); id = el.GetAttribute("id"); command = (Callback.Command) Enum.Parse(typeof(Callback.Command), el.GetAttribute("command"), true); XmlNodeList childs = el.ChildNodes; for (int i = 0; i < childs.Count; i++) { XmlNode node = childs.Item(i); if (node.Name.Equals("after")) { XmlNodeList l = node.ChildNodes; if (l.Count > 0) { afterCmd = new Tuple((XmlElement) l.Item(0)); } } else if (node.Name.Equals("before")) { XmlNodeList l = node.ChildNodes; if (l.Count > 0) { beforeCmd = new Tuple((XmlElement) l.Item(0)); } } } //XmlNodeList list = el.GetElementsByTagName("tuple"); //XmlNode node = list[0]; //tuple = new Tuple((XmlElement)node); if (el.GetAttribute("seq") != null) { seq = int.Parse(el.GetAttribute("seq")); } }
protected void ReadScanData(ErrorCodes errorCode, CallbackType callbackType, object callbackData) { int availableSamples = (int)callbackData; double[,] scanData; try { scanData = Device.ReadScanData(availableSamples, 0); int channels = scanData.GetLength(0); int samples = scanData.GetLength(1); DataDisplay = String.Empty; for (int i = 0; i < Math.Min(100, samples); i++) { for (int j = 0; j < channels; j++) { DataDisplay += scanData[j, i].ToString("F03") + " "; } DataDisplay += Environment.NewLine; } ScanDataTextBox.Text = DataDisplay; } catch (Exception ex) { Stop = true; statusLabel.Text = ex.Message; } }
public void reset() { Debug2.LogDebug("reset callback id="+id); type = CallbackType.UNKNOWN; mailruEventId = UNSET_HTML_EVENT_ID; action = null; }
internal void AddCallback(CallbackType callbackType, Delegate callback) { // Adds or replaces a delegate in the delegate list. if (_apiCallbacks.ContainsKey(callbackType)) _apiCallbacks.Add(callbackType, callback); else _apiCallbacks[callbackType] = callback; }
internal bool HasCallback(CallbackType callbackType) { if (_apiCallbacks.ContainsKey(callbackType)) { return true; } else { return Parent != null && Parent.HasCallback(callbackType); } }
internal Delegate GetCallback(CallbackType callbackType) { if (_apiCallbacks.ContainsKey(callbackType)) { return _apiCallbacks[callbackType]; } else { return Parent?.GetCallback(callbackType); } }
public CallbackCommand(Callback.Command command, Tuple afterCmd, Tuple beforeCmd, int major, int minor, int version, String user, int seq, CallbackType type) { this.command = command; this.afterCmd = afterCmd; this.beforeCmd = beforeCmd; this.major = major; this.minor = minor; this.version = version; this.user = user; this.seq = seq; this.type = type; }
//=================================================================================================== /// <summary> /// Disables a callback /// </summary> /// <param name="type">The callback type</param> //=================================================================================================== public void DisableCallback(CallbackType callbackType) { Monitor.Enter(m_deviceLock); if (callbackType == CallbackType.OnDataAvailable) m_driverInterface.OnDataAvailableCallbackControl = null; else if (callbackType == CallbackType.OnInputScanComplete) m_driverInterface.OnInputScanCompleteCallbackControl = null; else if (callbackType == CallbackType.OnInputScanError) m_driverInterface.OnInputScanErrorCallbackControl = null; //else if (callbackType == CallbackType.OnAcquisitionArmed) // m_driverInterface.OnAcquisitionArmedCallbackControl = null; Monitor.Exit(m_deviceLock); }
/// <summary> /// Assigns the given callback to this Tweener/Sequence, /// overwriting any existing callbacks of the same type. /// </summary> protected override void ApplyCallback(bool p_wParms, CallbackType p_callbackType, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms) { switch (p_callbackType) { case CallbackType.OnPluginOverwritten: onPluginOverwritten = p_callback; onPluginOverwrittenWParms = p_callbackWParms; onPluginOverwrittenParms = p_callbackParms; break; default: base.ApplyCallback(p_wParms, p_callbackType, p_callback, p_callbackWParms, p_callbackParms); break; } }
private int CallbackType(CallbackType type) { if (type == Runtime.Events.CallbackType.PullBasedCallback) { return(0); } else if (type == Runtime.Events.CallbackType.PushBasedNotification) { return(1); } else { return(1); // default is push } }
/// <summary> /// Enable callbacks. If no parameter is provided, /// all callbacks are enabled by default. /// </summary> /// <param name="callbackType"></param> /// <returns></returns> public async Task EnableCallbackTypeAsync(CallbackType callbackType = CallbackType.Internal | CallbackType.ModeScript | CallbackType.Checkpoints) { if (callbackType.HasFlag(CallbackType.Internal)) { await EnableCallbacksAsync(true); } if (callbackType.HasFlag(CallbackType.ModeScript)) { await TriggerModeScriptEventArrayAsync("XmlRpc.EnableCallbacks", "true"); } if (callbackType.HasFlag(CallbackType.Checkpoints)) { await TriggerModeScriptEventArrayAsync("Trackmania.Event.SetCurLapCheckpointsMode", "always"); } }
//================================================================================================================ /// <summary> /// Enables a callback method to be invoked when a certain condition is met /// </summary> /// <param name="callback">The callback delegate</param> /// <param name="type">The callback type</param> /// <param name="numberOfSamples">The number of samples that will be passed to the callback method</param> //================================================================================================================ public void EnableCallback(InputScanCallbackDelegate callback, CallbackType callbackType, object callbackData) { Monitor.Enter(m_deviceLock); if (callbackType == CallbackType.OnDataAvailable) { if (m_driverInterface.OnDataAvailableCallbackControl != null) { DaqException dex = new DaqException(ErrorMessages.CallbackOperationAlreadyEnabled, ErrorCodes.CallbackOperationAlreadyEnabled); throw dex; } m_driverInterface.OnDataAvailableCallbackControl = new CallbackControl(this, callback, callbackType, callbackData); } else if (callbackType == CallbackType.OnInputScanComplete) { if (m_driverInterface.OnInputScanCompleteCallbackControl != null) { DaqException dex = new DaqException(ErrorMessages.CallbackOperationAlreadyEnabled, ErrorCodes.CallbackOperationAlreadyEnabled); throw dex; } m_driverInterface.OnInputScanCompleteCallbackControl = new CallbackControl(this, callback, callbackType, callbackData); } else if (callbackType == CallbackType.OnInputScanError) { if (m_driverInterface.OnInputScanErrorCallbackControl != null) { DaqException dex = new DaqException(ErrorMessages.CallbackOperationAlreadyEnabled, ErrorCodes.CallbackOperationAlreadyEnabled); throw dex; } m_driverInterface.OnInputScanErrorCallbackControl = new CallbackControl(this, callback, callbackType, callbackData); } //else if (callbackType == CallbackType.OnAcquisitionArmed) //{ // if (m_driverInterface.OnInputScanErrorCallbackControl != null) // { // DaqException dex = new DaqException(ErrorMessages.CallbackOperationAlreadyEnabled, ErrorCodes.CallbackOperationAlreadyEnabled); // throw dex; // } // m_driverInterface.OnAcquisitionArmedCallbackControl = new CallbackControl(this, callback, callbackType, callbackData); //} Monitor.Exit(m_deviceLock); }
internal static void SendCallback <T>(IJsonPluggableLibrary jsonPluggableLibrary, ChannelEntity channelEntity, List <object> itemMessage, CallbackType callbackType) { PubnubChannelCallback <T> channelCallbacks = channelEntity.ChannelParams.Callbacks as PubnubChannelCallback <T>; if (channelCallbacks != null) { SendCallbackBasedOnType <T> (jsonPluggableLibrary, channelCallbacks, itemMessage, callbackType); } #if (ENABLE_PUBNUB_LOGGING) else { LoggingMethod.WriteToLog(string.Format("DateTime {0}, SendCallbacks3: channelCallbacks null", DateTime.Now.ToString()), LoggingMethod.LevelInfo); } #endif }
/* * FUNCTION: SetFloatingLicenseCallback() * * PURPOSE: Sets the renew license callback function. * * Whenever the license lease is about to expire, a renew request is sent to the * server. When the request completes, the license callback function * gets invoked with one of the following status codes: * * LF_OK, LF_E_INET, LF_E_LICENSE_EXPIRED_INET, LF_E_LICENSE_NOT_FOUND, LF_E_CLIENT, LF_E_IP, * LF_E_SERVER, LF_E_TIME, LF_E_SERVER_LICENSE_NOT_ACTIVATED,LF_E_SERVER_TIME_MODIFIED, * LF_E_SERVER_LICENSE_SUSPENDED, LF_E_SERVER_LICENSE_EXPIRED, LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER * * PARAMETERS: * callback - name of the callback function * * RETURN CODES: LF_OK, LF_E_PRODUCT_ID */ public static int SetFloatingLicenseCallback(CallbackType callback) { var wrappedCallback = callback; var syncTarget = callback.Target as System.Windows.Forms.Control; if (syncTarget != null) { wrappedCallback = (v) => syncTarget.Invoke(callback, new object[] { v }); } callbackList.Add(wrappedCallback); #if LF_ANY_CPU return(IntPtr.Size == 8 ? Native.SetFloatingLicenseCallback_x64(wrappedCallback) : Native.SetFloatingLicenseCallback(wrappedCallback)); #else return(Native.SetFloatingLicenseCallback(wrappedCallback)); #endif }
public RegisterKeyNotificationCommand(string key, short updateCallbackid, short removeCallbackid, bool notifyOnItemExpiration, CallbackType callbackType = CallbackType.PushBasedNotification) { base.name = "RegisterKeyNotificationCommand"; base.key = key; _registerKeyNotifCommand = new Alachisoft.NCache.Common.Protobuf.RegisterKeyNotifCommand(); _registerKeyNotifCommand.key = key; _registerKeyNotifCommand.removeCallbackId = removeCallbackid; _registerKeyNotifCommand.updateCallbackId = updateCallbackid; _registerKeyNotifCommand.notifyOnExpiration = notifyOnItemExpiration; _registerKeyNotifCommand.callbackType = (int)callbackType; _registerKeyNotifCommand.requestId = base.RequestId; }
public static void Remove(CallbackType type, Action action) { if (action == null || Instance == null) { return; } if (type == CallbackType.UPDATE) { if (Instance.updateActions.Contains(action)) { Instance.updateActions.Remove(action); return; } } if (type == CallbackType.FIXED_UPDATE) { Instance.fixedUpdateActions.Remove(action); return; } if (type == CallbackType.LATE_UPDATE) { Instance.lateUpdateActions.Remove(action); return; } if (type == CallbackType.PERIODIC_UPDATE) { TimedUpdate RemovingAction = null; foreach (var periodicUpdateAction in Instance.periodicUpdateActions) { if (periodicUpdateAction.Action == action) { RemovingAction = periodicUpdateAction; } } if (RemovingAction != null) { RemovingAction.Pool(); Instance.periodicUpdateActions.Remove(RemovingAction); } return; } }
/// <summary> /// Sets server sync callback function. /// /// Whenever the server sync occurs in a separate thread, and server returns the response, /// license callback function gets invoked with the following status codes: /// LA_OK, LA_EXPIRED, LA_SUSPENDED, LA_E_REVOKED, LA_E_ACTIVATION_NOT_FOUND, /// LA_E_MACHINE_FINGERPRINT, LA_E_AUTHENTICATION_FAILED, LA_E_COUNTRY, LA_E_INET, /// LA_E_SERVER, LA_E_RATE_LIMIT, LA_E_IP /// </summary> /// <param name="callback"></param> public static void SetLicenseCallback(CallbackType callback) { var wrappedCallback = callback; #if NETFRAMEWORK var syncTarget = callback.Target as System.Windows.Forms.Control; if (syncTarget != null) { wrappedCallback = (v) => syncTarget.Invoke(callback, new object[] { v }); } #endif callbackList.Add(wrappedCallback); int status = IntPtr.Size == 4 ? LexActivatorNative.SetLicenseCallback_x86(wrappedCallback) : LexActivatorNative.SetLicenseCallback(wrappedCallback); if (LexStatusCodes.LA_OK != status) { throw new LexActivatorException(status); } }
/// <summary> /// Given a callback, try to turn it into a string /// </summary> public static string CallbackToString(CallbackType type, IntPtr data, int expectedsize) { if (!CallbackTypeFactory.All.TryGetValue(type, out var t)) { return($"[{type} not in sdk]"); } var strct = data.ToType(t); if (strct == null) { return("[null]"); } var str = ""; var fields = t.GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic); if (fields.Length == 0) { return("[no fields]"); } var columnSize = fields.Max(x => x.Name.Length) + 1; if (columnSize < 10) { columnSize = 10; } foreach (var field in fields) { var spaces = (columnSize - field.Name.Length); if (spaces < 0) { spaces = 0; } str += $"{new string(' ', spaces)}{field.Name}: {field.GetValue(strct)}\n"; } return(str.Trim('\n')); }
internal static void SendCallbacks <T>(IJsonPluggableLibrary jsonPluggableLibrary, RequestState <T> asynchRequestState, List <object> itemMessage, CallbackType callbackType, bool checkType) { if (asynchRequestState.ChannelEntities != null) { SendCallbacks <T> (jsonPluggableLibrary, asynchRequestState.ChannelEntities, itemMessage, callbackType, checkType); } else { #if (ENABLE_PUBNUB_LOGGING) LoggingMethod.WriteToLog(string.Format("DateTime {0}, SendCallbacks1: Callback type={1}", DateTime.Now.ToString(), callbackType.ToString()), LoggingMethod.LevelInfo); #endif if (callbackType.Equals(CallbackType.Success)) { GoToCallback <T> (itemMessage, asynchRequestState.SuccessCallback, jsonPluggableLibrary); } } }
//======================================================================================================== /// <summary> /// ctor - for use with setting up a callback for an input scan /// </summary> /// <param name="daqDevice">A DaqDevice object</param> /// <param name="numberOfSamples">The number of samples to pass to each callback </param> /// <param name="callback">A InputScanCallbackDelegate</param> //======================================================================================================== internal CallbackControl(DaqDevice daqDevice, InputScanCallbackDelegate callback, CallbackType type, object callbackData) { InitializeComponent(); m_daqDevice = daqDevice; if (type == CallbackType.OnDataAvailable) { try { m_numberOfSamples = (int)callbackData; } catch (Exception) { System.Diagnostics.Debug.Assert(false, "OnDataAvailable callback data is not the correct data type"); } } m_callback = callback; m_type = type; }
public void removeCallback(GameObject.Type typeA, GameObject.Type typeB, CallbackType callbackType) { switch (callbackType) { case CallbackType.BEGIN: callbacksBegin.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeA, typeB)); callbacksBegin.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeB, typeA)); break; case CallbackType.DURING: callbacksDuring.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeA, typeB)); callbacksDuring.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeB, typeA)); break; case CallbackType.END: callbacksEnd.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeA, typeB)); callbacksEnd.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeB, typeA)); break; } }
private void Update() { if (!_receivedCallback) { return; } switch (_expectedCallback) { case CallbackType.FinishMove: FinishMoveCallback(); break; case CallbackType.QuickMatch: QuickMatchCallback(); break; } _expectedCallback = CallbackType.None; _receivedCallback = false; }
private void AddCallbackInternal(CallbackType type, Action action) { if (type == CallbackType.UPDATE) { Instance.updateActions.Add(action); return; } if (type == CallbackType.FIXED_UPDATE) { Instance.fixedUpdateActions.Add(action); return; } if (type == CallbackType.LATE_UPDATE) { Instance.lateUpdateActions.Add(action); return; } }
internal static void SendCallbackBasedOnType <T>(IJsonPluggableLibrary jsonPluggableLibrary, PubnubChannelCallback <T> channelCallbacks, List <object> itemMessage, CallbackType callbackType) { if (callbackType.Equals(CallbackType.Connect)) { GoToCallback <T> (itemMessage, channelCallbacks.ConnectCallback, jsonPluggableLibrary); } else if (callbackType.Equals(CallbackType.Disconnect)) { GoToCallback <T> (itemMessage, channelCallbacks.DisconnectCallback, jsonPluggableLibrary); } else if (callbackType.Equals(CallbackType.Success)) { GoToCallback <T> (itemMessage, channelCallbacks.SuccessCallback, jsonPluggableLibrary); } else if (callbackType.Equals(CallbackType.Wildcard)) { GoToCallback <T> (itemMessage, channelCallbacks.WildcardPresenceCallback, jsonPluggableLibrary); } }
public CacheSyncManager(Cache cache, CacheRuntimeContext context) { _cache = cache; _context = context; if (_cache.Configuration != null && _cache.Configuration.SynchronizationStrategy != null) { this._callbackType = _cache.Configuration.SynchronizationStrategy.CallbackType; this._pollingInterval = _cache.Configuration.SynchronizationStrategy.Interval; } if (_context.InProc) { try { if (System.Configuration.ConfigurationManager.AppSettings["NCacheServer.TouchInterval"] != null) { _touchInterval = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["NCacheServer.TouchInterval"]); _touchInterval = _touchInterval * 1000; } } catch { _touchInterval = 5 * 1000; } if (_touchInterval < 1) { _touchInterval = 5 * 1000; } } else { _touchInterval = ServiceConfiguration.ItemTouchInterval * 1000; } _touchThread = new Thread(TouchThread); _touchThread.IsBackground = true; _touchThread.Name = "ItemTouchThread"; _touchThread.Start(); }
public RegexHandlerAttribute( string strRegex, CallbackType type, int clearTimeMs = -1, char[] clearChars = null, bool clearInputOnMatch = true ) { if (strRegex == null) { throw new ArgumentNullException("strRegex"); } _clearChars = clearChars ?? DEFAULT_WHITESPACE; _cbType = type; _regex = new Regex(strRegex); _clearOnMatch = clearInputOnMatch; clearTimeMs = clearTimeMs < 0 ? int.MaxValue : clearTimeMs; _clearTime = new TimeSpan(0, 0, 0, 0, clearTimeMs); }
public static void Remove(CallbackType type, Action action) { if (action == null || Instance == null) { return; } if (type == CallbackType.UPDATE) { if (Instance.updateActions.Contains(action)) { Instance.updateActions.Remove(action); return; } } if (type == CallbackType.FIXED_UPDATE) { if (Instance.fixedUpdateActions.Contains(action)) { Instance.fixedUpdateActions.Remove(action); return; } } if (type == CallbackType.LATE_UPDATE) { if (Instance.lateUpdateActions.Contains(action)) { Instance.lateUpdateActions.Remove(action); return; } } //var callbackCollection = instance.collections[type]; //instance.RemoveCallbackInternal(callbackCollection, action); }
private static IDCallback GetCallback(CallbackType type, WF_DEF_Node node) { if (node == null) { return(null); } IDCallback callback = null; switch ((NodeType)node.Type) { case NodeType.Start: switch (type) { case CallbackType.Callback4Approvers: callback = node.CB_Approvers.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Approvers.Value && !cb.IsDeleted) : null; break; case CallbackType.Callback4Input: callback = node.CB_Input.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Input.Value && !cb.IsDeleted) : null; break; case CallbackType.Callback4Output: callback = node.CB_Output.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Output.Value && !cb.IsDeleted) : null; break; case CallbackType.Callback4Notify: callback = node.CB_Notify.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Notify.Value && !cb.IsDeleted) : null; break; } break; case NodeType.Normal: switch (type) { case CallbackType.Callback4Approvers: callback = node.CB_Approvers.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Approvers.Value && !cb.IsDeleted) : null; break; case CallbackType.Callback4Input: callback = node.CB_Input.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Input.Value && !cb.IsDeleted) : null; break; case CallbackType.Callback4Output: callback = node.CB_Output.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Output.Value && !cb.IsDeleted) : null; break; case CallbackType.Callback4Notify: callback = node.CB_Notify.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Notify.Value && !cb.IsDeleted) : null; break; } break; case NodeType.Control: switch (type) { case CallbackType.Callback4Approvers: callback = null; break; case CallbackType.Callback4Input: callback = node.CB_Input.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Input.Value && !cb.IsDeleted) : null; break; case CallbackType.Callback4Output: callback = node.CB_Output.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Output.Value && !cb.IsDeleted) : null; break; case CallbackType.Callback4Notify: callback = null; break; } break; case NodeType.End: switch (type) { case CallbackType.Callback4Approvers: callback = null; break; case CallbackType.Callback4Input: callback = node.CB_Input.HasValue ? node.Callbacks.FirstOrDefault(cb => cb.ID == node.CB_Input.Value && !cb.IsDeleted) : null; break; case CallbackType.Callback4Output: callback = null; break; case CallbackType.Callback4Notify: callback = null; break; } break; } return(callback); }
static extern void DvServiceLinnCoUkProduct3EnableActionType(uint aHandle, CallbackType aCallback, IntPtr aPtr);
public static IUniTaskSource Create(Tween tween, TweenCancelBehaviour cancelBehaviour, CancellationToken cancellationToken, CallbackType callbackType, out short token) { if (cancellationToken.IsCancellationRequested) { DoCancelBeforeCreate(tween, cancelBehaviour); return(AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token)); } if (!pool.TryPop(out var result)) { result = new TweenConfiguredSource(); } result.tween = tween; result.cancelBehaviour = cancelBehaviour; result.cancellationToken = cancellationToken; result.callbackType = callbackType; result.originalUpdateAction = tween.onUpdate; result.canceled = false; if (result.originalUpdateAction == result.onUpdateDelegate) { result.originalUpdateAction = null; } tween.onUpdate = result.onUpdateDelegate; switch (callbackType) { case CallbackType.Kill: result.originalCompleteAction = tween.onKill; tween.onKill = result.onCompleteCallbackDelegate; break; case CallbackType.Complete: result.originalCompleteAction = tween.onComplete; tween.onComplete = result.onCompleteCallbackDelegate; break; case CallbackType.Pause: result.originalCompleteAction = tween.onPause; tween.onPause = result.onCompleteCallbackDelegate; break; case CallbackType.Play: result.originalCompleteAction = tween.onPlay; tween.onPlay = result.onCompleteCallbackDelegate; break; case CallbackType.Rewind: result.originalCompleteAction = tween.onRewind; tween.onRewind = result.onCompleteCallbackDelegate; break; case CallbackType.StepComplete: result.originalCompleteAction = tween.onStepComplete; tween.onStepComplete = result.onCompleteCallbackDelegate; break; default: break; } if (result.originalCompleteAction == result.onCompleteCallbackDelegate) { result.originalCompleteAction = null; } TaskTracker.TrackActiveTask(result, 3); token = result.core.Version; return(result); }
public static extern int SetFloatingLicenseCallback_x64(CallbackType callback);
/// <summary> /// Checks whether a new release is available for the product. /// /// This function should only be used if you manage your releases through /// Cryptlex release management API. /// </summary> /// <param name="platform">release platform e.g. windows, macos, linux</param> /// <param name="version">current release version</param> /// <param name="channel">release channel e.g. stable</param> /// <param name="callback">name of the callback function</param> public static void CheckForReleaseUpdate(string platform, string version, string channel, CallbackType callback) { var wrappedCallback = callback; #if NETFRAMEWORK var syncTarget = callback.Target as System.Windows.Forms.Control; if (syncTarget != null) { wrappedCallback = (v) => syncTarget.Invoke(callback, new object[] { v }); } #endif callbackList.Add(wrappedCallback); int status; if (LexActivatorNative.IsWindows()) { status = IntPtr.Size == 4 ? LexActivatorNative.CheckForReleaseUpdate_x86(platform, version, channel, wrappedCallback) : LexActivatorNative.CheckForReleaseUpdate(platform, version, channel, wrappedCallback); } else { status = LexActivatorNative.CheckForReleaseUpdateA(platform, version, channel, wrappedCallback); } if (LexStatusCodes.LA_OK != status) { throw new LexActivatorException(status); } }
/// <summary> /// Assigns the given callback to this Tweener/Sequence, /// overwriting any existing callbacks of the same type. /// </summary> /// <param name="p_callbackType">The type of callback to apply</param> /// <param name="p_callback">The function to call, who must return <c>void</c> and accept no parameters</param> public void ApplyCallback(CallbackType p_callbackType, TweenDelegate.TweenCallback p_callback) { ApplyCallback(false, p_callbackType, p_callback, null, null); }
public static void SafeAdd(CallbackType type, Action action) { instance.threadSafeAddQueue.Enqueue(new Tuple <CallbackType, Action>(type, action)); }
protected void ScanError(ErrorCodes errorCode, CallbackType callbackType, object callbackData) { Stop = true; statusLabel.Text = Device.GetErrorMessage(errorCode); }
public void CheckSetResetConnectionState(uint error, CallbackType callbackType) { if (this._fResetEventOwned) { if ((callbackType == CallbackType.Read) && (error == 0)) { this._parser._fResetConnection = false; this._fResetConnectionSent = false; this._fResetEventOwned = !this._parser._resetConnectionEvent.Set(); } if (error != 0) { this._fResetConnectionSent = false; this._fResetEventOwned = !this._parser._resetConnectionEvent.Set(); } } }
/// <summary> /// Assigns the given callback to this Tweener/Sequence, /// overwriting any existing callbacks of the same type. /// </summary> /// <param name="p_callbackType">The type of callback to apply</param> /// <param name="p_callback">The function to call. /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/></param> /// <param name="p_callbackParms">Additional comma separated parameters to pass to the function</param> public void ApplyCallback(CallbackType p_callbackType, TweenDelegate.TweenCallbackWParms p_callback, params object[] p_callbackParms) { ApplyCallback(true, p_callbackType, null, p_callback, p_callbackParms); }
protected void ScanComplete(ErrorCodes errorCode, CallbackType callbackType, object callbackData) { Stop = true; if (errorCode == ErrorCodes.NoErrors) statusLabel.Text = "Scan complete"; }
// if var type not specified, array of string args is assumed public void RegisterCallback(String cmdname, CallbackType func, String desc) { RegisterCallback(cmdname, func, typeof(string[]), desc); }
public void removeCallback(GameObject.Type typeA, GameObject.Type typeB, CallbackType callbackType) { switch (callbackType) { case CallbackType.BEGIN: callbacksBegin.Remove(new KeyValuePair<GameObject.Type, GameObject.Type>(typeA, typeB)); callbacksBegin.Remove(new KeyValuePair<GameObject.Type, GameObject.Type>(typeB, typeA)); break; case CallbackType.DURING: callbacksDuring.Remove(new KeyValuePair<GameObject.Type, GameObject.Type>(typeA, typeB)); callbacksDuring.Remove(new KeyValuePair<GameObject.Type, GameObject.Type>(typeB, typeA)); break; case CallbackType.END: callbacksEnd.Remove(new KeyValuePair<GameObject.Type, GameObject.Type>(typeA, typeB)); callbacksEnd.Remove(new KeyValuePair<GameObject.Type, GameObject.Type>(typeB, typeA)); break; } }
public void CheckSetResetConnectionState(UInt32 error, CallbackType callbackType) { // Should only be called for MARS - that is the only time we need to take // the ResetConnection lock! // It was raised in a security review by Microsoft questioning whether // we need to actually process the resulting packet (sp_reset ack or error) to know if the // reset actually succeeded. There was a concern that if the reset failed and we proceeded // there might be a security issue present. We have been assured by the server that if // sp_reset fails, they guarantee they will kill the resulting connection. So - it is // safe for us to simply receive the packet and then consume the pre-login later. Debug.Assert(_parser.MARSOn, "Should not be calling CheckSetResetConnectionState on non MARS connection"); if (_fResetEventOwned) { if (callbackType == CallbackType.Read && TdsEnums.SNI_SUCCESS == error) { // RESET SUCCEEDED! // If we are on read callback and no error occurred (and we own reset event) - // then we sent the sp_reset_connection and so we need to reset sp_reset_connection // flag to false, and then release the ResetEvent. _parser._fResetConnection = false; _fResetConnectionSent = false; _fResetEventOwned = !_parser._resetConnectionEvent.Set(); Debug.Assert(!_fResetEventOwned, "Invalid AutoResetEvent state!"); } if (TdsEnums.SNI_SUCCESS != error) { // RESET FAILED! // If write or read failed with reset, we need to clear event but not mark connection // as reset. _fResetConnectionSent = false; _fResetEventOwned = !_parser._resetConnectionEvent.Set(); Debug.Assert(!_fResetEventOwned, "Invalid AutoResetEvent state!"); } } }
static void OnNativeCallback(CallbackType type, IntPtr target, IntPtr param1, int param2, string param3) { const string typeNameKey = "SharpTypeName"; // while app is not started - accept only Log callbacks if (!isStarted && type != CallbackType.Log_Write) { return; } switch (type) { //Component: case CallbackType.Component_OnSceneSet: { var component = LookupObject <Component>(target, false); component?.OnSceneSet(LookupObject <Scene>(param1, false)); } break; case CallbackType.Component_SaveXml: { var component = LookupObject <Component>(target, false); if (component != null && component.TypeName != component.GetType().Name) { var xmlElement = new XmlElement(param1); xmlElement.SetString(typeNameKey, component.GetType().AssemblyQualifiedName); component.OnSerialize(new XmlComponentSerializer(xmlElement)); } } break; case CallbackType.Component_LoadXml: { var xmlElement = new XmlElement(param1); var name = xmlElement.GetAttribute(typeNameKey); if (!string.IsNullOrEmpty(name)) { Component component; try { var typeObj = Type.GetType(name); if (typeObj == null) { Log.Write(LogLevel.Warning, $"{name} doesn't exist. Probably was removed by Linker. Add it to a some LinkerPleaseInclude.cs in case if you need it."); return; } component = (Component)Activator.CreateInstance(typeObj, target); } catch (Exception exc) { throw new InvalidOperationException($"{name} doesn't override constructor Component(IntPtr handle).", exc); } component.OnDeserialize(new XmlComponentSerializer(xmlElement)); if (component.Node != null) { component.AttachedToNode(component.Node); } } } break; case CallbackType.Component_AttachedToNode: { var component = LookupObject <Component>(target, false); component?.AttachedToNode(component.Node); } break; case CallbackType.Component_OnNodeSetEnabled: { var component = LookupObject <Component>(target, false); component?.OnNodeSetEnabled(); } break; //RefCounted: case CallbackType.RefCounted_AddRef: { //if we have an object with this handle and it's reference is weak - then change it to strong. var referenceHolder = RefCountedCache.Get(target); referenceHolder?.MakeStrong(); } break; case CallbackType.RefCounted_Delete: { var referenceHolder = RefCountedCache.Get(target); if (referenceHolder == null) { return; //we don't have this object in the cache so let's just skip it } var reference = referenceHolder.Reference; if (reference == null) { // seems like the reference was Weak and GC has removed it - remove item from the dictionary RefCountedCache.Remove(target); } else { reference.HandleNativeDelete(); } } break; case CallbackType.Log_Write: Urho.Application.ThrowUnhandledException( new Exception(param3 + ". You can omit this exception by subscribing to Urho.Application.UnhandledException event and set Handled property to True.\nApplicationOptions: " + Application.CurrentOptions)); break; } }
private ErrorCode HandleCallback(IntPtr systemraw, CallbackType type, IntPtr commanddata1, IntPtr commanddata2) { return ErrorCode.OK; }
public CallbackInfo(string client, object callback, bool notifyOnItemExpiration, CallbackType callbackType = CallbackType.PushBasedNotification) : this(client, callback, EventDataFilter.None, notifyOnItemExpiration, callbackType) { }
public static void Add(CallbackType type, Action action) { instance.AddCallbackInternal(type, action); }
public CallbackInfo(string client, object callback, EventDataFilter datafilter, bool notifyOnItemExpiration, CallbackType callbackType = CallbackType.PushBasedNotification) { this.theClient = client; this.theCallback = callback; this.notifyOnItemExpiration = notifyOnItemExpiration; this._dataFilter = datafilter; this._callbackType = callbackType; }
public BulkInsertCommand(string[] keys, CacheItem[] items, short onDataSourceItemUpdateCallbackId, Cache parent, string providerName, bool encryption, string cacheId, int methodOverload, string clientId, short updateCallbackId, short removeCallbackId, EventDataFilter updateCallbackDataFilter, EventDataFilter removeCallbackDataFilter, CallbackType callbackType = Runtime.Events.CallbackType.PushBasedNotification) { base.name = "BulkInsertCommand"; _parent = parent; base.BulkKeys = keys; _bulkInsertCommand = new Common.Protobuf.BulkInsertCommand(); _bulkInsertCommand.datasourceUpdatedCallbackId = onDataSourceItemUpdateCallbackId; _bulkInsertCommand.providerName = providerName; _bulkInsertCommand.requestId = base.RequestId; _methodOverload = methodOverload; short initialUpdateCallbackId = updateCallbackId; short initialRemoveCallBackId = removeCallbackId; for (int i = 0; i < keys.Length; i++) { CacheItem item = items[i]; _insertCommand = new Common.Protobuf.InsertCommand(); _insertCommand.key = keys[i]; UserBinaryObject ubObject = UserBinaryObject.CreateUserBinaryObject((byte[])item.GetValue <object>()); _insertCommand.data.AddRange(ubObject.DataList); DateTime absExpiration = default(DateTime); if (item.Expiration.Absolute != Cache.NoAbsoluteExpiration) { absExpiration = item.Expiration.Absolute.ToUniversalTime(); } if (absExpiration.Equals(Cache.DefaultAbsolute.ToUniversalTime())) { _insertCommand.absExpiration = 1; } else if (absExpiration.Equals(Cache.DefaultAbsoluteLonger.ToUniversalTime())) { _insertCommand.absExpiration = 2; } else if (absExpiration != Cache.NoAbsoluteExpiration) { _insertCommand.absExpiration = absExpiration.Ticks; } if (item.SlidingExpiration.Equals(Cache.DefaultSliding)) { _insertCommand.sldExpiration = 1; } else if (item.SlidingExpiration.Equals(Cache.DefaultSlidingLonger)) { _insertCommand.sldExpiration = 2; } else if (item.SlidingExpiration != Cache.NoSlidingExpiration) { _insertCommand.sldExpiration = item.SlidingExpiration.Ticks; } _insertCommand.flag = item.FlagMap.Data; _insertCommand.priority = (int)item.Priority; //_insertCommand.dependency = item.Dependency == null ? null : Common.Util.DependencyHelper.GetProtoBufDependency(item.Dependency); // Client ID: Must not have value except ClientCache. _insertCommand.clientID = clientId; _insertCommand.CallbackType = CallbackType(callbackType); EventDataFilter itemUpdateDataFilter = updateCallbackDataFilter; EventDataFilter itemRemovedDataFilter = removeCallbackDataFilter; if (removeCallbackId <= 0) { if (item.CacheItemRemovedCallback != null) { itemRemovedDataFilter = item.ItemRemovedDataFilter; short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemRemovedCallback, EventTypeInternal.ItemRemoved, itemRemovedDataFilter, callbackType); removeCallbackId = callabackIds[1]; } else if (item.ItemRemoveCallback != null) { removeCallbackId = _parent.GetCallbackId(item.ItemRemoveCallback); itemRemovedDataFilter = EventDataFilter.None; } } if (updateCallbackId <= 0) { if (item.CacheItemUpdatedCallback != null) { itemUpdateDataFilter = item.ItemUpdatedDataFilter; short[] callabackIds = _parent.EventManager.RegisterSelectiveEvent(item.CacheItemUpdatedCallback, EventTypeInternal.ItemUpdated, itemUpdateDataFilter, callbackType); updateCallbackId = callabackIds[0]; } else if (item.ItemUpdateCallback != null) { updateCallbackId = _parent.GetCallbackId(item.ItemUpdateCallback); itemUpdateDataFilter = EventDataFilter.None; } } _insertCommand.removeCallbackId = removeCallbackId; _insertCommand.updateCallbackId = updateCallbackId; _insertCommand.updateDataFilter = (short)itemUpdateDataFilter; _insertCommand.removeDataFilter = (short)itemRemovedDataFilter; _bulkInsertCommand.insertCommand.Add(_insertCommand); updateCallbackId = initialUpdateCallbackId; removeCallbackId = initialRemoveCallBackId; } }
protected void ReadScanData(ErrorCodes errorCode, CallbackType callbackType, object callbackData) { }
public void EnableCallback(InputScanCallbackDelegate callback, CallbackType callbackType, object callbackData, bool executeOnUIThread) { Monitor.Enter(m_deviceLock); if (callbackType == CallbackType.OnDataAvailable) { if (m_driverInterface.OnDataAvailableCallbackControl != null) { DaqException dex = new DaqException(ErrorMessages.CallbackOperationAlreadyEnabled, ErrorCodes.CallbackOperationAlreadyEnabled); throw dex; } m_driverInterface.OnDataAvailableCallbackControl = new CallbackControl(this, callback, callbackType, callbackData, executeOnUIThread); } else if (callbackType == CallbackType.OnInputScanComplete) { if (m_driverInterface.OnInputScanCompleteCallbackControl != null) { DaqException dex = new DaqException(ErrorMessages.CallbackOperationAlreadyEnabled, ErrorCodes.CallbackOperationAlreadyEnabled); throw dex; } m_driverInterface.OnInputScanCompleteCallbackControl = new CallbackControl(this, callback, callbackType, callbackData, executeOnUIThread); } else if (callbackType == CallbackType.OnInputScanError) { if (m_driverInterface.OnInputScanErrorCallbackControl != null) { DaqException dex = new DaqException(ErrorMessages.CallbackOperationAlreadyEnabled, ErrorCodes.CallbackOperationAlreadyEnabled); throw dex; } m_driverInterface.OnInputScanErrorCallbackControl = new CallbackControl(this, callback, callbackType, callbackData, executeOnUIThread); } Monitor.Exit(m_deviceLock); }
/// <summary> /// Assigns the given callback to this Tweener/Sequence, /// overwriting any existing callbacks of the same type. /// This overload will use sendMessage to call the method named p_methodName /// on every MonoBehaviour in the p_sendMessageTarget GameObject. /// </summary> /// <param name="p_callbackType">The type of callback to apply</param> /// <param name="p_sendMessageTarget">GameObject to target for sendMessage</param> /// <param name="p_methodName">Name of the method to call</param> /// <param name="p_value">Eventual additional parameter</param> /// <param name="p_options">SendMessageOptions</param> public void ApplyCallback(CallbackType p_callbackType, GameObject p_sendMessageTarget, string p_methodName, object p_value, SendMessageOptions p_options = SendMessageOptions.RequireReceiver) { TweenDelegate.TweenCallbackWParms cb = HOTween.DoSendMessage; object[] cbParms = new[] { p_sendMessageTarget, p_methodName, p_value, p_options }; ApplyCallback(true, p_callbackType, null, cb, cbParms); }
public CallbackInfo(string client, object callback, CallbackType callbackType = CallbackType.PushBasedNotification) : this(client, callback, true, callbackType) { }
public static extern IntPtr CallbackDelegateTest(CallbackType callback, int param1);
public CallbackInfo(string client, object callback, EventDataFilter datafilter, CallbackType callbackType = CallbackType.PushBasedNotification) : this(client, callback, datafilter, true, callbackType) { }
public RawTempoCallbackMessage(CallbackType callbackType, float t, RawTempo tempo) : base(t) { _tempo = tempo; _callback = callbackType; }
/// <summary> /// Assigns the given callback to this Tweener/Sequence, /// overwriting any existing callbacks of the same type. /// </summary> protected virtual void ApplyCallback(bool p_wParms, CallbackType p_callbackType, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms) { switch (p_callbackType) { case CallbackType.OnStart: onStart = p_callback; onStartWParms = p_callbackWParms; onStartParms = p_callbackParms; break; case CallbackType.OnUpdate: onUpdate = p_callback; onUpdateWParms = p_callbackWParms; onUpdateParms = p_callbackParms; break; case CallbackType.OnStepComplete: onStepComplete = p_callback; onStepCompleteWParms = p_callbackWParms; onStepCompleteParms = p_callbackParms; break; case CallbackType.OnComplete: onComplete = p_callback; onCompleteWParms = p_callbackWParms; onCompleteParms = p_callbackParms; break; case CallbackType.OnPlay: onPlay = p_callback; onPlayWParms = p_callbackWParms; onPlayParms = p_callbackParms; break; case CallbackType.OnPause: onPause = p_callback; onPauseWParms = p_callbackWParms; onPauseParms = p_callbackParms; break; case CallbackType.OnRewinded: onRewinded = p_callback; onRewindedWParms = p_callbackWParms; onRewindedParms = p_callbackParms; break; case CallbackType.OnPluginOverwritten: TweenWarning.Log("ApplyCallback > OnPluginOverwritten type is available only with Tweeners and not with Sequences"); break; } }
public RawNoteCallbackMessage(CallbackType callbackType, float t, RawNote note) : base(t) { _note = note; _callback = callbackType; }
/// <summary> /// 输出弹出窗口需要的json数据; /// </summary> /// <param name="status">状态</param> /// <param name="message">提示信息</param> /// <param name="navTabId">刷新的选项卡标识(选项卡ID)</param> /// <param name="rel"></param> /// <param name="callbackType">返回类型(200=成功、300=操作失败、301=会话超时)</param> /// <param name="forwardUrl">重定向路径</param> /// <returns></returns> protected void OutPutDialogString(ResponseStatus statusCode, string message, string navTabId, string rel, CallbackType callbackType, string forwardUrl) { //string statusStr = statusCode.ToString(); int statusInt = (int)statusCode;//获取枚举值 string json = "{"; json += "\"statusCode\":\"" + statusInt + "\"" + ","; json += "\"message\":\"" + message + "\"" + ","; json += "\"navTabId\":\"" + navTabId + "\"" + ","; json += "\"rel\":\"" + rel + "\"" + ","; json += "\"callbackType\":\"" + callbackType + "\"" + ","; json += "\"forwardUrl\":\"" + forwardUrl + "\""; json += "}"; this.Context.Response.Write(json); }
/// <summary> /// Constructs a Callback message. /// </summary> /// <param name="callback">The callback to invoke when this message is "sent".</param> /// <param name="time">The timestamp for this message.</param> public CallbackMessage(CallbackType callback, float time) : base(time) { this.callback = callback; }