/// <summary> /// 取消接收任务 /// </summary> /// <param name="packageId">包编号</param> /// <param name="index">索引</param> public void CancelReceiveTask(ulong packageId, int index) { FileTaskInfo task = ReceiveTask.Find(s => s.PackageID == packageId); if (task == null || task.CancelPadding) { return; } Action <FileTaskItem> itemMarker = s => { if (s.State == FileTaskItemState.Canceled || s.State == FileTaskItemState.Failure || s.State == FileTaskItemState.Finished) { return; } MarkReceiveTaskItemState(s, FileTaskItemState.Canceling); }; if (index == -1) { //全部取消 activeReceiveItems.Where(s => s.TaskInfo == task).ToList().ForEach(itemMarker); task.TaskList.ForEach(itemMarker); } else if (index < task.TaskList.Count) { itemMarker(task.TaskList[index]); } task.CancelPadding = true; }
protected internal override BaseElement ConvertXMLToElement(XMLStreamReader xtr, BpmnModel model) { ReceiveTask receiveTask = new ReceiveTask(); BpmnXMLUtil.AddXMLLocation(receiveTask, xtr); ParseChildElements(XMLElementName, receiveTask, model, xtr); return(receiveTask); }
public virtual ReceiveTask CreateReceiveTask() { var task = new ReceiveTask(); //task.Tag = new ReceiveTaskActivityBehavior(); return(task); }
public override BaseElement Clone() { ReceiveTask clone = new ReceiveTask { Values = this }; return(clone); }
internal void ResponseCompleted(ILog log) { if (Request is UnknownRequest) { log.Info(() => LogEvent.Create($"Received {ResponseBytes.Count + Protocol.Request.CorrelationSize} bytes (id {Context.CorrelationId})")); return; } log.Info(() => LogEvent.Create($"Received {ApiKey} response (id {Context.CorrelationId}, {ResponseBytes.Count + Protocol.Request.CorrelationSize} bytes)")); if (!ReceiveTask.TrySetResult(ResponseBytes)) { log.Debug(() => { var result = ApiKey.ToResponse(Context, ResponseBytes); return(LogEvent.Create($"Timed out -----> (timed out or otherwise errored in client) {{Context:{Context},\n{ApiKey}Response:{result}}}")); }); } }
protected internal AbstractReceiveTaskBuilder(BpmnModelInstance modelInstance, ReceiveTask element, Type selfType) : base(modelInstance, element, selfType) { }
public virtual ReceiveTaskActivityBehavior CreateReceiveTaskActivityBehavior(ReceiveTask receiveTask) { return(new ReceiveTaskActivityBehavior()); }