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


C# Presentation.EditingContext类代码示例

本文整理汇总了C#中System.Activities.Presentation.EditingContext的典型用法代码示例。如果您正苦于以下问题:C# EditingContext类的具体用法?C# EditingContext怎么用?C# EditingContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EditingContext类属于System.Activities.Presentation命名空间,在下文中一共展示了EditingContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UndoEngine

 public UndoEngine(EditingContext context)
 {
     this.context = context;
     undoBuffer = new List<UndoUnit>(capacity);
     redoBuffer = new List<UndoUnit>(capacity);
     this.undoEngineImpl = this;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:UndoEngine.cs

示例2: Initialize

 public override void Initialize(EditingContext context, Type modelType)
 {
     Fx.Assert(context != null, "Context should not be null.");
     Fx.Assert(modelType != null, "modelType should not be null.");
     ValidationService validationService = context.Services.GetRequiredService<ValidationService>();
     validationService.RegisterValidationErrorSourceLocator(modelType, this.ValidationErrorSourceLocator);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:ValidationErrorSourceLocatorFeature.cs

示例3: TryMorphExpression

        public override bool TryMorphExpression(ActivityWithResult expression, bool isLocationExpression, Type newType, 
            EditingContext context, out ActivityWithResult newExpression)
        {
            Fx.Assert(expression != null, "Original expression shouldn't be null in morph helper");
            Fx.Assert(context != null, "EditingContext shouldn't be null in morph helper");
            newExpression = null;
            if (expression.ResultType == newType && 
                (ExpressionHelper.IsGenericLocationExpressionType(expression) == isLocationExpression))
            {
                newExpression = expression;
                return true;
            }

            if (context != null)
            {
                string expressionEditor = ExpressionHelper.GetRootEditorSetting(context.Services.GetService<ModelTreeManager>(), WorkflowDesigner.GetTargetFramework(context));
                ParserContext parserContext = new ParserContext();
                string expressionText = ExpressionHelper.GetExpressionString(expression, parserContext);
                if (!string.IsNullOrEmpty(expressionEditor))
                {
                    return ExpressionTextBox.TryConvertFromString(expressionEditor, expressionText, isLocationExpression, newType, out newExpression);
                }
            }

            return false;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:NonTextualExpressionMorphHelper.cs

示例4: CreateItem

        /// <summary>
        /// Creates a new model item by creating a deep copy of the isntance provided.
        /// </summary>
        /// <param name="context">
        /// The designer's editing context.
        /// </param>
        /// <param name="item">
        /// The item to clone.
        /// </param>
        /// <returns>
        /// The newly created item.
        /// </returns>
        public static ModelItem CreateItem(EditingContext context, object item) {
            if (context == null) throw FxTrace.Exception.ArgumentNull("context");
            if (item == null) throw FxTrace.Exception.ArgumentNull("item");

            ModelService ms = context.Services.GetRequiredService<ModelService>();
            return ms.InvokeCreateItem(item);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:19,代码来源:ModelFactory.cs

示例5: TryMorphExpression

 public override bool TryMorphExpression(ActivityWithResult expression, bool isLocationExpression, Type newType, 
     EditingContext context, out ActivityWithResult newExpression)
 {
     string expressionText = ExpressionHelper.GetExpressionString(expression);            
     newExpression = VisualBasicEditor.CreateExpressionFromString(newType, expressionText, isLocationExpression, new ParserContext());
     return true;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:VisualBasicExpressionMorphHelper.cs

示例6: Initialize

        public override void Initialize(EditingContext context)
        {
            this.context = context;
            AttachedPropertiesService propertiesService = this.context.Services.GetService<AttachedPropertiesService>();
            helpService = this.context.Services.GetService<IIntegratedHelpService>();

            oldSelection = this.context.Items.GetValue<Selection>();
            isPrimarySelectionProperty = new AttachedProperty<bool>()
                {
                    Getter = (modelItem) => (this.context.Items.GetValue<Selection>().PrimarySelection == modelItem),
                    Name = "IsPrimarySelection",
                    OwnerType = typeof(Object)
                };

            isSelectionProperty = new AttachedProperty<bool>()
            {
                Getter = (modelItem) => (((IList)this.context.Items.GetValue<Selection>().SelectedObjects).Contains(modelItem)),
                Name = "IsSelection",
                OwnerType = typeof(Object)
            };


            propertiesService.AddProperty(isPrimarySelectionProperty);
            propertiesService.AddProperty(isSelectionProperty);
            



            if (this.context.Services.GetService<ViewService>() == null)
            {
                view = new System.Activities.Presentation.View.DesignerView(this.context);
                WorkflowViewService viewService = new WorkflowViewService(context);
                WorkflowViewStateService viewStateService = new WorkflowViewStateService(context);
                this.context.Services.Publish<ViewService>(viewService);
                this.context.Services.Publish<VirtualizedContainerService>(new VirtualizedContainerService(this.context));
                this.context.Services.Publish<ViewStateService>(viewStateService);
                this.context.Services.Publish<DesignerView>(view);

                WorkflowAnnotationAdornerService annotationService = new WorkflowAnnotationAdornerService();
                annotationService.Initialize(this.context, view.scrollViewer);
                this.context.Services.Publish<AnnotationAdornerService>(annotationService);

                this.context.Services.Subscribe<ModelService>(delegate(ModelService modelService)
                {
                    this.modelService = modelService;
                    if (modelService.Root != null)
                    {
                        view.MakeRootDesigner(modelService.Root);
                    }
                    view.RestoreDesignerStates();
                    this.context.Items.Subscribe<Selection>(new SubscribeContextCallback<Selection>(OnItemSelected));
                });
            }

            if (helpService != null)
            {
                helpService.AddContextAttribute(string.Empty, KeywordForWorkflowDesignerHomePage, HelpKeywordType.F1Keyword); 
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:59,代码来源:WorkflowViewManager.cs

示例7: UndoUnit

 protected UndoUnit(EditingContext context)
 {
     if (context == null)
     {
         throw FxTrace.Exception.AsError(new ArgumentNullException("context"));
     }
     this.context = context;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:8,代码来源:UndoUnit.cs

示例8: WorkflowDesignerXamlSchemaContext

 public WorkflowDesignerXamlSchemaContext(string localAssembly, EditingContext editingContext)
 {
     if (!string.IsNullOrEmpty(localAssembly))
     {
         this.localAssemblyNsPostfix = XamlNamespaceHelper.ClrNamespaceAssemblyField + localAssembly;
         this.localAssemblyNsPostfixNoLeadingSemicolon = localAssemblyNsPostfix.Substring(1);
     }
     this.editingContext = editingContext;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:WorkflowDesignerXamlSchemaContext.cs

示例9: Initialize

 public override void Initialize(EditingContext context, Type modelType)
 {
     if (context.Services.GetService<DesignerConfigurationService>().TargetFrameworkName.IsLessThan45())
     {
         AttributeTableBuilder builder = new AttributeTableBuilder();
         builder.AddCustomAttributes(typeof(FlowSwitchDefaultLink<>), "DefaultCaseDisplayName", BrowsableAttribute.No);
         MetadataStore.AddAttributeTable(builder.CreateTable());
     }
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:9,代码来源:FlowSwitchDefaultLinkFeature.cs

示例10: CreateModelItem

        public static ModelItem CreateModelItem(object objectToMakeModelItem)
        {
            EditingContext ec = new EditingContext();
            ModelTreeManager mtm = new ModelTreeManager(ec);

            mtm.Load(objectToMakeModelItem);

            return mtm.Root;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:9,代码来源:TestModelItemUtil.cs

示例11: BookmarkUndoUnit

        public BookmarkUndoUnit(EditingContext context, ModelTreeManager modelTreeManager)
            : base(context)
        {
            Fx.Assert(modelTreeManager != null, "modelTreeManager cannot be null");

            this.modelTreeManager = modelTreeManager;
            this.DoList = new List<UndoUnit>();
            this.RedoList = new List<UndoUnit>();
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:BookmarkUndoUnit.cs

示例12: Initialize

 public override void Initialize(EditingContext context, Type modelType)
 {
     GenericArgumentUpdater genericArgumentUpdater = context.Services.GetService<GenericArgumentUpdater>();
     if (genericArgumentUpdater == null)
     {
         genericArgumentUpdater = new GenericArgumentUpdater(context);
         context.Services.Publish<GenericArgumentUpdater>(genericArgumentUpdater);
     }
     genericArgumentUpdater.AddSupportForUpdatingTypeArgument(modelType);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:UpdatableGenericsFeature.cs

示例13: ConvertNamespaces

        private static void ConvertNamespaces(object root, EditingContext context)
        {
            VisualBasicSettings settings = VisualBasic.GetSettings(root);
            IList<AssemblyReference> references;
            IList<string> importedNamespaces = NamespaceHelper.GetTextExpressionNamespaces(root, out references);
            FrameworkName targetFramework = WorkflowDesigner.GetTargetFramework(context);
            if (targetFramework.IsLessThan45())
            {
                if (settings == null)
                {
                    if ((importedNamespaces != null) && (importedNamespaces.Count > 0))
                    {
                        NamespaceHelper.ConvertToVBSettings(
                            importedNamespaces,
                            references,
                            context,
                            out settings);
                    }
                    else
                    {
                        settings = new VisualBasicSettings();
                    }

                    NamespaceHelper.SetVisualBasicSettings(root, settings);
                    NamespaceHelper.SetTextExpressionNamespaces(root, null, null);
                }

                IDebuggableWorkflowTree debuggableWorkflowTree = root as IDebuggableWorkflowTree;
                if (debuggableWorkflowTree != null)
                {
                    Activity rootActivity = debuggableWorkflowTree.GetWorkflowRoot();
                    if (rootActivity != null)
                    {
                        NamespaceHelper.SetVisualBasicSettings(rootActivity, settings);
                        NamespaceHelper.SetTextExpressionNamespaces(rootActivity, null, null);
                    }                 
                }
            }
            else
            {
                if ((importedNamespaces == null) || (importedNamespaces.Count == 0))
                {
                    if (settings != null)
                    {
                        NamespaceHelper.ConvertToTextExpressionImports(settings, out importedNamespaces, out references);
                        NamespaceHelper.SetTextExpressionNamespaces(root, importedNamespaces, references);
                        NamespaceHelper.SetVisualBasicSettings(root, null);
                    }
                    else
                    {
                        NamespaceHelper.SetTextExpressionNamespaces(root, new Collection<string>(), new Collection<AssemblyReference>());
                    }
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:55,代码来源:NamespaceSettingsHandler.cs

示例14: Delete

        public static void Delete(EditingContext context)
        {
            if (context == null)
            {
                throw FxTrace.Exception.AsError(new ArgumentNullException("context"));
            }
            Selection selection = context.Items.GetValue<Selection>();
            if (null != selection)
            {
                bool selectRoot = false;

                DesignerView designerView = context.Services.GetService<DesignerView>();
                var toDelete = selection.SelectedObjects.Where(p => null != p.View && p.View is WorkflowViewElement && !p.View.Equals(designerView.RootDesigner));
                if (toDelete.Count() > 0)
                {
                    using (EditingScope es = (EditingScope)toDelete.FirstOrDefault().BeginEdit(SR.DeleteOperationEditingScopeDescription))
                    {
                        Dictionary<ICompositeView, List<ModelItem>> containerToModelItemsDict = new Dictionary<ICompositeView, List<ModelItem>>();
                        List<ModelItem> modelItemsPerContainer;
                        foreach (var item in toDelete)
                        {
                            ICompositeView container = (ICompositeView)DragDropHelper.GetCompositeView((WorkflowViewElement)item.View);
                            if (null != container)
                            {
                                if (!containerToModelItemsDict.TryGetValue(container, out modelItemsPerContainer))
                                {
                                    modelItemsPerContainer = new List<ModelItem>();
                                    containerToModelItemsDict.Add(container, modelItemsPerContainer);
                                }
                                modelItemsPerContainer.Add(item);
                            }
                        }
                        foreach (ICompositeView container in containerToModelItemsDict.Keys)
                        {
                            container.OnItemsDelete(containerToModelItemsDict[container]);
                            selectRoot = true;
                        }

                        if (selectRoot)
                        {
                            DesignerView view = context.Services.GetService<DesignerView>();
                            if (null != view)
                            {
                                WorkflowViewElement rootView = view.RootDesigner as WorkflowViewElement;
                                if (rootView != null)
                                {
                                    Selection.SelectOnly(context, rootView.ModelItem);
                                }
                            }
                        }
                        es.Complete();
                    }
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:55,代码来源:DeleteHelper.cs

示例15: ObjectReferenceService

        /// <summary>
        /// This interface is used by visual studio integration to acquire a AppDomain serialization friendly reference to an object.
        /// </summary>
        /// <param name="context">The EditingContext of the current WorkflowDesigner.</param>
        public ObjectReferenceService(EditingContext context)
        {
            if (context == null)
            {
                throw FxTrace.Exception.AsError(new ArgumentNullException("context"));
            }

            this.context = context;
            this.context.Services.Subscribe<ModelSearchService>(new SubscribeServiceCallback<ModelSearchService>(this.OnModelSearchServiceAvailable));
            this.context.Services.Subscribe<ModelTreeManager>(new SubscribeServiceCallback<ModelTreeManager>(this.OnModelTreeManagerAvailable));
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:ObjectReferenceService.cs


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