public ActionFactory(ActionCategoryAttribute catAttribute, Type pluginType, ICentipedeCore core) { string displayName = !String.IsNullOrEmpty(catAttribute.DisplayName) ? catAttribute.DisplayName : pluginType.Name; Text = displayName; ToolTipText = catAttribute.Usage; _actionType = pluginType; _core = core; ImageKey = @"Generic"; }
public static string GetActionCategory(object[] attributes) { for (int i = 0; i < attributes.Length; i++) { object obj = attributes[i]; ActionCategoryAttribute actionCategoryAttribute = obj as ActionCategoryAttribute; if (actionCategoryAttribute != null) { return(actionCategoryAttribute.get_Category()); } } return(Strings.get_Label_Misc()); }
private static Image GetActionIcon(IAction action) { Type actionType = action.GetType(); ActionCategoryAttribute categoryAttribute = (ActionCategoryAttribute) actionType.GetCustomAttributes(typeof(ActionCategoryAttribute), true).Single(); Image image = null; if (!String.IsNullOrEmpty(categoryAttribute.IconName)) { Type t = actionType.Assembly.GetType(actionType.Namespace + @".Properties.Resources"); if (t != null) { var icon = t.GetProperty(categoryAttribute.IconName, typeof(Icon)).GetValue(t, null) as Icon; if (icon != null) { image = icon.ToBitmap(); } } } return(image); }