当前位置: 首页>>代码示例>>C#>>正文


C# DesignSurface.BeginLoad方法代码示例

本文整理汇总了C#中System.ComponentModel.Design.DesignSurface.BeginLoad方法的典型用法代码示例。如果您正苦于以下问题:C# DesignSurface.BeginLoad方法的具体用法?C# DesignSurface.BeginLoad怎么用?C# DesignSurface.BeginLoad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ComponentModel.Design.DesignSurface的用法示例。


在下文中一共展示了DesignSurface.BeginLoad方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateWorkflowView

        /// <summary>
        /// Creates the workflow view.
        /// </summary>
        /// <param name="workflow">The workflow.</param>
        /// <returns></returns>
        public static WorkflowView CreateWorkflowView(Activity workflow)
        {
            if (workflow == null)
                throw new ArgumentNullException("workflow");

            WorkflowLoader loader = new WorkflowLoader(workflow);

            DesignSurface surface = new DesignSurface();
            surface.BeginLoad(loader);

            WorkflowView retVal = new WorkflowView(surface);

            return retVal;
        }
开发者ID:0anion0,项目名称:IBN,代码行数:19,代码来源:GlobalWorkflowRuntime.cs

示例2: Form1

        public Form1()
        {
            InitializeComponent();

            // ���[�N�t���[�v���W�F�N�g�̃p�X��擾
            projectpath = Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\CustomWorkflowLibrary");

            // ���[�N�t���[�f�U�C�i�[�̏�����
            this.designSurface = new DesignSurface();
            loader = new MyWorkflowLoader(Path.Combine(projectpath, "Workflow1.xoml"));
            designSurface.BeginLoad(loader);

            this.workflowView = new WorkflowView((IServiceProvider) this.designSurface);
            splitContainer1.Panel1.Controls.Add(this.workflowView);
            this.workflowView.Dock = DockStyle.Fill;

            IDesignerHost designerHost = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
            designerHost.Activate();

            // �R���e�L�X�g���j���[�̕\��
            IMenuCommandService menuService = new WorkflowMenuCommandService((IServiceProvider)workflowView);
            designerHost.AddService(typeof(IMenuCommandService), menuService);

            // �Q�Ƃ���A�Z���u�� (�ꕔ) ��ݒ�
            // (�p�����[�^�� Validation �`�F�b�N�Ȃǂ̍ۂɁA���̃A�Z���u������ɂ�������)
            TypeProvider typeProvider = new TypeProvider((IServiceProvider)workflowView);
            typeProvider.AddAssemblyReference(@"..\..\..\CustomWorkflowLibrary\bin\Debug\CustomWorkflowLibrary.dll");
            designerHost.AddService(typeof(ITypeProvider), typeProvider);

            // (.NET 3.5 ReceiveActivity �� ServiceOperationInfo �𐳂����ݒ肵�Ȃ� (Validation Error �ƂȂ�) ���߈ȉ���lj�)
            SequentialWorkflowActivity rootActivity = (SequentialWorkflowActivity)designerHost.RootComponent;
            ReceiveActivity receiveActivity = (ReceiveActivity)rootActivity.Activities[0];
            TypedOperationInfo typedOperationInfo = new TypedOperationInfo();
            typedOperationInfo.ContractType = typeof(CustomWorkflowLibrary.IWorkflow1);
            typedOperationInfo.Name = "CalcData";
            receiveActivity.ServiceOperationInfo = typedOperationInfo;
        }
开发者ID:tsmatsuz,项目名称:20080826_CustomWorkflowService,代码行数:37,代码来源:Form1.cs

示例3: LoadWorkflow

        private void LoadWorkflow()
        {
            SuspendLayout();
            
            DesignSurface designSurface = new DesignSurface();
            WorkflowLoader loader = new WorkflowLoader();
            loader.WorkflowType = workflowTypeValue;
            loader.Xaml = xamlValue;            
            designSurface.BeginLoad(loader);

            IDesignerHost designerHost = designSurface.GetService(typeof(IDesignerHost)) as IDesignerHost;
            if (designerHost != null && designerHost.RootComponent != null)
            {
                IRootDesigner rootDesigner = designerHost.GetDesigner(designerHost.RootComponent) as IRootDesigner;
                if (rootDesigner != null)
                {
                    UnloadWorkflow();

                    this.designSurface = designSurface;
                    this.loader = loader;
                    this.workflowView = rootDesigner.GetView(ViewTechnology.Default) as WorkflowView;
                    this.panel1.Controls.Add(this.workflowView);
                    this.workflowView.Dock = DockStyle.Fill;
                    this.workflowView.TabIndex = 1;
                    this.workflowView.TabStop = true;
                    this.workflowView.HScrollBar.TabStop = false;
                    this.workflowView.VScrollBar.TabStop = false;
                    this.workflowView.Focus();
                    this.workflowView.FitToScreenSize();
                }
            }

            ResumeLayout(true);            
        }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:34,代码来源:WorkflowDesignerControl.cs

