Question

I use this code to make a toolbar in my Designer but it does not retrieve all the elements of state machine like final state. What is the correct namespace to load all the elements of state machine?

private static ToolboxControl CreateToolboxControlshahram() {
    const string @namespace = "System.Activities.Statements";
    var toolbox = new ToolboxControl();
    var cat = new ToolboxCategory(@namespace);
    ToolboxItemWrappers(typeof(Flowchart).Assembly, @namespace).ToList().ForEach(cat.Add);
    if (cat.Tools.Count > 0)
        toolbox.Categories.Add(cat);

    return toolbox;
}

private static IEnumerable<ToolboxItemWrapper> ToolboxItemWrappers(Assembly assembly, string @namespace) {
    if (assembly == null) {
        throw new ArgumentNullException("assembly");
    }
    if (string.IsNullOrEmpty(@namespace)) {
        return Enumerable.Empty<ToolboxItemWrapper>();
    }

    var q = from type in assembly.GetTypes()
            where string.Equals(type.Namespace, @namespace)
            && type.IsPublic && !type.IsNested && !type.IsAbstract
            && type.GetConstructor(Type.EmptyTypes) != null
            orderby type.Name
            select new ToolboxItemWrapper(type);
    return q;
}
Was it helpful?

Solution

Finally I Found The Final state: Final State is in Different Assembly and i have to just write this code to add it on my ToolBox

ToolboxItemWrapper(typeof ( System.Activities.Core.Presentation.FinalState))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top