private void Dispatch(Tuple <Uri, T> nodeAndWorkItemPair) { var cf = new ChannelFactory <IGridNode <T> >(new NetTcpBinding(), new EndpointAddress(nodeAndWorkItemPair.Item1)); IGridNode <T> proxy = cf.CreateChannel(); proxy.InvokeAsync(nodeAndWorkItemPair.Item2) .ContinueWith(t => { ((IClientChannel)proxy).Close(); nodes.Post(nodeAndWorkItemPair.Item1); }); }
public GridDispatcher(IGridNode <T> localService) { var localDispacther = new ActionBlock <T>(wi => { Console.WriteLine("Executing locally"); return(localService.InvokeAsync(wi)); }, new ExecutionDataflowBlockOptions { BoundedCapacity = 2, MaxDegreeOfParallelism = 2 }); var dispatcher = new ActionBlock <Tuple <Uri, T> >((Action <Tuple <Uri, T> >)Dispatch); _workItems.LinkTo(localDispacther); _workItems.LinkTo(_scheduler.Target2); _nodes.LinkTo(_scheduler.Target1); _scheduler.LinkTo(dispatcher); }
protected virtual void EndGroupTransition() { IsTransition = false; SelectedNode = null; }
protected virtual void BeginGroupTransition() { IsTransition = true; SelectedNode = GetNode(SelectIndex); }
public virtual void SnapNodeToGrid(IGridNode node) { var pos = GetSnappedPosition(node.EditorWindowRect.position, node.EditorWindowRect.size); node.EditorWindowRect = new Rect(pos, node.EditorWindowRect.size); }