internal int RemoveThumbnail(PNote note, bool resetProperty = true) { try { var index = 0; var thb = Thumbnails.FirstOrDefault(t => t.Id == note.ID); if (thb != null) { index = Thumbnails.IndexOf(thb); thb.Click -= Thumbnail_Click; thb.MouseEnter -= Thumbnail_MouseEnter; thb.MouseLeave -= Thumbnail_MouseLeave; thb.MouseDoubleClick -= Thumbnail_MouseDoubleClick; Thumbnails.Remove(thb); } if (resetProperty) { note.Thumbnail = false; PNNotesOperations.SaveNoteThumbnail(note); } if (note.Dialog == null) { return(index); } note.PlaceOnScreen(); return(index); } catch (Exception ex) { PNStatic.LogException(ex); return(0); } }