• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Presentation.EditingContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: CreateStartSymbol

 public static StartSymbol CreateStartSymbol(EditingContext context)
 {
     StartSymbol start = new StartSymbol();
     FakeRoot fakeRoot = new FakeRoot { StartNode = new StartNode() };
     ModelTreeManager manager = context.Services.GetService<ModelTreeManager>();
     start.ModelItem = new FakeModelItemImpl(manager, typeof(FakeRoot), fakeRoot, null).Properties["StartNode"].Value;
     start.Name = "StartSymbol";
     start.Focusable = true;
     start.Context = context;
     start.DataContext = start;
     return start;
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:12,代码来源:StartSymbol.xaml.cs


示例17: OnDeleteAnnotationCommandCanExecute

        public static void OnDeleteAnnotationCommandCanExecute(CanExecuteRoutedEventArgs e, EditingContext editingContext, ModelItem modelItem)
        {
            e.Handled = true;

            if (modelItem == null || !DesignerConfigurationServiceUtilities.IsAnnotationEnabled(editingContext) || EditingContextUtilities.IsReadOnly(editingContext))
            {
                e.CanExecute = false;
                return;
            }

            e.CanExecute = modelItem.HasAnnotation();
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:ContextMenuUtilities.cs


示例18: IsBackgroundValidationEnabled

        public static bool IsBackgroundValidationEnabled(EditingContext editingContext)
        {
            Fx.Assert(editingContext != null, "editingContext should not be null");
            DesignerConfigurationService config = editingContext.Services.GetService<DesignerConfigurationService>();

            if (config != null)
            {
                return config.BackgroundValidationEnabled;
            }

            return false;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:DesignerConfigurationServiceUtilities.cs


示例19: ReceiveContentDialog

 ReceiveContentDialog(ModelItem activity, EditingContext context, DependencyObject owner)
     : this()
 {
     this.ModelItem = activity;
     this.Context = context;
     this.HelpKeyword = HelpKeywords.MessageContentDialog;
     this.Owner = owner;
     this.ViewModel = new ContentDialogViewModel<ReceiveMessageContent, ReceiveParametersContent>(this.ModelItem);
     if (!this.Context.Items.GetValue<ReadOnlyState>().IsReadOnly)
     {
         this.OnOk = this.ViewModel.OnOk;
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:13,代码来源:ReceiveContentDialog.xaml.cs


示例20: GetTargetFramework

        static internal FrameworkName GetTargetFramework(EditingContext context)
        {
            if (context != null)
            {
                DesignerConfigurationService designerConfigurationService = context.Services.GetService<DesignerConfigurationService>();
                if (designerConfigurationService != null)
                {
                    return designerConfigurationService.TargetFrameworkName;
                }
            }

            return DesignerConfigurationService.DefaultTargetFrameworkName;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:13,代码来源:WorkflowDesigner.Helpers.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Model.ModelItem类代码示例发布时间:2022-05-26
下一篇:
C# Activities.WorkflowApplication类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap