aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/TangoIOCExtensions.cs
blob: 827650f591b6bc8f2a95b663aa73e230a244b398 (plain) pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.DI;
using Tango.MachineStudio.Common;

public static class TangoIOCExtensions
{
    /// <summary>
    /// Gets the specified module <see cref="IStudioViewModel"/> view models.
    /// </summary>
    /// <param name="tangoIOC">The Tango IOC.</param>
    /// <param name="module">The module.</param>
    /// <returns></returns>
    public static IEnumerable<IStudioViewModel> GetModuleViewModels(this TangoIOC tangoIOC, IStudioModule module)
    {
        var viewModels = tangoIOC.GetAllInstancesByBase<IStudioViewModel>().Where(x => x != null && x.GetType().BaseType.GetGenericArguments().Length > 0 && x.GetType().BaseType.GetGenericArguments()[0] == module.GetType());
        return viewModels;
    }
}