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


C# ModelItem.BeginEdit方法代码示例

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


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

示例1: ShowDialog

        public void ShowDialog(ModelItem modelItem, EditingContext context)
        {
            Fx.Assert(modelItem != null, "Activity model item shouldn't be null!");
            Fx.Assert(context != null, "EditingContext shouldn't be null!");


            string bookmarkTitle = (string)this.InlineEditorTemplate.Resources["bookmarkTitle"];

            UndoEngine undoEngine = context.Services.GetService<UndoEngine>();
            Fx.Assert(null != undoEngine, "UndoEngine should be available");

            using (ModelEditingScope editingScope = modelItem.BeginEdit(bookmarkTitle, shouldApplyChangesImmediately: true))
            {
                if ((new EditorWindow(modelItem, context)).ShowOkCancel())
                {
                    editingScope.Complete();
                }
                else
                {
                    editingScope.Revert();
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:23,代码来源:CorrelationInitializerValueEditor.cs

示例2: SetAutoSplitDataWithUndo

 private static void SetAutoSplitDataWithUndo(
     ModelItem fcModelItem,
     ModelItem srcModelItem,
     ModelItem destModelItem,
     int srcIndex,
     int destIndex,
     EdgeLocation entryEdgeForAutoSplit,
     EdgeLocation exitEdgeForAutoSplit)
 {
     using (EditingScope es = (EditingScope)fcModelItem.BeginEdit(SR.AutoSplit, false))
     {
         es.Changes.Add(
             new SetAutoSplitConnectionPointChange(
                 fcModelItem,
                 srcModelItem,
                 destModelItem,
                 srcIndex,
                 destIndex,
                 entryEdgeForAutoSplit,
                 exitEdgeForAutoSplit
                 ));
         es.Complete();
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:24,代码来源:FlowchartDesigner.xaml.cs

示例3: OnAddAnnotationCommandExecuted

        public static void OnAddAnnotationCommandExecuted(ExecutedRoutedEventArgs e, ModelItem modelItem)
        {
            ModelProperty property = modelItem.Properties.Find(Annotation.AnnotationTextPropertyName);
            if (property != null)
            {
                using (ModelEditingScope editingScope = modelItem.BeginEdit(SR.AddAnnotationDescription))
                {
                    property.SetValue(string.Empty);
                    ViewStateService viewStateService = modelItem.GetEditingContext().Services.GetService<ViewStateService>();
                    viewStateService.StoreViewStateWithUndo(modelItem, Annotation.IsAnnotationDockedViewStateName, false);
                    editingScope.Complete();
                }

                if (modelItem.View != null)
                {
                    WorkflowViewElement element = modelItem.View as WorkflowViewElement;
                    if (element != null)
                    {
                        element.OnEditAnnotation();
                    }
                }
            }

            e.Handled = true;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:25,代码来源:ContextMenuUtilities.cs

示例4: OnDeleteAnnotationCommandExecuted

        public static void OnDeleteAnnotationCommandExecuted(ExecutedRoutedEventArgs e, ModelItem modelItem)
        {
            using (ModelEditingScope editingScope = modelItem.BeginEdit(SR.DeleteAnnotationDescription))
            {
                modelItem.Properties[Annotation.AnnotationTextPropertyName].SetValue(null);
                ViewStateService viewStateService = modelItem.GetEditingContext().Services.GetService<ViewStateService>();
                viewStateService.StoreViewStateWithUndo(modelItem, Annotation.IsAnnotationDockedViewStateName, null);
                editingScope.Complete();
            }

            e.Handled = true;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:ContextMenuUtilities.cs


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