示例4: LoadDesigner

		void LoadDesigner (Stream stream) {
			LoggingService.Info("ReportDesigner LoadDesigner_Start");
			panel = CreatePanel();
			defaultServiceContainer = CreateAndInitServiceContainer();
			
			LoggingService.Info("Create DesignSurface and add event's");
			designSurface = CreateDesignSurface(defaultServiceContainer);
			SetDesignerEvents();
			
			var ambientProperties = new AmbientProperties();
			defaultServiceContainer.AddService(typeof(AmbientProperties), ambientProperties);
			
			defaultServiceContainer.AddService(typeof(ITypeResolutionService), new TypeResolutionService());
			defaultServiceContainer.AddService(typeof(ITypeDiscoveryService),new TypeDiscoveryService());
			                                   
			defaultServiceContainer.AddService(typeof(IMenuCommandService),
				new ICSharpCode.Reporting.Addin.Services.MenuCommandService(panel, designSurface));
			
			defaultServiceContainer.AddService(typeof(MemberRelationshipService),new DefaultMemberRelationshipService());
			defaultServiceContainer.AddService(typeof(OpenedFile),base.PrimaryFile);
			
			LoggingService.Info("Load DesignerOptionService");
			var designerOptionService = CreateDesignerOptions();
			defaultServiceContainer.AddService( typeof( DesignerOptionService ), designerOptionService );
			
			LoggingService.Info("Create ReportDesignerLoader"); 
			
			loader = new ReportDesignerLoader(generator, stream);
			designSurface.BeginLoad(this.loader);
			if (!designSurface.IsLoaded) {
				//				throw new FormsDesignerLoadException(FormatLoadErrors(designSurface));
				LoggingService.Error("designer not loaded");
			}
			//-------------
			
			defaultServiceContainer.AddService(typeof(INameCreationService),new NameCreationService());
			                                   
			
			var selectionService = (ISelectionService)this.designSurface.GetService(typeof(ISelectionService));
			selectionService.SelectionChanged  += SelectionChangedHandler;
			/*
			undoEngine = new ReportDesignerUndoEngine(Host);
			*/
			var componentChangeService = (IComponentChangeService)this.designSurface.GetService(typeof(IComponentChangeService));
			
			
			componentChangeService.ComponentChanged += OnComponentChanged;
			componentChangeService.ComponentAdded   += OnComponentListChanged;
			componentChangeService.ComponentRemoved += OnComponentListChanged;
			componentChangeService.ComponentRename  += OnComponentListChanged;
			
			this.Host.TransactionClosed += TransactionClose;
		
			UpdatePropertyPad();
	
			hasUnmergedChanges = false;
			
			LoggingService.Info("ReportDesigner LoadDesigner_End");
		}	
开发者ID:krunalc,项目名称:SharpDevelop,代码行数:59,代码来源:DesignerView.cs

示例5: Parse

        /// <summary>
        /// Parse�������ı����������ô洢�������� CodeCompileUnit��
        /// �� CodeDomDesignerLoader ��Ҫ����Դ����ʱ������� Parse ������
        /// ����ͨ��������ָ��Դ�����λ�ú͸�ʽ��
        /// ���������װ��Form�����Ե�ǰ��Ƹ��������������
        /// </summary>
        /// ����ֵ���ӷ����������ɵ� CodeCompileUnit��
        /// <returns></returns>
        protected override CodeCompileUnit Parse()
        {
            CodeCompileUnit compileUnit = null;
            DesignSurface designSurface = new DesignSurface();

            designSurface.BeginLoad(typeof(CassView));

            IDesignerHost designerHost = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
            designerHost.RootComponent.Site.Name = currentForm;

            compileUnit = GetCodeCompileUnit(designerHost);

            AssemblyName[] names = Assembly.GetExecutingAssembly().GetReferencedAssemblies();
            for (int i = 0; i < names.Length; i++)
            {
                Assembly assembly = Assembly.Load(names[i]);
                compileUnit.ReferencedAssemblies.Add(assembly.Location);
            }

            codeCompileUnit = compileUnit;
            return compileUnit;
        }
开发者ID:alloevil,项目名称:A-embedded-image-processing-platform--,代码行数:30,代码来源:CodeDomHostLoader.cs

