/// <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; }
public INetworkPipePresenter Create(INetworkPipe pipe, INetworkPipeView view) { NetworkPipePresenter pres = null; if (pipe != null && view != null) { pres = new NetworkPipePresenter(pipe, view); } return pres; }
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); } }
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); }
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; }
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"); } }
public void Reset() { _outputPort = null; _inputPort = null; _pipe = null; }
internal void UnSubscribeFromPipeEvents(INetworkPipe pipe) { if (pipe == null) return; pipe.StatusChanged -= new StatusChangeEventHandler<IPipe, PipeStatusChangeEventArgs>(_inPipe_ContentStatusChanged); }
public bool Remove(INetworkPipe item) { throw new NotImplementedException("Not Implemented In DUMMY"); }
public void Insert(int index, INetworkPipe item) { throw new NotImplementedException("Not Implemented In DUMMY"); }
public int IndexOf(INetworkPipe item) { throw new NotImplementedException("Not Implemented In DUMMY"); }
public void CopyTo(INetworkPipe[] array, int arrayIndex) { throw new NotImplementedException("Not Implemented In DUMMY"); }
public bool Contains(INetworkPipe item) { throw new NotImplementedException("Not Implemented In DUMMY"); }
public void Add(INetworkPipe item) { throw new NotImplementedException("Not Implemented In DUMMY"); }
public NetworkPipePresenter(INetworkPipe pipe, INetworkPipeView view) { NetworkPipe = pipe; NetworkPipeView = view; }