aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Tango.FSE.Common/Helpers/ResourceHelper.cs
blob: 4f26127ef4efb1923dc1fda6c0be90653bdeb090 (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
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace Tango.FSE.Common.Helpers
{
    //Not used.
    public static class ResourceHelper
    {
        public enum ResourceColor
        {
            Info,
            Warning,
            Error,
            Critical,
        }

        public enum ResourceBrush
        {
            FSE_InfoBrush,
            FSE_WarningBrush,
            FSE_ErrorBrush,
            FSE_CriticalBrush,
        }

        public static Brush GetResourceBrush(ResourceBrush brush, double opacity = 1)
        {
            if (opacity == 1)
            {
                return Application.Current.Resources[brush.ToString()] as Brush;
            }
            else
            {
                return new SolidColorBrush((Application.Current.Resources[brush.ToString()] as SolidColorBrush).Color) { Opacity = opacity };
            }
        }
    }
}