示例#1
0
        // called this method in main form itself rather than calling in pipeground
        public void EditComponent(Point pt)
        {
            Component cmp = pg.FindComponent(pt);
            Pipe      ppe = pg.CheckCollisionPipe(pt);

            this.propertiesForm.SetComponent(cmp);
            if (cmp != null)
            {
                if (cmp.GetType() == typeof(Pump))
                {
                    this.propertiesForm.NumInputsToggle(false, true, true);
                    this.propertiesForm.SetValues(0, (double)cmp.GetType().GetProperty("CurrentFlow").GetValue(cmp), (double)cmp.GetType().GetProperty("Capacity").GetValue(cmp));
                    this.propertiesForm.ShowDialog();
                }
                else if (cmp.GetType() == typeof(AdjustableSplitter))
                {
                    this.propertiesForm.NumInputsToggle(true, false, false);
                    this.propertiesForm.SetValues(100 * (double)typeof(AdjustableSplitter).GetProperty("PercentOut1").GetValue(cmp), 0, 0);
                    this.propertiesForm.ShowDialog();
                }
                else if (cmp.GetType() == typeof(Sink))
                {
                    this.propertiesForm.NumInputsToggle(false, false, true);
                    this.propertiesForm.SetValues(0, 0, (double)cmp.GetType().GetProperty("Capacity").GetValue(cmp));
                    this.propertiesForm.ShowDialog();
                }
                this.propertiesForm.SetPipe(null);
            }
            else if (ppe != null)
            {
                this.propertiesForm.SetPipe(ppe);
                this.propertiesForm.NumInputsToggle(false, false, true);
                this.propertiesForm.SetValues(0, 0, (double)ppe.Capacity);
                this.propertiesForm.ShowDialog();
            }
        }