SendTo() private method

private SendTo ( [ feed ) : IEnumerable
feed [
return IEnumerable
Beispiel #1
0
 public void SendTo()
 {
     Suggest.SendTo(new Feed
     {
         Name        = "My App:",
         EntryPoints =
         {
             new EntryPoint {
                 Command = "a"
             },
             new EntryPoint {
                 Command = "b", SuggestSendTo = true
             }
         }
     }).Should().Equal(
         new SendTo {
         Name = "My App- b", Command = "b"
     });
 }
Beispiel #2
0
        //--------------------//

        #region Add
        /// <inheritdoc/>
        public void AddAccessPointCategories(AppEntry appEntry, Feed feed, params string[] categories)
        {
            #region Sanity checks
            if (appEntry == null)
            {
                throw new ArgumentNullException(nameof(appEntry));
            }
            if (feed == null)
            {
                throw new ArgumentNullException(nameof(feed));
            }
            if (categories == null)
            {
                throw new ArgumentNullException(nameof(categories));
            }
            #endregion

            // Parse categories list
            bool capabilities = categories.Contains(CapabilityRegistration.CategoryName);
            bool menu         = categories.Contains(MenuEntry.CategoryName);
            bool desktop      = categories.Contains(DesktopIcon.CategoryName);
            bool sendTo       = categories.Contains(SendTo.CategoryName);
            bool alias        = categories.Contains(AppAlias.CategoryName);
            bool autoStart    = categories.Contains(AutoStart.CategoryName);
            bool defaults     = categories.Contains(DefaultAccessPoint.CategoryName);

            // Build capability list
            var accessPointsToAdd = new List <AccessPoint>();
            if (capabilities)
            {
                accessPointsToAdd.Add(new CapabilityRegistration());
            }
            if (menu)
            {
                accessPointsToAdd.AddRange(Suggest.MenuEntries(feed));
            }
            if (desktop)
            {
                accessPointsToAdd.AddRange(Suggest.DesktopIcons(feed));
            }
            if (sendTo)
            {
                accessPointsToAdd.AddRange(Suggest.SendTo(feed));
            }
            if (alias)
            {
                accessPointsToAdd.AddRange(Suggest.Aliases(feed));
            }
            if (autoStart)
            {
                accessPointsToAdd.AddRange(Suggest.AutoStart(feed));
            }
            if (defaults)
            {
                // Add AccessPoints for all suitable Capabilities
                accessPointsToAdd.AddRange((
                                               from capability in appEntry.CapabilityLists.CompatibleCapabilities().OfType <DefaultCapability>()
                                               where !capability.WindowsMachineWideOnly || MachineWide || !WindowsUtils.IsWindows
                                               where !capability.ExplicitOnly
                                               select capability.ToAcessPoint()));
            }

            try
            {
                AddAccessPointsInternal(appEntry, feed, accessPointsToAdd);
                if (menu && MachineWide)
                {
                    ToggleIconsVisible(appEntry, true);
                }
            }
            catch (KeyNotFoundException ex)
            {
                // Wrap exception since only certain exception types are allowed
                throw new InvalidDataException(ex.Message, ex);
            }
            finally
            {
                Finish();
            }
        }