Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static Control GetControl(PresentationControlType type)
        {
            foreach (var smartPart in Workbench.MainWorkspace.SmartParts)
            {
                var attr = smartPart.GetType().GetCustomAttributes(typeof(CtcPartAttribute), false).
                           OfType <CtcPartAttribute>().FirstOrDefault();

                if (attr == null)
                {
                    continue;
                }

                if (attr.ControlType == (ushort)type)
                {
                    return(smartPart as Control);
                }
            }

            return(null);
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 public CtcPartAttribute(PresentationControlType controlType)
 {
     base.ControlType = (ushort)controlType;
     Title            = EnumUtility.GetDescription(controlType);
 }