Пример #1
0
        /// <summary>
        /// Gets the service interface of type T.
        /// </summary>
        /// <typeparam name="T">Type of service to get</typeparam>
        /// <param name="app">
        /// Application object from which to get the service.
        /// </param>
        /// <returns>
        /// Reference to the service or null if not found.
        /// </returns>
        public static T GetService <T>(this System.Windows.Application app)
        {
            var kernel = app.GetKernel();

            if (kernel != null)
            {
                return(kernel.Get <T>());
            }
            return(default(T));
        }