문제

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;
}
도움이 되었습니까?

해결책

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))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top