public IEnumerable <DesktopItem> DesktopItemsFromID(string id)
        {
            IEnumerable <DesktopItem> result = DesktopItems
                                               .Where(item => item.DesktopID.Equals(id, StringComparison.CurrentCultureIgnoreCase));

            return(result.Any() ? result : Enumerable.Empty <DesktopItem> ());
        }
Beispiel #2
0
 /// <summary>
 /// Find a DesktopItem by specifying a path to a .desktop file.
 /// </summary>
 /// <returns>
 /// The DesktopItem, if any exists.
 /// </returns>
 /// <param name='file'>
 /// A path to a .desktop file.
 /// </param>
 public DesktopItem DesktopItemFromDesktopFile(string file)
 {
     return(DesktopItems
            .Where(item => item.Path.Equals(file, StringComparison.CurrentCultureIgnoreCase))
            .DefaultIfEmpty(null)
            .First());
 }
        /// <summary>
        /// Find a DesktopItem by specifying a path to a .desktop file.
        /// </summary>
        /// <returns>
        /// The DesktopItem, if any exists.
        /// </returns>
        /// <param name='file'>
        /// A path to a .desktop file.
        /// </param>
        public DesktopItem DesktopItemFromDesktopFile(string file)
        {
            // this creates an object for each application
            Log <DesktopItemService> .Info("Loading from file {0}", file);

            return(DesktopItems
                   .Where(item => item.Path.Equals(file, StringComparison.CurrentCultureIgnoreCase))
                   .DefaultIfEmpty(null)
                   .First());
        }