comparison ServerMonitor/Helpers.cs @ 8:052aa62cb42a

Single instance. Add autorun option. Add icons. General enhancements.
author Brad Greco <brad@bgreco.net>
date Sat, 09 Mar 2019 20:14:03 -0500
parents b6fe203af9d5
children 68d7834dc28e
comparison
equal deleted inserted replaced
7:8486ab7d2357 8:052aa62cb42a
42 public static T GetAttribute<T>(this Type type) where T : Attribute 42 public static T GetAttribute<T>(this Type type) where T : Attribute
43 { 43 {
44 return type.GetCustomAttributes(typeof(T), false).SingleOrDefault() as T; 44 return type.GetCustomAttributes(typeof(T), false).SingleOrDefault() as T;
45 } 45 }
46 46
47 public static Image GetIcon(this CheckStatus checkStatus) 47 public static Image GetImage(this CheckStatus checkStatus)
48 { 48 {
49 switch (checkStatus) 49 switch (checkStatus)
50 { 50 {
51 case CheckStatus.Error: return Resources.error; 51 case CheckStatus.Error: return Resources.error;
52 case CheckStatus.Warning: return Resources.warning; 52 case CheckStatus.Warning: return Resources.warning;
53 case CheckStatus.Information: return Resources.info; 53 case CheckStatus.Information: return Resources.info;
54 case CheckStatus.Success: return Resources.pass; 54 case CheckStatus.Success: return Resources.pass;
55 case CheckStatus.Running: return Resources.run; 55 case CheckStatus.Running: return Resources.run;
56 case CheckStatus.Disabled: return Resources.disable; 56 case CheckStatus.Disabled: return Resources.disable;
57 default: return null; 57 default: return null;
58 }
59 }
60
61 public static Icon GetIcon(this CheckStatus checkStatus)
62 {
63 switch (checkStatus)
64 {
65 case CheckStatus.Error: return Resources.icon_error;
66 case CheckStatus.Warning: return Resources.icon_warning;
67 case CheckStatus.Information: return Resources.icon_info;
68 default: return Resources.icon;
58 } 69 }
59 } 70 }
60 71
61 public static bool In(this Enum value, params Enum[] values) { 72 public static bool In(this Enum value, params Enum[] values) {
62 return values.Contains(value); 73 return values.Contains(value);