Exemplo n.º 1
0
        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);
            });
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 protected virtual void EndGroupTransition()
 {
     IsTransition = false;
     SelectedNode = null;
 }
Exemplo n.º 4
0
 protected virtual void BeginGroupTransition()
 {
     IsTransition = true;
     SelectedNode = GetNode(SelectIndex);
 }
Exemplo n.º 5
0
        public virtual void SnapNodeToGrid(IGridNode node)
        {
            var pos = GetSnappedPosition(node.EditorWindowRect.position, node.EditorWindowRect.size);

            node.EditorWindowRect = new Rect(pos, node.EditorWindowRect.size);
        }