Subversion Repositories SoapBoxCore

Rev

Rev 12 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 12 Rev 18
Line 42... Line 42...
42
    [Export((Services.Host.ExtensionService), typeof(IExtensionService))]
42
    [Export((Services.Host.ExtensionService), typeof(IExtensionService))]
43
    public class ExtensionService : IExtensionService
43
    public class ExtensionService : IExtensionService
44
    {
44
    {
45
        [Import(Services.Logging.LoggingService, typeof(ILoggingService))]
45
        [Import(Services.Logging.LoggingService, typeof(ILoggingService))]
46
        private ILoggingService logger { get; set; }
46
        private ILoggingService logger { get; set; }
-
 
47
 
-
 
48
        /// <summary>
-
 
49
        /// Joins two extension collections and puts another item between them.
-
 
50
        /// Very handy for joining two imported collections of IMenuItems with a separator
-
 
51
        /// </summary>
-
 
52
        /// <typeparam name="T"></typeparam>
-
 
53
        /// <param name="extensionCollection1"></param>
-
 
54
        /// <param name="joinItem"></param>
-
 
55
        /// <param name="extensionCollection2"></param>
-
 
56
        /// <returns></returns>
-
 
57
        public IEnumerable<T> SortAndJoin<T>(IEnumerable<T> extensionCollection1, T joinItem, IEnumerable<T> extensionCollection2) where T : IExtension
-
 
58
        {
-
 
59
            IEnumerable<T> sorted1 = Sort(extensionCollection1);
-
 
60
            IEnumerable<T> sorted2 = Sort(extensionCollection2);
-
 
61
 
-
 
62
            foreach (T t in sorted1)
-
 
63
            {
-
 
64
                yield return t;
-
 
65
            }
-
 
66
 
-
 
67
            yield return joinItem;
-
 
68
 
-
 
69
            foreach (T t in sorted2)
-
 
70
            {
-
 
71
                yield return t;
-
 
72
            }
-
 
73
        }
47
 
74
 
48
        /// <summary>
75
        /// <summary>
49
        /// Takes a collection of extensions and returns a sorted list
76
        /// Takes a collection of extensions and returns a sorted list
50
        /// of those extensions based on the InsertBeforeID  
77
        /// of those extensions based on the InsertBeforeID  
51
        /// property of each extension.
78
        /// property of each extension.