protected override void SetPropertyBagValue(object sender, PropertySpecEventArgs e) { base.SetPropertyBagValue(sender, e); switch (e.Property.Name) { case "Class name": //use the logic and the constraint of the object that is being reflected if (!(e.Value.ToString() == null)) { mClassName = System.Convert.ToString(e.Value); } else { //MessageBox.Show("Not a valid label", "Invalid label", MessageBoxButtons.OK, MessageBoxIcon.Warning) this.Invalidate(); } break; case "Methods": mMethods = e.Value as ClassMethodCollection; break; case "ClassModifier": ClassModifier = (ClassDeclarationModifiers)Enum.Parse(typeof(ClassDeclarationModifiers), e.Value.ToString()); break; } }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected ClassShape(SerializationInfo info, StreamingContext context) : base(info, context) { this.mClassName = info.GetString("mClassName"); this.mCollapsed = (CollapseStates)info.GetValue("mCollapsed", typeof(CollapseStates)); this.mMethods = info.GetValue("mMethods", typeof(ClassMethodCollection)) as ClassMethodCollection; this.mPropeties = info.GetValue("mProperties", typeof(ClassPropertyCollection)) as ClassPropertyCollection; Connectors.Clear(); this.mTopConnector = info.GetValue("mTopConnector", typeof(Connector)) as Connector; this.mTopConnector.BelongsTo = this; Connectors.Add(mTopConnector); this.mBottomConnector = info.GetValue("mBottomConnector", typeof(Connector)) as Connector; this.mBottomConnector.BelongsTo = this; Connectors.Add(mBottomConnector); IsResizable = false; boldFont = new Font(Font, FontStyle.Bold); this.OnMouseUp += new MouseEventHandler(TaskEvent_OnMouseUp); }