BookmarkScopeHandle.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / BookmarkScopeHandle.cs / 1305376 / BookmarkScopeHandle.cs

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

namespace System.Activities 
{
    using System; 
    using System.Runtime; 
    using System.Runtime.Serialization;
 
    [DataContract]
    public sealed class BookmarkScopeHandle : Handle
    {
        [DataMember(EmitDefaultValue = false)] 
        BookmarkScope bookmarkScope;
 
        static BookmarkScopeHandle defaultBookmarkScopeHandle = new BookmarkScopeHandle(BookmarkScope.Default); 

        public BookmarkScopeHandle() 
        {
        }

        internal BookmarkScopeHandle(BookmarkScope bookmarkScope) 
        {
            this.bookmarkScope = bookmarkScope; 
        } 

        public static BookmarkScopeHandle Default 
        {
            get
            {
                return defaultBookmarkScopeHandle; 
            }
        } 
 
        public BookmarkScope BookmarkScope
        { 
            get
            {
                return this.bookmarkScope;
            } 
        }
 
        //To be called from public APIs that need to verify the passed in context 
        void ThrowIfContextIsNullOrDisposed(NativeActivityContext context)
        { 
            if (context == null)
            {
                throw FxTrace.Exception.ArgumentNull("context");
            } 

            context.ThrowIfDisposed(); 
        } 

        public void CreateBookmarkScope(NativeActivityContext context) 
        {
            this.ThrowIfContextIsNullOrDisposed(context);
            if (this.bookmarkScope != null)
            { 
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.CreateBookmarkScopeFailed));
            } 
 
            this.ThrowIfUninitialized();
            this.bookmarkScope = context.CreateBookmarkScope(Guid.Empty, this); 
        }

        public void CreateBookmarkScope(NativeActivityContext context, Guid scopeId)
        { 
            this.ThrowIfContextIsNullOrDisposed(context);
            if (this.bookmarkScope != null) 
            { 
                throw FxTrace.Exception.AsError(new InvalidOperationException(SR.CreateBookmarkScopeFailed));
            } 

            this.ThrowIfUninitialized();
            this.bookmarkScope = context.CreateBookmarkScope(scopeId, this);
        } 

        public void Initialize(NativeActivityContext context, Guid scope) 
        { 
            this.ThrowIfContextIsNullOrDisposed(context);
            this.ThrowIfUninitialized(); 
            this.bookmarkScope.Initialize(context, scope);
        }
    }
} 

 

// 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