internal static void RegisterMetadata(AttributeTableBuilder builder)
 {
     Type type = typeof(Catch<>);
     builder.AddCustomAttributes(type, new DesignerAttribute(typeof(CatchDesigner)));
     builder.AddCustomAttributes(type, type.GetProperty("Action"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, new ActivityDesignerOptionsAttribute { AllowDrillIn = false });
 }
        static void Main(string[] args)
        {
            // First, we will print out all attributes that are on string by default
            AttributeCollection attributeCollection = TypeDescriptor.GetAttributes(typeof(string));
            Console.WriteLine("--------- default attributes");
            OutputAttributes(attributeCollection);

            // Use the AttributeTableBuilder to add a new Attribute to string
            AttributeTableBuilder builder = new AttributeTableBuilder();
            builder.AddCustomAttributes(typeof(string), new DesignerCategoryAttribute("Custom category"));
            MetadataStore.AddAttributeTable(builder.CreateTable());

            Console.WriteLine("--------- including custom attributes");
            attributeCollection = TypeDescriptor.GetAttributes(typeof(string));
            OutputAttributes(attributeCollection);
            Console.WriteLine("--------- registering callback");

            // Use the AttributeCallback to delay registering metadata until it is requested.
            builder = new AttributeTableBuilder();
            builder.AddCallback(typeof(string),
                new AttributeCallback(acb =>
                    {
                        Console.WriteLine("*** In AttributeCallback, adding a new attribute");
                        acb.AddCustomAttributes(new DesignTimeVisibleAttribute(false));
                    }
                )
            );
            MetadataStore.AddAttributeTable(builder.CreateTable());

            Console.WriteLine("--------- including custom attributes added via callback");
            attributeCollection = TypeDescriptor.GetAttributes(typeof(string));
            OutputAttributes(attributeCollection);
            Console.WriteLine("Press Enter to Exit");
            Console.ReadLine();
        }
 /// <summary>
 /// The register metadata.
 /// </summary>
 /// <param name="builder">
 /// The builder.
 /// </param>
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     builder.AddCustomAttributes(
         typeof(HttpWorkflowService), new DesignerAttribute(typeof(HttpWorkflowServiceDesigner)));
     builder.AddCustomAttributes(
         typeof(HttpWorkflowService), new DescriptionAttribute("A Workflow Service that uses HTTP Messaging"));
 }
 internal static void RegisterMetadata(AttributeTableBuilder builder)
 {
     builder.AddCustomAttributes(typeof(Statements.ReceiveFileChanges),
         new DesignerAttribute(typeof(ReceiveFileChangesDesigner)),
         new DescriptionAttribute(Properties.Resources.ReceiveFileChangesDesigner_Description));
     //new ToolboxBitmapAttribute(typeof(ReceiveFileChangesDesigner), "ReceiveFileChanges.png")
 }
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     Type type = typeof(ModelItemKeyValuePair<,>);
     builder.AddCustomAttributes(type, new DesignerAttribute(typeof(CaseDesigner)));
     builder.AddCustomAttributes(type, type.GetProperty("Value"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, new ActivityDesignerOptionsAttribute { AllowDrillIn = false });
 }
 /// <summary>
 /// The register metadata.
 /// </summary>
 /// <param name="builder">
 /// The builder.
 /// </param>
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     builder.AddCustomAttributes(typeof(DelayUntilTime), new DesignerAttribute(typeof(DelayUntilTimeDesigner)));
     builder.AddCustomAttributes(typeof(DelayUntilTime), OccurenceDays, new BrowsableAttribute(false));
     builder.AddCustomAttributes(typeof(DelayUntilTime), new DescriptionAttribute(Properties.Resources.An_activity_that_will_delay_until_a_specific_time_on_certain_days));
     builder.AddCustomAttributes(typeof(DelayUntilTime), new ToolboxBitmapAttribute("DelayCheck.bmp"));
 }
