public override bool Equals(object obj) { try { FaceImageControl fic = (FaceImageControl)obj; bool equal = this.Face == fic.Face; return(equal); } catch (InvalidCastException) { return(base.Equals(obj)); } }
public void Remove(FaceImageControl faceImageControl, bool RemoveFromOtherCategoriesAsWell) { flowLayoutPanel1.SuspendLayout(); // no idew how this internally compares stuff, apparently not with Equals() which is f*****g dumb but oh well //flowLayoutPanel1.Controls.Remove(faceImageControl); // let's do this manually then... *sigh* foreach (FaceImageControl c in flowLayoutPanel1.Controls) { if (c.Face == faceImageControl.Face) { flowLayoutPanel1.Controls.Remove(c); } } RemoveFromXmlOrList(faceImageControl, RemoveFromOtherCategoriesAsWell); flowLayoutPanel1.ResumeLayout(true); flowLayoutPanel1.Refresh(); }
private void RemoveFromXmlOrList(FaceImageControl faceImageControl, bool RemoveFromOtherCategoriesAsWell) { if (XML != null) { // is the "all" control XML.Remove(faceImageControl.Face.Category, faceImageControl.Face); if (RemoveFromOtherCategoriesAsWell) { // delete from category it belongs to as well ParentFaceForm.FaceControls[faceImageControl.Face.Category].Remove(faceImageControl, false); } } else { // is a category ImageList.Remove(faceImageControl.Face); if (RemoveFromOtherCategoriesAsWell) { // delete from all control as well AllControl.Remove(faceImageControl, false); } } }
public void Remove( FaceImageControl faceImageControl, bool RemoveFromOtherCategoriesAsWell ) { flowLayoutPanel1.SuspendLayout(); // no idew how this internally compares stuff, apparently not with Equals() which is f*****g dumb but oh well //flowLayoutPanel1.Controls.Remove(faceImageControl); // let's do this manually then... *sigh* foreach ( FaceImageControl c in flowLayoutPanel1.Controls ) { if ( c.Face == faceImageControl.Face ) { flowLayoutPanel1.Controls.Remove( c ); } } RemoveFromXmlOrList( faceImageControl, RemoveFromOtherCategoriesAsWell ); flowLayoutPanel1.ResumeLayout( true ); flowLayoutPanel1.Refresh(); }
private void RemoveFromXmlOrList( FaceImageControl faceImageControl, bool RemoveFromOtherCategoriesAsWell ) { if ( XML != null ) { // is the "all" control XML.Remove( faceImageControl.Face.Category, faceImageControl.Face ); if ( RemoveFromOtherCategoriesAsWell ) { // delete from category it belongs to as well ParentFaceForm.FaceControls[faceImageControl.Face.Category].Remove( faceImageControl, false ); } } else { // is a category ImageList.Remove( faceImageControl.Face ); if ( RemoveFromOtherCategoriesAsWell ) { // delete from all control as well AllControl.Remove( faceImageControl, false ); } } }