示例6: LoadDesigner

		public void LoadDesigner(string formFile)
		{
            UnloadDesigner();
			DefaultServiceContainer serviceContainer = new DefaultServiceContainer();
			serviceContainer.AddService(typeof(System.Windows.Forms.Design.IUIService), new UIService());
			serviceContainer.AddService(typeof(System.Drawing.Design.IToolboxService), ToolboxProvider.ToolboxService);
			
			serviceContainer.AddService(typeof(IHelpService), new HelpService());
			serviceContainer.AddService(typeof(System.Drawing.Design.IPropertyValueUIService), new PropertyValueUIService());
			
			AmbientProperties ambientProperties = new AmbientProperties();
			serviceContainer.AddService(typeof(AmbientProperties), ambientProperties);
			this.typeResolutionService = new TypeResolutionService();
			serviceContainer.AddService(typeof(ITypeResolutionService), this.typeResolutionService);
			serviceContainer.AddService(typeof(DesignerOptionService), new SharpDevelopDesignerOptionService());
			serviceContainer.AddService(typeof(ITypeDiscoveryService), new TypeDiscoveryService());
			serviceContainer.AddService(typeof(MemberRelationshipService), new DefaultMemberRelationshipService());
			
			designSurface = CreateDesignSurface(serviceContainer);
			designSurface.Loading += this.DesignerLoading;
			designSurface.Loaded += this.DesignerLoaded;
			designSurface.Flushed += this.DesignerFlushed;
			designSurface.Unloading += this.DesignerUnloading;

            designerResourceService = new DesignerResourceService(this);//roman//
			serviceContainer.AddService(typeof(System.ComponentModel.Design.IResourceService), designerResourceService);
            loader = new CodeDomHostLoader(this.Host, formFile, FileName);

			serviceContainer.AddService(typeof(System.ComponentModel.Design.IMenuCommandService), new ICSharpCode.FormsDesigner.Services.MenuCommandService(Host));
			ICSharpCode.FormsDesigner.Services.EventBindingService eventBindingService = new ICSharpCode.FormsDesigner.Services.EventBindingService(Host);
			serviceContainer.AddService(typeof(System.ComponentModel.Design.IEventBindingService), eventBindingService);
			
            designSurface.BeginLoad(loader);
			
			if (!designSurface.IsLoaded) {
				throw new FormsDesignerLoadException(FormatLoadErrors(designSurface));
			}
			
			undoEngine = new FormsDesignerUndoEngine(Host);
			serviceContainer.AddService(typeof(UndoEngine), undoEngine);
			
			IComponentChangeService componentChangeService = (IComponentChangeService)designSurface.GetService(typeof(IComponentChangeService));
			componentChangeService.ComponentChanged += ComponentChanged;
			componentChangeService.ComponentAdded   += ComponentListChanged;
			componentChangeService.ComponentRemoved += ComponentListChanged;
			componentChangeService.ComponentRename  += ComponentListChanged;
			this.Host.TransactionClosed += TransactionClose;
			
			ISelectionService selectionService = (ISelectionService)designSurface.GetService(typeof(ISelectionService));
			selectionService.SelectionChanged  += SelectionChangedHandler;
			
			if (IsTabOrderMode) { // fixes SD2-1015
				tabOrderMode = false; // let ShowTabOrder call the designer command again
				ShowTabOrder();
			}
			
			UpdatePropertyPad();
			
			hasUnmergedChanges = false;
            MakeDirty();

            PropertyGrid grid = PropertyPad.Grid;
            
            var gridView = (Control)grid.GetType().GetField("gridView", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(grid);
            var edit = (Control)gridView.GetType().GetField("edit", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(gridView);
            edit.KeyPress += PropertyPadEditorKeyPress;
            edit.ContextMenu = new ContextMenu();
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:68,代码来源:DesignerViewContent.cs

示例7: LoadDesigner

		void LoadDesigner()
		{
			LoggingService.Info("Form Designer: BEGIN INITIALIZE");
			
			DefaultServiceContainer serviceContainer = new DefaultServiceContainer();
			serviceContainer.AddService(typeof(System.Windows.Forms.Design.IUIService), new UIService());
			serviceContainer.AddService(typeof(System.Drawing.Design.IToolboxService), ToolboxProvider.ToolboxService);
			
			serviceContainer.AddService(typeof(IHelpService), new HelpService());
			serviceContainer.AddService(typeof(System.Drawing.Design.IPropertyValueUIService), new PropertyValueUIService());
			
			serviceContainer.AddService(typeof(System.ComponentModel.Design.IResourceService), new DesignerResourceService(this.resourceStore));
			AmbientProperties ambientProperties = new AmbientProperties();
			serviceContainer.AddService(typeof(AmbientProperties), ambientProperties);
			this.typeResolutionService = new TypeResolutionService(this.PrimaryFileName);
			serviceContainer.AddService(typeof(ITypeResolutionService), this.typeResolutionService);
			serviceContainer.AddService(typeof(DesignerOptionService), new SharpDevelopDesignerOptionService());
			serviceContainer.AddService(typeof(ITypeDiscoveryService), new TypeDiscoveryService());
			serviceContainer.AddService(typeof(MemberRelationshipService), new DefaultMemberRelationshipService());
			serviceContainer.AddService(typeof(ProjectResourceService), new ProjectResourceService(ParserService.GetParseInformation(this.DesignerCodeFile.FileName).CompilationUnit.ProjectContent));
			
			// Provide the ImageResourceEditor for all Image and Icon properties
			this.addedTypeDescriptionProviders.Add(typeof(Image), TypeDescriptor.AddAttributes(typeof(Image), new EditorAttribute(typeof(ImageResourceEditor), typeof(System.Drawing.Design.UITypeEditor))));
			this.addedTypeDescriptionProviders.Add(typeof(Icon), TypeDescriptor.AddAttributes(typeof(Icon), new EditorAttribute(typeof(ImageResourceEditor), typeof(System.Drawing.Design.UITypeEditor))));
			
			if (generator.CodeDomProvider != null) {
				serviceContainer.AddService(typeof(System.CodeDom.Compiler.CodeDomProvider), generator.CodeDomProvider);
			}
			
			designSurface = CreateDesignSurface(serviceContainer);
			designSurface.Loading += this.DesignerLoading;
			designSurface.Loaded += this.DesignerLoaded;
			designSurface.Flushed += this.DesignerFlushed;
			designSurface.Unloading += this.DesignerUnloading;
			
			serviceContainer.AddService(typeof(System.ComponentModel.Design.IMenuCommandService), new ICSharpCode.FormsDesigner.Services.MenuCommandService(this, designSurface));
			ICSharpCode.FormsDesigner.Services.EventBindingService eventBindingService = new ICSharpCode.FormsDesigner.Services.EventBindingService(this, designSurface);
			serviceContainer.AddService(typeof(System.ComponentModel.Design.IEventBindingService), eventBindingService);
			
			this.loader = loaderProvider.CreateLoader(generator);
			designSurface.BeginLoad(this.loader);
			
			if (!designSurface.IsLoaded) {
				throw new FormsDesignerLoadException(FormatLoadErrors(designSurface));
			}
			
			undoEngine = new FormsDesignerUndoEngine(Host);
			serviceContainer.AddService(typeof(UndoEngine), undoEngine);
			
			IComponentChangeService componentChangeService = (IComponentChangeService)designSurface.GetService(typeof(IComponentChangeService));
			componentChangeService.ComponentChanged += ComponentChanged;
			componentChangeService.ComponentAdded   += ComponentListChanged;
			componentChangeService.ComponentRemoved += ComponentListChanged;
			componentChangeService.ComponentRename  += ComponentListChanged;
			this.Host.TransactionClosed += TransactionClose;
			
			ISelectionService selectionService = (ISelectionService)designSurface.GetService(typeof(ISelectionService));
			selectionService.SelectionChanged  += SelectionChangedHandler;
			
			if (IsTabOrderMode) { // fixes SD2-1015
				tabOrderMode = false; // let ShowTabOrder call the designer command again
				ShowTabOrder();
			}
			
			UpdatePropertyPad();
			
			hasUnmergedChanges = false;
			
			LoggingService.Info("Form Designer: END INITIALIZE");
		}
开发者ID:siegfriedpammer,项目名称:SharpDevelop,代码行数:70,代码来源:DesignerViewContent.cs

示例8: Parse

        /// <summary>
        /// Bootstrap method - loads a blank Form
        /// </summary>
        /// <returns></returns>
        protected override CodeCompileUnit Parse()
        {
            if (formFile == null)
            {
                CodeCompileUnit ccu = null;

                DesignSurface ds = new DesignSurface();
                ds.BeginLoad(typeof(Form));
                IDesignerHost idh = (IDesignerHost)ds.GetService(typeof(IDesignerHost));
                idh.RootComponent.Site.Name = GetNextFormName();

                cg = new CodeGen();
                ccu = cg.GetCodeCompileUnit(idh);

                AssemblyName[] names = Assembly.GetExecutingAssembly().GetReferencedAssemblies();
                for (int i = 0; i < names.Length; i++)
                {
                    Assembly assembly = Assembly.Load(names[i]);
                    ccu.ReferencedAssemblies.Add(assembly.Location);
                }

                codeCompileUnit = ccu;
                Designer = ds;
                codeCompileUnit = ccu;
                return ccu;
            }
            else
            {
                FileStream fs = new FileStream(formFile, FileMode.Open);
                BinaryFormatter formatter = new BinaryFormatter();
                CodeCompileUnit ccu = (CodeCompileUnit)formatter.Deserialize(fs);
                fs.Close();
                codeCompileUnit = ccu;
                return ccu;
            }
        }
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:40,代码来源:CodeDomHostLoader.cs


注:本文中的System.ComponentModel.Design.DesignSurface.BeginLoad方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。