Ejemplo n.º 1
0
        internal static EditingScope TryCreateImmediateEditingScope(ModelTreeManager manager, string editingScopeDescription)
        {
            if (manager.CanCreateImmediateEditingScope())
            {
                return(manager.CreateEditingScope(editingScopeDescription, true));
            }

            return(null);
        }
Ejemplo n.º 2
0
        internal static EditingScope TryCreateImmediateEditingScope(ModelTreeManager manager, string editingScopeDescription)
        {
            if (manager.CanCreateImmediateEditingScope())
            {
                return manager.CreateEditingScope(editingScopeDescription, true);
            }

            return null;
        }
Ejemplo n.º 3
0
        internal static void TryCreateImmediateEditingScopeAndExecute(EditingContext context, string editingScopeDescription, Action <EditingScope> modelEditingWork)
        {
            Fx.Assert(context != null, "context should not be null.");
            Fx.Assert(modelEditingWork != null, "modelEditingWork should not be null.");

            ModelTreeManager manager = context.Services.GetRequiredService <ModelTreeManager>();

            if (manager.CanCreateImmediateEditingScope())
            {
                using (EditingScope editingScope = manager.CreateEditingScope(editingScopeDescription, true))
                {
                    modelEditingWork(editingScope);
                }
            }
            else
            {
                modelEditingWork(null);
            }
        }