Esempio n. 1
0
        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";
        }
Esempio n. 2
0
 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());
 }
Esempio n. 3
0
        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);
        }