本文整理汇总了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();
}
}
}
示例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();
}
}
示例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;
}
示例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;
}