private SpoolerResult SendRPCToSpooler(AsyncCallback callback, object state, CallBackType callbacktype, bool always_send, string function_name, params object[] options) { if (!HasLock && !always_send) { if (callback != null) { var ar = (IAsyncCallResult) new SimpleAsyncCallResult(state, CommandResult.Failed_PrinterDoesNotHaveLock); callback(ar); } return(SpoolerResult.Fail_DoesNotHaveLock); } AsyncCallObject newWaitingObject = CreateNewWaitingObject(callback, state, LockStepMode && !always_send); if (newWaitingObject == null) { callback?.Invoke(new AsyncCallObject(callback, state, (IPrinter)this) { callresult = CommandResult.Failed_PreviousCommandNotCompleted }); return(SpoolerResult.Fail_PreviousCommandNotComplete); } newWaitingObject.callbackType = callbacktype; return(SendRPCToSpooler(function_name, newWaitingObject.callID, options)); }
public void HandleOnAdFailedToLoad(object sender, AdFailedToLoadEventArgs args) { MonoBehaviour.print("HandleFailedToReceiveAd event received with message: " + args.Message); msg = args.Message; m_CallBackType = CallBackType.FailedToLoad; }
public AsyncCallObject(AsyncCallback callback, object state, IPrinter printer) { this.callback = callback; this.state = state; callbackType = CallBackType.CallID; callID = GetNextCallID(printer.Info.synchronization.LastCompletedRPCID); }
public CallBackMessage(SerializationInfo info, StreamingContext context) : base(info, context) { this.Args = info.GetValue("Args", typeof(List <string>)) as List <string>; this.SuccessFlag = (bool)info.GetValue("SuccessFlag", typeof(bool)); this.CallBackId = (int)info.GetValue("CallBackId", typeof(int)); this.CallBackType = (CallBackType)info.GetValue("CallBackType", typeof(CallBackType)); }
/// <summary> /// Calls by either the UserEnter() or UserLeave() <see cref="IChatCallback">IChatCallback</see> /// method implementations, and simply raises the OnProxyCallBackEvent() event /// to any subscribers /// </summary> /// <param name="sender">The <see cref="Common.Person">current chatter</see></param> /// <param name="message">The message</param> /// <param name="callbackType">Could be <see cref="CallBackType">CallBackType.UserEnter</see> or /// <see cref="CallBackType">CallBackType.UserLeave</see></param> private void UserEnterLeave(Person person, CallBackType callbackType) { ProxyCallBackEventArgs e = new ProxyCallBackEventArgs(); e.person = person; e.callbackType = callbackType; OnProxyCallBackEvent(e); }
/// <summary> /// 添加委托 /// </summary> /// <param UIName="type"></param> /// <param UIName="handler"></param> public static void AddListener(CallBackType type, CallBackEvent handler) { if (!DicMessages.ContainsKey(type)) { DicMessages.Add(type, null); } DicMessages[type] += handler; }
/// <summary> /// Calls by either the Receive() or ReceiveWhisper() <see cref="IChatCallback">IChatCallback</see> /// method implementations, and simply raises the OnProxyCallBackEvent() event /// to any subscribers /// </summary> /// <param name="sender">The <see cref="Common.Person">current chatter</see></param> /// <param name="message">The message</param> /// <param name="callbackType">Could be <see cref="CallBackType">CallBackType.Receive</see> or /// <see cref="CallBackType">CallBackType.ReceiveWhisper</see></param> private void Receive(Person sender, string message, CallBackType callbackType) { ProxyCallBackEventArgs e = new ProxyCallBackEventArgs(); e.message = message; e.callbackType = callbackType; e.person = sender; OnProxyCallBackEvent(e); }
/// <summary> /// This represent her time taking method /// </summary> /// <param name="callBackType">A callback method is pass via this delegate type</param> public void HerTimeTakingMethod(CallBackType callBackType) { //Assign the passed delegate to the instance varialbe, //so it can be called after the completion of the time taking task this._callBackType = callBackType; Console.WriteLine("She's starting the time taking task."); //A timer is used to demonstrate the time taking task _timer.Start(); }
public RequestHandle(HTTPRequest request, string message, CallBackType callback, bool background = false) { _request = request; _status = message; _callback = callback; _done = false; _background = background; successCallback = null; dataCallback = null; }
private void Receive(User sender, Message message, CallBackType callbackType) { ProxyCallBackEventArgs e = new ProxyCallBackEventArgs { ProxyMessage = message, ProxyCallbackType = callbackType, ProxyUser = sender }; OnProxyCallBackEvent(e); }
protected override void GenerateInvokeInfo() { MethodInfo methodInfo = Context.TypeInvoker.GetMethod(Function); if (null == methodInfo) { throw new TestflowRuntimeException(ModuleErrorCode.RuntimeError, Context.I18N.GetFStr("LoadFunctionFailed", Function.MethodName)); } //判断同步异步 callBackType = methodInfo.GetCustomAttribute <CallBackAttribute>().CallBackType; }
/** * Returns the following string excluding the CallBackType string from the resulting callback string. */ public static string FindStringFromCallBackType(string data, CallBackType type) { int length = definedString[type].Length; if (data.Substring(0, length).Equals(definedString[type])) { return(data.Substring(length)); } else { return(""); } }
public void MyMethod() { //Create a delegate variable from the above declared type //Assinging the callback method with the same signature of the type, in to that variable CallBackType callBackType = this.CallBackMethodInMyClass; //Create an object of HerClass HerClass herClass = new HerClass(); Console.WriteLine("MyMethod is calling HerTimeTakingMethod..."); //Calling her time taking method //CallBackMethodInMyClass method is passed via a delegate. herClass.HerTimeTakingMethod(callBackType); }
private void UserEnterLeave(User user, CallBackType callbackType) { if (user.Name == User.AutoExporterServiceName) { IsConnected = false; } ProxyCallBackEventArgs e = new ProxyCallBackEventArgs { ProxyUser = user, ProxyCallbackType = callbackType }; OnProxyCallBackEvent(e); }
/// <summary> /// 删除子项 /// </summary> /// <param name="Item"></param> protected void DeleteWidth(SpaceListViewItem Item, CallBackType callBackType) { try { if (this.OperationCallBack != null) { this.OperationCallBack(Item, callBackType); } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
private void Operation_CallBack(SpaceListViewItem Item, CallBackType callBackType) { try { switch (callBackType) { case CallBackType.OpenItem: this.book_OpenFileEvent(Item, this.LoadFolderCenter); break; case CallBackType.One_Selected: this.NavicateListView3.IsEnabled = true; break; case CallBackType.All_Selected: this.checkAll.IsChecked = true; break; case CallBackType.One_UnSelected: this.checkAll.IsChecked = false; break; case CallBackType.All_UnSelected: this.NavicateListView3.IsEnabled = false; break; case CallBackType.Delete: this.Resource_Delete(Item, this.ShowTip, this.LoadFolderCenter); break; default: break; } } catch (Exception ex) { LogManage.WriteLog(typeof(App), ex); } finally { } }
/// <summary> /// 调用委托 并删除引用 /// </summary> /// <param UIName="type"></param> /// <param UIName="args"></param> public static void CallListener(CallBackType type, params object[] args) { CallBackEvent del; //委托 if (DicMessages.TryGetValue(type, out del)) { if (del != null) { Delegate[] delete = del.GetInvocationList(); if (delete.Length > 0) { CallBackEvent callBack = delete[0] as CallBackEvent; if (callBack != null) { callBack(args); // ReSharper disable once DelegateSubtraction DicMessages[type] -= callBack; } } } } }
public CallBackEvent(Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue> function, double delay, CallBackType type) : this() { this.Function = function; this.Delay = (int)delay; this.Type = type; }
// 被UserEnter()以及UserLeave()调用, // 根据callbackType参数的值来封装消息,并触发ProxyCallBackEvent事件 private void UserEnterLeave(Person person, CallBackType callbackType) { ProxyCallBackEventArgs e = new ProxyCallBackEventArgs(); e.person = person; e.callbackType = callbackType; OnProxyCallBackEvent(e); }
public CallBackEvent(string source) : this() { this.Source = source; this.Type = CallBackType.ScriptExecution; }
public CallBackEvent(CallBackType callBackType) : this() { this.Type = callBackType; }
// 根据callbacktype参数的值来封装消息,并触发ProxyCallBackEvent事件 private void Receive(Person sender, string message, CallBackType callbackType) { ProxyCallBackEventArgs e = new ProxyCallBackEventArgs(); e.message = message; e.callbackType = callbackType; e.person = sender; OnProxyCallBackEvent(e); }
static StateMachine create(string initial, List <EventDesc> events, Dictionary <string, Callback> callbacks) { StateMachine fsm = new StateMachine(); fsm.transitionerObj = new Transitioner(); fsm.current = initial; fsm.transitions = new Dictionary <eKey, string>(); fsm.callbacks = new Dictionary <cKey, Callback>(); var allEvents = new Dictionary <string, bool>(); var allStates = new Dictionary <string, bool>(); foreach (var e in events) { foreach (var s in e.src) { fsm.transitions[new eKey(e.name, s)] = e.dst; allStates[s] = true; allStates[e.dst] = true; } allEvents[e.name] = true; } // Map all callbacks to events/states. foreach (var cb in callbacks) { var name = cb.Key; string target = ""; CallBackType callbackType = CallBackType.callbackNone; if (name.StartsWith("before_")) { target = name.TrimStart("before_".ToCharArray()); if (target == "event") { target = ""; callbackType = CallBackType.callbackBeforeEvent; } else { bool ok = false; if (allEvents.TryGetValue(target, out ok)) { callbackType = CallBackType.callbackBeforeEvent; } } } else if (name.StartsWith("leave_")) { target = name.TrimStart("leave_".ToCharArray()); if (target == "state") { target = ""; callbackType = CallBackType.callbackLeaveState; } else { bool ok = false; if (allStates.TryGetValue(target, out ok)) { callbackType = CallBackType.callbackLeaveState; } } } else if (name.StartsWith("enter_")) { target = name.TrimStart("enter_".ToCharArray()); if (target == "state") { target = ""; callbackType = CallBackType.callbackEnterState; } else { bool ok = false; if (allStates.TryGetValue(target, out ok)) { callbackType = CallBackType.callbackEnterState; } } } else if (name.StartsWith("after_")) { target = name.TrimStart("after_".ToCharArray()); if (target == "event") { target = ""; callbackType = CallBackType.callbackAfterEvent; } else { bool ok = false; if (allEvents.TryGetValue(target, out ok)) { callbackType = CallBackType.callbackAfterEvent; } } } else { target = name; bool ok = false; if (allStates.TryGetValue(target, out ok)) { callbackType = CallBackType.callbackEnterState; } if (allEvents.TryGetValue(target, out ok)) { callbackType = CallBackType.callbackAfterEvent; } } if (callbackType != CallBackType.callbackNone) { fsm.callbacks[new cKey(target, callbackType)] = cb.Value; } } return(fsm); }
/// <summary> /// 选择器控制中心 /// </summary> /// <param name="Item"></param> /// <param name="callBackType"></param> protected void ItemsSelectedEventCallBack(NavicateListView listView, SpaceListViewItem Item, CallBackType callBackType) { try { if (!listView.Items.Contains(Item)) { return; } switch (callBackType) { case CallBackType.OpenItem: this.OpenItemWith(Item, callBackType); break; case CallBackType.One_Selected: this.SelectedDealWith(Item); break; case CallBackType.One_UnSelected: this.UnselectedDealWith(Item); break; case CallBackType.KeDown: this.KedownDealWidth(Item); break; case CallBackType.Share: this.ShareDealWidth(Item); break; case CallBackType.Download: this.DownloadWidth(Item); break; case CallBackType.Delete: this.DeleteWidth(Item, callBackType); break; case CallBackType.ReName: this.ReNameWidth(Item); break; default: break; } } catch (Exception ex) { LogManage.WriteLog(this.GetType(), ex); } finally { } }
/// <summary> /// 获得要返回的json提示格式 /// </summary> /// <param name="status">返回状态</param> /// <param name="message">提示信息</param> /// <param name="navTabID">要重新加载的tabID</param> /// <param name="rel">要替换的标签rel属性</param> /// <param name="callBackType">回调函数</param> /// <param name="forwardURL">要跳转的url</param> /// <returns></returns> public static string ReturnAlertMessage(ActionReturnStatus status, string message, string navTabID, string rel, CallBackType callBackType, string forwardURL) { StringBuilder messageStr = new StringBuilder(); messageStr.Append("{"); messageStr.Append("\"statusCode\":").Append("\"").Append(GetStatusCode(status)).Append("\","); messageStr.Append("\"message\":").Append("\"").Append(message).Append("\","); messageStr.Append("\"navTabId\":").Append("\"").Append(navTabID).Append("\","); messageStr.Append("\"rel\":").Append("\"").Append(rel).Append("\","); messageStr.Append("\"callbackType\":").Append("\"").Append(callBackType.ToString() == "none" ? "" : callBackType.ToString()).Append("\","); messageStr.Append("\"forwardUrl\":").Append("\"").Append(forwardURL).Append("\""); messageStr.Append("}"); return messageStr.ToString(); }
/// <summary> /// 回调类型 /// </summary> public CallBackAttribute(CallBackType callBackType) { this.CallBackType = callBackType; }
public cKey(string target, CallBackType callbackType) { this.target = target; this.callbackType = callbackType; }
public CallBackEvent(Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue> callBackFunction, List <JsValue> parameters) : this() { this.Type = CallBackType.UserCallback; this.Function = callBackFunction; this.Parameters = parameters; }
void processTouches(PointerState pointerStat, int tempTouchId, PointerEventData touchCountData, CallBackType cbType) { if (pointerStat == PointerState.DOWN) { //Check If PointerId exist, if it doesn't add to list if (touchID.Contains(tempTouchId)) { //eventData.eventData return; //Exit if PointerId exist } //PointerId does not exist, add it to the list then increment touchCount touchID.Add(tempTouchId); touchCount++; } if (pointerStat == PointerState.UP) { //Check If PointerId exist, if it exist remove it from list then decrement touchCount if (touchID.Contains(tempTouchId)) { touchID.Remove(tempTouchId); touchCount--; return; } } }
public void HandleOnAdClosed(object sender, System.EventArgs args) { MonoBehaviour.print("HandleAdClosed event received"); m_CallBackType = CallBackType.AdClosed; }
public void HandleOnAdLeavingApplication(object sender, System.EventArgs args) { MonoBehaviour.print("HandleAdLeavingApplication event received"); m_CallBackType = CallBackType.AdLeavingApplication; }
public static void CallWFAppOperationsFromACallback(WorkflowApplication workflowApplication, CallBackType callbackType = CallBackType.Idle) { Type exceptionType = typeof(InvalidOperationException); string exceptionMessage = ExceptionStrings.CannotPerformOperationFromHandlerThread; RuntimeHelper.CallAndValidateAllMethods(workflowApplication, exceptionType, new List <string>() { "End", "Abort", "Load", "BeginLoad", "LoadRunnableInstance", "BeginLoadRunnableInstance", "AddInitialInstanceValues" }, exceptionMessage); exceptionMessage = string.Format(ExceptionStrings.WorkflowInstanceIsReadOnly, workflowApplication.Id); RuntimeHelper.CallAndValidateMethods(workflowApplication, exceptionType, new List <string>() { "AddInitialInstanceValues", "LoadRunnableInstance", "BeginLoadRunnableInstance" }, exceptionMessage); if (callbackType == CallBackType.Aborted) { exceptionType = typeof(WorkflowApplicationAbortedException); exceptionMessage = string.Format(ExceptionStrings.WorkflowApplicationAborted, workflowApplication.Id); } RuntimeHelper.CallAndValidateMethods(workflowApplication, exceptionType, new List <string>() { "Load", "BeginLoad" }, exceptionMessage); }
public void EndqueueCallBackExecution(Func <Jint.Native.JsValue, Jint.Native.JsValue[], Jint.Native.JsValue> function, double delay, CallBackType type) { lock (obj) { this._queue.Add(new CallBackEvent(function, delay, type)); } }