Exemple #1
0
        private void piPropertiesInspector_SelectedObjectChanged(object sender, EventArgs e)
        {
            object o = this.piPropertiesInspector.SelectedObject;

            if (o is Place)
            {
                if (!(o is PlaceInput))
                {
                    if (this.pnd.PetriNetType == PetriNetType.TimeInvariant)
                    {
                        this.piPropertiesInspector.BrowsableAttributes = new AttributeCollection(new Attribute[] { new TimeInvariantAttribute() });
                    }
                    else
                    {
                        this.piPropertiesInspector.BrowsableAttributes = new AttributeCollection(new Attribute[] { new CommonPropertiesAttribute() });
                    }
                }
                else
                {
                    PlaceInput pi = (PlaceInput)o;

                    if (pi.InputType == InputType.Fixed)
                    {
                        this.piPropertiesInspector.BrowsableAttributes = new AttributeCollection(new Attribute[] { new TimeInvariantAttribute(), new PeriodicInputTypeAttribute(), new StohasticInputTypeAttribute() });
                    }
                    else if (pi.InputType == InputType.Periodic)
                    {
                        this.piPropertiesInspector.BrowsableAttributes = new AttributeCollection(new Attribute[] { new TimeInvariantAttribute(), new PeriodicInputTypeAttribute() });
                    }
                    else if (pi.InputType == InputType.Stohastic)
                    {
                        this.piPropertiesInspector.BrowsableAttributes = new AttributeCollection(new Attribute[] { new TimeInvariantAttribute(), new StohasticInputTypeAttribute() });
                    }
                }
            }
            else
            {
                this.piPropertiesInspector.BrowsableAttributes = new AttributeCollection(new Attribute[] { new CommonPropertiesAttribute() });
            }

            if (o is SelectableAndMovableControl)
            {
                SelectableAndMovableControl s = (SelectableAndMovableControl)o;
                s.PerformActivation();
            }
            else if (o is Connection)
            {
                Connection cn = (Connection)o;
                if (cn.IsVirtual == true)
                {
                    this.piPropertiesInspector.BrowsableAttributes = new AttributeCollection(new Attribute[] { new CommonPropertiesAttribute() });
                }
                else
                {
                    this.piPropertiesInspector.BrowsableAttributes = new AttributeCollection(new Attribute[] { new ConnectionPropertiesAttribute() });
                }

                cn.PerformActivation();
            }
        }