Beispiel #1
0
        /// <summary>
        /// Creates a new Workflow Designer instance (VB) with Intellisense
        /// </summary>
        /// <param name="sourceFile">Workflow FileName</param>
        public static void NewInstanceVB(string sourceFile = _defaultWorkflow)
        {
            _expressionEditorServiceVB = new VbExpressionEditorService();

            _wfDesigner = new WorkflowDesigner();

            Hashtable hashTable = new Hashtable
            {
                { WorkflowDesignerColors.DesignerViewShellBarControlBackgroundColorKey, SystemColors.HighlightBrush },
                { WorkflowDesignerColors.DesignerViewShellBarColorGradientBeginKey, SystemColors.HighlightBrush },
                { WorkflowDesignerColors.DesignerViewShellBarColorGradientEndKey, SystemColors.HighlightBrush },
            };

            _wfDesigner.PropertyInspectorFontAndColorData = System.Xaml.XamlServices.Save(hashTable);

            _wfDesigner.Context.Services.GetService <DesignerConfigurationService>().TargetFrameworkName = new System.Runtime.Versioning.FrameworkName(".NETFramework", new Version(4, 5));
            _wfDesigner.Context.Services.GetService <DesignerConfigurationService>().LoadingFromUntrustedSourceEnabled = true;
            _wfDesigner.Context.Services.GetService <DesignerConfigurationService>().AutoConnectEnabled         = true;
            _wfDesigner.Context.Services.GetService <DesignerConfigurationService>().RubberBandSelectionEnabled = true;
            _wfDesigner.Context.Services.Publish <IExpressionEditorService>(_expressionEditorServiceVB);

            //associates all of the basic activities with their designers
            new DesignerMetadata().Register();

            //load Workflow Xaml
            _wfDesigner.Load(sourceFile);

            SelectHelper._wfDesigner = _wfDesigner;
            if (!SelectHelper.WorkflowDictionary.ContainsKey(sourceFile))
            {
                SelectHelper.WorkflowDictionary.Add(sourceFile, _wfDesigner);
            }
            else
            {
                SelectHelper.WorkflowDictionary[sourceFile] = _wfDesigner;
            }
            if (!SelectHelper.RuntimeApplicationHelperDictionary.ContainsKey(sourceFile))
            {
                SelectHelper.RuntimeApplicationHelperDictionary.Add(sourceFile, new RuntimeApplicationHelper());
            }

            WorkflowEntity workflowEntity = new WorkflowEntity();

            if (!SelectHelper.WorkflowEntityDictionary.ContainsKey(sourceFile))
            {
                SelectHelper.WorkflowEntityDictionary.Add(sourceFile, workflowEntity);
            }
            else
            {
                SelectHelper.WorkflowEntityDictionary[sourceFile] = workflowEntity;
            }
        }
        /// <summary>
        /// Creates a new Workflow Designer instance (VB) with Intellisense
        /// </summary>
        /// <param name="sourceFile">Workflow FileName</param>
        public static void NewInstanceVB(string sourceFile = _defaultWorkflow)
        {
            _expressionEditorServiceVB = new VbExpressionEditorService();

            _wfDesigner = new WorkflowDesigner();
            _wfDesigner.Context.Services.GetService <DesignerConfigurationService>().TargetFrameworkName = new System.Runtime.Versioning.FrameworkName(".NETFramework", new Version(4, 5));
            _wfDesigner.Context.Services.GetService <DesignerConfigurationService>().LoadingFromUntrustedSourceEnabled = true;
            _wfDesigner.Context.Services.Publish <IExpressionEditorService>(_expressionEditorServiceVB);

            //associates all of the basic activities with their designers
            new DesignerMetadata().Register();

            //load Workflow Xaml
            _wfDesigner.Load(sourceFile);
        }