public void AddToList(Type newType, string name, string folder) { // if (TypeList.IndexOf (newType) == -1) { // TypeList.Add (newType); // NameList.Add (name); // // } if (Constants.BLANK == folder) { // probably do nothing } if (ListOfNoteTypes.Find(NoteTypeDetails => NoteTypeDetails.TypeOfNote == newType) != null) { } else { // A new one. Let us add it. NoteTypeDetails newNoteType = new NoteTypeDetails(); newNoteType.TypeOfNote = newType; newNoteType.NameOfNote = name; newNoteType.Folder = folder; ListOfNoteTypes.Add(newNoteType); } }
public void RemoveFromList(Type newType) { NoteTypeDetails newNoteType = ListOfNoteTypes.Find(NoteTypeDetails => NoteTypeDetails.TypeOfNote == newType); if (null != newNoteType) { ListOfNoteTypes.Remove(newNoteType); } // if (TypeList.IndexOf (newType) > -1) { // TypeList.Remove(newType); // } }
/// <summary> /// Gets the type of the name from. /// Assumes namelist and typelist are equal at all times /// </summary> /// <returns> /// The name from type. /// </returns> /// <param name='lookupType'> /// Lookup type. /// </param> public string GetNameFromType(Type lookupType) { NoteTypeDetails newNoteType = ListOfNoteTypes.Find(NoteTypeDetails => NoteTypeDetails.TypeOfNote == lookupType); if (newNoteType != null) { return(newNoteType.NameOfNote); } return(Constants.ERROR); // if (NameList.Count != TypeList.Count) { // throw new Exception("Must be same number of type names as types"); // } // int index = TypeList.IndexOf (lookupType); // if (index >= 0) { // return NameList[index].ToString (); // } // return Constants.ERROR; }