Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the DummyInputNetworkPort class, This class maintains the dataObj
 /// as a member, does NOT use the backingStore of the pipe.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="inPipe"></param>
 /// <param name="dataObj"></param>
 /// <param name="isValid"></param>
 public DummyInputNetworkPort(IElement parent, INetworkPipe inPipe, INetwork dataObj, bool isValid)
 {
     _parent = parent;
     _inPipe = inPipe;
     _netObj = dataObj;
     _IsValid = isValid;
 }
Ejemplo n.º 2
0
 public INetworkPipePresenter Create(INetworkPipe pipe, INetworkPipeView view)
 {
     NetworkPipePresenter pres = null;
     if (pipe != null && view != null)
     {
         pres = new NetworkPipePresenter(pipe, view);
     }
     return pres;
 }
Ejemplo n.º 3
0
        internal void LoadNetworkPipePresenterAndModel(INetworkPipe pipe, INetworkPipeView pipeView, IElementView srcElView, IElementView destElView, int srcPortIndex, int destPortIndex)
        {
            Guid srcElId = srcElView.Id;
            Guid destElId = destElView.Id;

            // connect the pipe to the elements, at the model (biz) level.
            IOutputNetworkPort srcPort = GetSourceNetworkPort(srcElId, srcPortIndex);
            IInputNetworkPort destPort = GetDestinationNetworkPort(destElId, destPortIndex);
            ConnectPipeModel(pipe, srcPort, destPort);

            // set the id of the pipeView to the id of the pipe model
            pipeView.Id = pipe.Id;

            // create the instance of the presenter with the model and the view
            INetworkPipePresenter presenter = CreateNetworkPipePresenter(pipe, pipeView);

            // Add the pipe presenter to the presenter mgr,and the view to the workspace view.
            // Pipe model has already been added to workspace during unpersisting.
            if (presenter != null)
            {
                View.Add(pipeView, srcElView, destElView, srcPortIndex, destPortIndex);
                PipePresenters.Add(pipe.Id, presenter);
            }
        }
Ejemplo n.º 4
0
        internal void LoadNetworkPipeIntoView(INetworkPipe pipe, IPipeTicket ticket)
        {
            // get the element presenters for the source and target elements.
            IElementPresenter srcElPresenter = ElementPresenters[ticket.SrcElementId];
            IElementPresenter destElPresenter = ElementPresenters[ticket.DestElementId];

            // get the elements
            IElement srcEl = srcElPresenter.Element;
            IElement destEl = destElPresenter.Element;

            // get the port indices
            int srcPortIndex = -1;
            int destPortIndex = -1;
            GetPortIndices(ticket, srcEl, destEl, out srcPortIndex, out destPortIndex);

            if (destEl.InPortMgr.IsPortConnected(destPortIndex))
            {
                // TODO
                throw new InvalidOperationException("Input ports can only have 1 pipe connected to them.");
            }

            // get the element views
            IElementView srcElView = srcElPresenter.View;
            IElementView destElView = destElPresenter.View;

            // create the instance of the view
            INetworkPipeView pipeView = CreateNetworkPipeView();

            LoadNetworkPipePresenterAndModel(pipe, pipeView, srcElView, destElView, srcPortIndex, destPortIndex);
        }
Ejemplo n.º 5
0
        internal INetworkPipePresenter CreateNetworkPipePresenter(INetworkPipe pipe, INetworkPipeView view)
        {
            INetworkPipePresenter pesenter = null;
            if (pipe != null && view != null)
            {
                // create the instance of the element presenter with the element and the view
                using (PipePresenterFactory fac = new PipePresenterFactory())
                {
                    pesenter = fac.Create(pipe, view);
                }
            }

            return pesenter;
        }
Ejemplo n.º 6
0
        internal void ConnectPipeModel(INetworkPipe pipe, IOutputNetworkPort srcPort, IInputNetworkPort destPort)
        {
            INetworkPlumber plumber = null;
            using (PlumberFactory pf = new PlumberFactory())
            {
                plumber = pf.CreateNetworkPlumber();
            }

            plumber.NetworkPipe = pipe;
            plumber.SetInitialPort(srcPort);
            plumber.SetFinalPort(destPort);
            bool result = plumber.Connect();

            // TODO log connection results.
            if (!result)
            {
                throw new InvalidOperationException("The pipe could not be connected");
            }
        }
Ejemplo n.º 7
0
 public void Reset()
 {
     _outputPort = null;
     _inputPort = null;
     _pipe = null;
 }
Ejemplo n.º 8
0
        internal void UnSubscribeFromPipeEvents(INetworkPipe pipe)
        {
            if (pipe == null)
                return;

            pipe.StatusChanged -= new StatusChangeEventHandler<IPipe, PipeStatusChangeEventArgs>(_inPipe_ContentStatusChanged);
        }
Ejemplo n.º 9
0
 public bool Remove(INetworkPipe item)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
Ejemplo n.º 10
0
 public void Insert(int index, INetworkPipe item)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
Ejemplo n.º 11
0
 public int IndexOf(INetworkPipe item)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
Ejemplo n.º 12
0
 public void CopyTo(INetworkPipe[] array, int arrayIndex)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
Ejemplo n.º 13
0
 public bool Contains(INetworkPipe item)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
Ejemplo n.º 14
0
 public void Add(INetworkPipe item)
 {
     throw new NotImplementedException("Not Implemented In DUMMY");
 }
Ejemplo n.º 15
0
 public NetworkPipePresenter(INetworkPipe pipe, INetworkPipeView view)
 {
     NetworkPipe = pipe;
     NetworkPipeView = view;
 }