public override void OnClick() { string param = this.m_Param.Param; if (param != null) { Client.Action action = this.m_Action; if (action == null) { Gump parent = base.m_Parent; while ((parent != null) && !(parent is GMacroEditorPanel)) { parent = parent.Parent; } if (parent is GMacroEditorPanel) { Macro macro = ((GMacroEditorPanel)parent).Macro; macro.AddAction(new Client.Action(string.Format("{0} {1}", this.m_Handler.Action, param))); ((GMacroEditorForm)parent.Parent.Parent).Current = macro; } } else { action.Param = param; GMenuItem item = this; while (item.Parent is GMenuItem) { item = (GMenuItem)item.Parent; } item.Text = this.m_Param.Name; } } }
public GParamMenu(ParamNode param, ActionHandler handler, Client.Action action) : base(param.Name) { this.m_Param = param; this.m_Handler = handler; this.m_Action = action; if (this.m_Action == null) { base.Tooltip = new Tooltip(string.Format("Click here to add the instruction:\n{0} {1}", handler.Name, param.Name), true); } else { base.Tooltip = new Tooltip("Click here to change the parameter", true); } base.Tooltip.Delay = 3f; }
public GParamMenu(ParamNode param, ActionHandler handler, Client.Action action) : base(param.Name) { this.m_Param = param; this.m_Handler = handler; this.m_Action = action; if (this.m_Action == null) { base.Tooltip = new Tooltip(string.Format("Click here to add the instruction:\n{0} {1}", handler.Name, param.Name), true); } else { base.Tooltip = new Tooltip("Click here to change the parameter", true); } base.Tooltip.Delay = 3f; }
internal void InvokeAsync(object[] parameters, Client.Action <object> returnTResultAsync) { _callback.BeginInvoke(parameters, (ar) => { Client.Func <object[], object> method = (Client.Func <object[], object>)ar.AsyncState; //委托执行的异常会在EndInvoke时抛出来 try { var result = method.EndInvoke(ar); Log.Debug($"执行 EndInvoke 后 IAsyncResult.Completed={ar.IsCompleted}"); // 方法执行完成后执行指定的异步方法 if (!ar.IsCompleted) { throw new OverflowException($"IAsyncResult Is Not Completed"); } returnTResultAsync?.BeginInvoke(result, null, null); } catch (OverflowException oe) { Log.Error($"{nameof(InvocationHandler)} 执行 EndInvoke 出错", oe); throw oe; } }, _callback); }
public InvocationRequestCallBack(DateTime expireTime, Client.Action <TResult, Exception> callBack, Type returnType) { this.ExpireTime = expireTime; this.Invoke = callBack; this.ReturnType = returnType; }
public InvocationMessageHandler(Dictionary <string, InvocationHandlerList> handlers, Client.Action <object> returnHandler) { _handlers = handlers; _returnHandler = returnHandler; }