Exemplo n.º 7
0
        public void Register()
        {
            AttributeTableBuilder builder = new AttributeTableBuilder();

            Type stateMachineType = typeof(StateMachine);
            builder.AddCustomAttributes(stateMachineType, new DesignerAttribute(typeof(StateMachineDesigner)));
            builder.AddCustomAttributes(stateMachineType, stateMachineType.GetProperty(StateContainerEditor.ChildStatesPropertyName), BrowsableAttribute.No);
            builder.AddCustomAttributes(stateMachineType, stateMachineType.GetProperty(StateMachineDesigner.VariablesPropertyName), BrowsableAttribute.No);
            builder.AddCustomAttributes(stateMachineType, stateMachineType.GetProperty(StateMachineDesigner.InitialStatePropertyName), BrowsableAttribute.No);

            Type stateType = typeof(State);
            builder.AddCustomAttributes(stateType, new DesignerAttribute(typeof(StateDesigner)));
            builder.AddCustomAttributes(stateType, stateType.GetProperty(StateDesigner.EntryPropertyName), BrowsableAttribute.No);
            builder.AddCustomAttributes(stateType, stateType.GetProperty(StateDesigner.ExitPropertyName), BrowsableAttribute.No);
            builder.AddCustomAttributes(stateType, stateType.GetProperty(StateContainerEditor.ChildStatesPropertyName), BrowsableAttribute.No);
            builder.AddCustomAttributes(stateType, stateType.GetProperty(StateDesigner.TransitionsPropertyName), BrowsableAttribute.No);
            builder.AddCustomAttributes(stateType, stateType.GetProperty(StateDesigner.IsFinalPropertyName), BrowsableAttribute.No);

            Type transitionType = typeof(Transition);
            builder.AddCustomAttributes(transitionType, new DesignerAttribute(typeof(TransitionDesigner)));
            builder.AddCustomAttributes(transitionType, transitionType.GetProperty(TransitionDesigner.TriggerPropertyName), BrowsableAttribute.No);
            builder.AddCustomAttributes(transitionType, transitionType.GetProperty(TransitionDesigner.ActionPropertyName), BrowsableAttribute.No);
            builder.AddCustomAttributes(transitionType, transitionType.GetProperty(TransitionDesigner.ToPropertyName), BrowsableAttribute.No);

            MetadataStore.AddAttributeTable(builder.CreateTable());
        }
        public MainWindow()
        {
            InitializeComponent();
            new BluEnergyXDesignerStart().ShowDialog();
            
            errorService = new ValidationErrorService(this.messageListBox);

            originalTitle = this.Title;
            //register designers for the standard activities
            DesignerMetadata dm = new DesignerMetadata();
            dm.Register();
            //toolbox
            toolboxControl = CreateToolbox();
            toolboxArea.Child = toolboxControl;
            CreateContextMenu();

            InitializeDesigner();
            StartNewWorkflow();

            //override designer for the standard While activity
            AttributeTableBuilder atb = new AttributeTableBuilder();
            atb.AddCustomAttributes(typeof(While), new DesignerAttribute(typeof(ActivityLibrary.Design.MyWhileDesigner)));
            MetadataStore.AddAttributeTable(atb.CreateTable());


        }
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     Type type = typeof(DoWhile);
     builder.AddCustomAttributes(type, new DesignerAttribute(typeof(DoWhileDesigner)));
     builder.AddCustomAttributes(type, type.GetProperty("Body"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Variables"), BrowsableAttribute.No);
 }
 public static void RegisterAll()
 {
     var builder = new AttributeTableBuilder();
     HttpWorkflowServiceDesigner.RegisterMetadata(builder);
     HttpReceiveDesigner.RegisterMetadata(builder);
     MetadataStore.AddAttributeTable(builder.CreateTable());
 }
Exemplo n.º 11
0
 private void RegisterMetadata()
 {
     DesignerMetadata metaData = new DesignerMetadata();
     metaData.Register();
     AttributeTableBuilder builder = new AttributeTableBuilder();
     MetadataStore.AddAttributeTable(builder.CreateTable());
 }
Exemplo n.º 12
0
 // since designer and activity are in same assembly register in static constructor
 static SimpleCodeActivity()
 {
     AttributeTableBuilder builder = new AttributeTableBuilder();
     builder.AddCustomAttributes(typeof(SimpleCodeActivity), "RepeatCount", new EditorAttribute(typeof(CustomInlineEditor), typeof(PropertyValueEditor)));
     builder.AddCustomAttributes(typeof(SimpleCodeActivity), "FileName", new EditorAttribute(typeof(FilePickerEditor), typeof(DialogPropertyValueEditor)));
     MetadataStore.AddAttributeTable(builder.CreateTable());
 }
        // <summary>
        // Initializes the metadata provided by this class.  Multiple class
        // are ignored.
        // </summary>
        public static void Initialize() 
        {
            if (_initialized)
            {
                return;
            }

            // Introduce any Cider-specific customizations
            AttributeTableBuilder builder = new AttributeTableBuilder();

            // Make Name and FlowDirection properties browsable.  The reason why
            // these attributes are here instead of in the BaseOverridesAttributeTable
            // is because the BaseAttributeTable explicitly hides these properties
            // and adding conflicting attributes to the same table (via BaseOverridesAttributeTable
            // which derives from BaseAttributeTable) currently results in unspeciefied
            // behavior.  Hence we use this table to deal with these attributes.
            //
            MakeBasic(builder, typeof(FrameworkElement), FrameworkElement.FlowDirectionProperty);
            MakeBasic(builder, typeof(Control), Control.NameProperty);

            // Note: Add any new attributes here or into System.Activities.Presentation.Developer / 
            // System.Activities.Presentation.Internal.Metadata.BaseOverridesAttributeTable

            MetadataStore.AddAttributeTable(builder.CreateTable());

            _initialized = true;
        }
Exemplo n.º 14
0
        protected bool AddIcon(Type type, AttributeTableBuilder builder)
        {
            var secondary = false;

            var tbaType = typeof (ToolboxBitmapAttribute);
            var imageType = typeof (Image);
            var constructor = tbaType.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null,
                new[] {imageType, imageType}, null);

            var resourceKey = type.IsGenericType ? type.GetGenericTypeDefinition().Name : type.Name;
            var index = resourceKey.IndexOf('`');
            if (index > 0)
            {
                resourceKey = resourceKey.Remove(index);
            }
            if (resourceKey == "Flowchart")
            {
                resourceKey = "FlowChart"; // it appears that themes/icons.xaml has a typo here
            }
            resourceKey += "Icon";
            Bitmap small, large;
            var resource = TryFindResource(resourceKey);
            if (!(resource is DrawingBrush))
            {
                resource = FindResource("GenericLeafActivityIcon");
                secondary = true;
            }
            var dv = new DrawingVisual();
            using (var context = dv.RenderOpen())
            {
                context.DrawRectangle(((DrawingBrush) resource), null, new Rect(0, 0, 32, 32));
                context.DrawRectangle(((DrawingBrush) resource), null, new Rect(32, 32, 16, 16));
            }
            var rtb = new RenderTargetBitmap(32, 32, 96, 96, PixelFormats.Pbgra32);
            rtb.Render(dv);
            using (var outStream = new MemoryStream())
            {
                BitmapEncoder enc = new PngBitmapEncoder();
                enc.Frames.Add(BitmapFrame.Create(rtb));
                enc.Save(outStream);
                outStream.Position = 0;
                large = new Bitmap(outStream);
            }
            rtb = new RenderTargetBitmap(16, 16, 96, 96, PixelFormats.Pbgra32);
            dv.Offset = new Vector(-32, -32);
            rtb.Render(dv);
            using (var outStream = new MemoryStream())
            {
                BitmapEncoder enc = new PngBitmapEncoder();
                enc.Frames.Add(BitmapFrame.Create(rtb));
                enc.Save(outStream);
                outStream.Position = 0;
                small = new Bitmap(outStream);
            }
            var tba = constructor.Invoke(new object[] {small, large}) as ToolboxBitmapAttribute;
            builder.AddCustomAttributes(type, tba);

            return secondary;
        }
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     Type type = typeof(TransactedReceiveScope);
     builder.AddCustomAttributes(type, new DesignerAttribute(typeof(TransactedReceiveScopeDesigner)));
     builder.AddCustomAttributes(type, type.GetProperty("Body"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Request"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Variables"), BrowsableAttribute.No);
 }
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     Type type = typeof(System.Activities.Statements.Pick);
     builder.AddCustomAttributes(type, new DesignerAttribute(typeof(PickDesigner)));
     builder.AddCustomAttributes(type, type.GetProperty("Branches"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Branches"), new ShowPropertyInOutlineViewAttribute() { CurrentPropertyVisible = false });
     builder.AddCustomAttributes(type, new FeatureAttribute(typeof(PickValidationErrorSourceLocatorFeature)));
 }
 void IRegisterMetadata.Register()
 {
     var builder = new AttributeTableBuilder();
     Presentation.FileCopyDesigner.RegisterMetadata(builder);
     Presentation.FolderWatcherDesigner.RegisterMetadata(builder);
     Presentation.ReceiveFileChangesDesigner.RegisterMetadata(builder);
     MetadataStore.AddAttributeTable(builder.CreateTable());
 }
 /// <summary>
 /// The register metadata.
 /// </summary>
 /// <param name="builder">
 /// The builder.
 /// </param>
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     builder.AddCustomAttributes(
         typeof(DelayUntilDateTime),
         new DesignerAttribute(typeof(DelayUntilDateTimeDesigner)),
         new DescriptionAttribute(Properties.Resources.DelayUntilDateTimeDesigner_RegisterMetadata_Delay_until_a_specific_date_time),
         new ToolboxBitmapAttribute("DelayCheck.bmp"));
 }
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     Type type = typeof(Sequence);
     builder.AddCustomAttributes(type, new DesignerAttribute(typeof(SequenceDesigner)));
     builder.AddCustomAttributes(type, type.GetProperty("Activities"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Variables"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Activities"), new ShowPropertyInOutlineViewAttribute() { CurrentPropertyVisible = false });
 }
 /// <summary>
 ///   The register metadata.
 /// </summary>
 /// <param name = "builder">
 ///   The builder.
 /// </param>
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     builder.AddCustomAttributes(typeof(InvokeWorkflow), new DesignerAttribute(typeof(InvokeWorkflowDesigner)));
     builder.AddCustomAttributes(
         typeof(InvokeWorkflow),
         new DescriptionAttribute(Properties.Resources.Invokes_an_Activity_using_WorkflowInvoker));
     builder.AddCustomAttributes(typeof(InvokeWorkflow), new ToolboxBitmapAttribute("InvokeWorkflow.bmp"));
 }
 /// <summary>
 /// The register metadata.
 /// </summary>
 /// <param name="builder">
 /// The builder.
 /// </param>
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     builder.AddCustomAttributes(
         typeof(LoadAndInvokeWorkflow), new DesignerAttribute(typeof(LoadAndInvokeWorkflowDesigner)));
     builder.AddCustomAttributes(
         typeof(LoadAndInvokeWorkflow),
         new DescriptionAttribute(Properties.Resources.Loads_and_invokes_a_workflow));
     builder.AddCustomAttributes(typeof(LoadAndInvokeWorkflow), new ToolboxBitmapAttribute("InvokeWorkflow.bmp"));
 }
 /// <summary>
 /// The register metadata.
 /// </summary>
 /// <param name="builder">
 /// The builder.
 /// </param>
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     builder.AddCustomAttributes(
         typeof(LoadAssembly),
         new DesignerAttribute(typeof(LoadAssemblyDesigner)),
         new ToolboxBitmapAttribute("dbGreenCheck16.png"),
         new DescriptionAttribute(
             Properties.Resources.LoadActivityDesigner_RegisterMetadata_Loads_an_activity_from_XAML));
 }
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     builder.AddCustomAttributes(typeof(InvokeDelegate), new DesignerAttribute(typeof(InvokeDelegateDesigner)));
     builder.AddCustomAttributes(typeof(InvokeDelegate), new ActivityDesignerOptionsAttribute { AllowDrillIn = false });
     builder.AddCustomAttributes(typeof(InvokeDelegate), new FeatureAttribute(typeof(InvokeDelegateValidationFeature)));
     builder.AddCustomAttributes(typeof(InvokeDelegate), DelegatePropertyName, BrowsableAttribute.No);
     builder.AddCustomAttributes(typeof(InvokeDelegate), DelegateArgumentsPropertyName, PropertyValueEditor.CreateEditorAttribute(typeof(DelegateArgumentsValueEditor)), BrowsableAttribute.Yes);
     builder.AddCustomAttributes(typeof(InvokeDelegate), DefaultPropertyName, BrowsableAttribute.No);
 }
 public override void Initialize(EditingContext context, Type modelType)
 {
     if (context.Services.GetService<DesignerConfigurationService>().TargetFrameworkName.IsLessThan45())
     {
         AttributeTableBuilder builder = new AttributeTableBuilder();
         builder.AddCustomAttributes(typeof(FlowSwitchDefaultLink<>), "DefaultCaseDisplayName", BrowsableAttribute.No);
         MetadataStore.AddAttributeTable(builder.CreateTable());
     }
 }
        public static void RegisterMetadata(AttributeTableBuilder builder)
        {
            Type type = typeof(If);
            builder.AddCustomAttributes(type, new DesignerAttribute(typeof(IfElseDesigner)));
            builder.AddCustomAttributes(type, type.GetProperty("Then"), BrowsableAttribute.No);
            builder.AddCustomAttributes(type, type.GetProperty("Else"), BrowsableAttribute.No);

            builder.AddCustomAttributes(type, type.GetProperty("Condition"), new HidePropertyInOutlineViewAttribute());
        }
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     Type type = typeof(PickBranch);
     builder.AddCustomAttributes(type, new DesignerAttribute(typeof(PickBranchDesigner)));
     builder.AddCustomAttributes(type, type.GetProperty("Action"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Trigger"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Variables"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, new ShowInOutlineViewAttribute());
 }
