UndoUnit.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / UndoUnit.cs / 1305376 / UndoUnit.cs

                            //---------------------------------------------------------------- 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//---------------------------------------------------------------

namespace System.Activities.Presentation 
{
    using System; 
    using System.Collections.Generic; 
    using System.Text;
    using System.Activities.Presentation.View; 
    using System.Activities.Presentation.Model;

    public abstract class UndoUnit
    { 
        EditingContext context;
        ModelItem designerRoot; 
 
        public string Description { get; set; }
        public abstract void Redo(); 
        public abstract void Undo();

        protected UndoUnit(EditingContext context)
        { 
            if (context == null)
            { 
                throw FxTrace.Exception.AsError(new ArgumentNullException("context")); 
            }
            this.context = context; 
        }
        protected void SaveGlobalState()
        {
            DesignerView designerView = context.Services.GetService(); 
            if (designerView != null && designerView.RootDesigner != null)
            { 
                designerRoot = ((WorkflowViewElement)designerView.RootDesigner).ModelItem; 
            }
        } 

        protected void ApplyGlobalState()
        {
            DesignerView designerView = context.Services.GetService(); 
            if (designerView != null && designerView.RootDesigner != null)
            { 
                ModelItem currentDesignerRoot = ((WorkflowViewElement)designerView.RootDesigner).ModelItem; 
                if (currentDesignerRoot != designerRoot)
                { 
                    designerView.MakeRootDesigner(designerRoot);
                }
            }
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//---------------------------------------------------------------- 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//---------------------------------------------------------------

namespace System.Activities.Presentation 
{
    using System; 
    using System.Collections.Generic; 
    using System.Text;
    using System.Activities.Presentation.View; 
    using System.Activities.Presentation.Model;

    public abstract class UndoUnit
    { 
        EditingContext context;
        ModelItem designerRoot; 
 
        public string Description { get; set; }
        public abstract void Redo(); 
        public abstract void Undo();

        protected UndoUnit(EditingContext context)
        { 
            if (context == null)
            { 
                throw FxTrace.Exception.AsError(new ArgumentNullException("context")); 
            }
            this.context = context; 
        }
        protected void SaveGlobalState()
        {
            DesignerView designerView = context.Services.GetService(); 
            if (designerView != null && designerView.RootDesigner != null)
            { 
                designerRoot = ((WorkflowViewElement)designerView.RootDesigner).ModelItem; 
            }
        } 

        protected void ApplyGlobalState()
        {
            DesignerView designerView = context.Services.GetService(); 
            if (designerView != null && designerView.RootDesigner != null)
            { 
                ModelItem currentDesignerRoot = ((WorkflowViewElement)designerView.RootDesigner).ModelItem; 
                if (currentDesignerRoot != designerRoot)
                { 
                    designerView.MakeRootDesigner(designerRoot);
                }
            }
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.

                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK