Exemple #1
0
        /// <summary>
        /// Create the main form and flow the programs inbound
        /// command line arguments.
        /// </summary>
        /// <param name="args">Command line arguments passed
        /// by the hosting program.</param>
        public MainForm(string[] args)
        {
            InitializeComponent();

            assemblyResolverDialog = new OpenFileDialogAssemblyResolver();

            imageList1.Images.Add(OutOfBoxComponentResources.EmptyNode);

            componentMapping = new Dictionary<Type, List<Type>>();
            imageIndexMapping = new Dictionary<Type, Dictionary<string, int>>();

            WorkflowReflectionUtilitySection section = System.Configuration.ConfigurationManager.GetSection("WorkflowReflectorSettings") as WorkflowReflectionUtilitySection;

            // If no configuration section was found then
            // use the default OOB components.
            if (section == null)
            {
                section = new WorkflowReflectionUtilitySection();
                section.ShowAssemblyResolveExplanation = true;
                section.Components.Add(new ReflectionComponentElement(typeof(AssemblyComponent)));
                section.Components.Add(new ReflectionComponentElement(typeof(WorkflowComponent)));
                section.Components.Add(new ReflectionComponentElement(typeof(RuleComponent)));
                section.Components.Add(new ReflectionComponentElement(typeof(RequiredServiceInterfacesComponent)));
                section.Components.Add(new ReflectionComponentElement(typeof(XamlContextMenuComponent)));
                section.Components.Add(new ReflectionComponentElement(typeof(WorkflowDesignerViewComponent)));
                section.Components.Add(new ReflectionComponentElement(typeof(RuleEvaluatorComponent)));
                section.Components.Add(new ReflectionComponentElement(typeof(WorkflowActivitiesComponent)));
            }

            assemblyResolverDialog.ShowAssemblyResolveExplanation = section.ShowAssemblyResolveExplanation;

            InitializationContext context = new InitializationContext(componentMapping, imageList1, imageIndexMapping);

            // Initialize each component.
            foreach (ReflectionComponentElement element in section.Components)
            {
                Type nodeType = Type.GetType(element.Type);

                if (nodeType == null)
                {
                    MessageBox.Show(string.Format("Could not find type '{0}'.  Application will run without that component.", element.Type));
                    continue;
                }

                WorkflowReflectionComponent node = nodeType.InvokeMember(string.Empty, BindingFlags.CreateInstance, null, null, null, CultureInfo.InvariantCulture) as WorkflowReflectionComponent;
                node.Initialize(context);
            }

            if (args != null && args.Length > 0)
            {
                LoadAssembly(args[0]);
            }
        }
 public override void Initialize(InitializationContext context)
 {
     context.AddImage(OutOfBoxComponentResources.WorkflowNode, Color.White, typeof(WorkflowComponent), WorkflowNodeImageName); 
     context.AddChildComponent(typeof(AssemblyComponent), typeof(WorkflowComponent));
 }
 public override void Initialize(InitializationContext context)
 {
     context.AddChildComponent(typeof(RuleComponent), typeof(RuleEvaluatorComponent));
 }
 public override void Initialize(InitializationContext context)
 {
     context.AddImage(OutOfBoxComponentResources.ActivitiesNode, Color.White, typeof(WorkflowActivitiesComponent), ActivitiesNodeImageName);
     context.AddImage(OutOfBoxComponentResources.ActivityNode, Color.White, typeof(WorkflowActivitiesComponent), ActivityNodeImageName);
     context.AddChildComponent(typeof(WorkflowComponent), typeof(WorkflowActivitiesComponent));
 }
 public override void Initialize(InitializationContext context)
 {
     context.AddImage(OutOfBoxComponentResources.ServiceInterfaceNode, Color.White, typeof(RequiredServiceInterfacesComponent), ServiceInterfaceNodeImageName);
     context.AddChildComponent(typeof(WorkflowComponent), typeof(RequiredServiceInterfacesComponent));
 }
 public override void Initialize(InitializationContext context)
 {
     context.AddChildComponent(typeof(WorkflowComponent), typeof(WorkflowDesignerViewComponent));
 }
 public override void Initialize(InitializationContext context)
 {
     context.AddChildComponent(typeof(WorkflowComponent), typeof(XamlContextMenuComponent));
 }
 /// <summary>
 /// Initialize the component.
 /// </summary>
 /// <param name="context">Context within which to
 /// perform the initialization.</param>
 public abstract void Initialize(InitializationContext context);
 public override void Initialize(InitializationContext context)
 {
     // No-op
 }