Exemplo n.º 27
0
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     Type type = typeof(SendMail);
     builder.AddCustomAttributes(type, new DesignerAttribute(typeof(SendMailDesigner)));
     builder.AddCustomAttributes(type, type.GetProperty("To"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("From"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Subject"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Host"), BrowsableAttribute.No);
 }
 /// <summary>
 /// The register metadata.
 /// </summary>
 /// <param name="builder">
 /// The builder. 
 /// </param>
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     builder.AddCustomAttributes(
         typeof(ClearDictionary<,>),
         new DesignerAttribute(typeof(ClearDictionaryDesigner)),
         new ToolboxBitmapAttribute("ClearDict.bmp"),
         new DescriptionAttribute(
             Properties.Resources.ClearDictionaryDesigner_RegisterMetadata_Clears_the_Dictionary));
 }
        public static void RegisterMetadata(AttributeTableBuilder builder)
        {
            Type type = typeof(Parallel);
            builder.AddCustomAttributes(type, new DesignerAttribute(typeof(ParallelDesigner)));
            builder.AddCustomAttributes(type, type.GetProperty("Branches"), BrowsableAttribute.No);
            builder.AddCustomAttributes(type, type.GetProperty("Variables"), BrowsableAttribute.No);

            builder.AddCustomAttributes(type, type.GetProperty("Branches"), new ShowPropertyInOutlineViewAttribute() { CurrentPropertyVisible = false });
            builder.AddCustomAttributes(type, type.GetProperty("CompletionCondition"), new HidePropertyInOutlineViewAttribute());
        }
 public static void RegisterMetadata(AttributeTableBuilder builder)
 {
     Type type = typeof(CompensableActivity);
     builder.AddCustomAttributes(type, new DesignerAttribute(typeof(CompensableActivityDesigner)));
     builder.AddCustomAttributes(type, type.GetProperty("Body"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("CompensationHandler"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("ConfirmationHandler"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("CancellationHandler"), BrowsableAttribute.No);
     builder.AddCustomAttributes(type, type.GetProperty("Variables"), BrowsableAttribute.No);
 }