예제 #1
0
        /// <summary>
        /// Adds folders to the directory
        /// </summary>
        /// <param name="folders"></param>
        public void AddFoldersToDirectory(List <DirectoryItem> folders)
        {
            if (folders != null)
            {
                CurrentDirectoryResults.AddRange(folders);
            }

            SortDirectory();
        }
예제 #2
0
        /// <summary>
        /// Adds contacts to the directory
        /// </summary>
        /// <param name="contacts"></param>
        public void AddContactsToDirectory(List <DirectoryItem> contacts)
        {
            if (contacts != null)
            {
                CurrentDirectoryResults.AddRange(contacts);
            }

            SortDirectory();
        }
예제 #3
0
        /// <summary>
        /// Sorts the DirectoryResults list to display all folders alphabetically, then all contacts alphabetically
        /// </summary>
        private void SortDirectory()
        {
            var sortedFolders = new List <DirectoryItem>();

            sortedFolders.AddRange(CurrentDirectoryResults.Where(f => f is DirectoryFolder));

            sortedFolders.OrderBy(f => f.Name);

            var sortedContacts = new List <DirectoryItem>();

            sortedContacts.AddRange(CurrentDirectoryResults.Where(c => c is DirectoryContact));

            sortedFolders.OrderBy(c => c.Name);

            CurrentDirectoryResults.Clear();

            CurrentDirectoryResults.AddRange(sortedFolders);

            CurrentDirectoryResults.AddRange(sortedContacts);
        }