Exemple #1
0
        public void UpdateConnections(MixerControl mixerCtrl)
        {
            string name = mixerCtrl.Mixer.Name;

            ArrayList streamInList = new ArrayList();
            int       count        = mixerCtrl.Mixer.InletStreams.Count;

            for (int i = 0; i < count; i++)
            {
                PointOrientation streamInOrientation = MixerControl.INLET_ORIENTATION;
                int             streamInIdx          = i + 1;
                Point           streamInPoint        = mixerCtrl.GetStreamInConnectionPoint(i + 1, count);
                ConnectionPoint streamInCp           = new ConnectionPoint(streamInIdx, name, streamInPoint, streamInOrientation);
                streamInList.Add(streamInCp);
            }

            PointOrientation streamOutOrientation = MixerControl.OUTLET_ORIENTATION;
            int             streamOutIdx          = Mixer.OUTLET_INDEX;
            Point           streamOutPoint        = mixerCtrl.GetStreamOutConnectionPoint();
            ConnectionPoint streamOutCp           = new ConnectionPoint(streamOutIdx, name, streamOutPoint, streamOutOrientation);

            IEnumerator e = this.Connections.GetEnumerator();

            while (e.MoveNext())
            {
                SolvableConnection dc        = (SolvableConnection)e.Current;
                Boolean            isChanged = false;

                IEnumerator en = streamInList.GetEnumerator();
                while (en.MoveNext())
                {
                    ConnectionPoint streamInCp = (ConnectionPoint)en.Current;
                    if (dc.UnitOpPoint.Equals(streamInCp))
                    {
                        isChanged            = true;
                        dc.UnitOpPoint.Point = streamInCp.Point;
                    }
                }

                if (dc.UnitOpPoint.Equals(streamOutCp))
                {
                    isChanged            = true;
                    dc.UnitOpPoint.Point = streamOutPoint;
                }
                if (isChanged)
                {
                    this.flowsheet.Controls.Remove(dc);
                    dc.UpdateConnection();
                    this.flowsheet.Controls.Add(dc);
                    isChanged = false;
                }
            }
            //this.DrawConnections();
        }