/// <summary> /// Creates a flow control for this universe /// Stores flow control into a list /// All flow controls will be disposed if this session is disposed /// </summary> /// <returns></returns> public UniverseGroupFlowControlWrapper CreateFlowControl() { lock (syncObject) { if (isDisposed) { throw new ObjectDisposedException("UniverseSession is already disposed"); } UniverseGroupFlowControlWrapper flowControl = new UniverseGroupFlowControlWrapper(UniverseGroup.GetNewFlowControl()); flowControls.Add(flowControl); return(flowControl); } }
/// <summary> /// Removes the flow control from the session /// </summary> /// <param name="flowControlWrapper">The flow control to remove</param> public void RemoveFlowControl(UniverseGroupFlowControlWrapper flowControlWrapper) { lock (syncObject) { if (isDisposed) { throw new ObjectDisposedException("UniverseSession is already disposed"); } int count = flowControls.Count; for (int i = 0; i < count; i++) { if (flowControls[i].Equals(flowControlWrapper)) { flowControls.RemoveAt(i); flowControlWrapper.Dispose(); break; } } } }