aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI/Helpers/ResourceHelper.cs
blob: 7a861f89f1f2eaa4f8dba2f0e334a634318c151c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;

namespace Tango.SharedUI.Helpers
{
    /// <summary>
    /// Contains application resource helper methods.
    /// </summary>
    public static class ResourceHelper
    {
        /// <summary>
        /// Gets the application start path.
        /// </summary>
        /// <returns></returns>
        public static String GetApplicationStartPath()
        {
            return AppDomain.CurrentDomain.BaseDirectory;
        }

        /// <summary>
        /// Gets an image from the application resources.
        /// </summary>
        /// <param name="imagePath">The image relative path.</param>
        /// <returns></returns>
        public static BitmapSource GetImageFromResources(String imagePath)
        {
            return new BitmapImage(new Uri(String.Format("pack://application:,,,/{0};component/{1}", Assembly.GetCallingAssembly(), imagePath), UriKind.Absolute));
        }
    }
}