1 '---------------------------------------------------------------------
2 ' This file is part of the Windows Workflow Foundation SDK Code Samples.
4 ' Copyright (C) Microsoft Corporation. All rights reserved.
6 'This source code is intended only as a supplement to Microsoft
7 'Development Tools and/or on-line documentation. See these other
8 'materials for detailed information regarding Microsoft code samples.
10 'THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
11 'KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12 'IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
14 '---------------------------------------------------------------------
18 Imports System
.Collections
19 Imports System
.ComponentModel
.Design
.Serialization
20 Imports System
.Workflow
.ComponentModel
.Serialization
21 Imports System
.Runtime
.InteropServices
24 Public Class StackSerializer
25 Inherits WorkflowMarkupSerializer
26 Implements IDesignerSerializationProvider
28 Protected Overrides
Sub AddChild(ByVal serializationManager
As WorkflowMarkupSerializationManager
, ByVal parentObject
As Object, ByVal childObject
As Object)
30 If parentObject Is
Nothing Then
31 Throw
New ArgumentNullException("parentObject")
34 If (childObject Is
Nothing) Then
35 Throw
New ArgumentNullException("childObject")
38 Dim stack
As Stack
= TryCast(parentObject
, Stack
)
40 If stack Is
Nothing Then
41 Throw
New Exception(String.Format("The type of parentObject is not {0}", GetType(Stack
).FullName
))
44 stack
.Push(childObject
)
47 Protected Overrides
Function GetChildren(ByVal serializationManager
As WorkflowMarkupSerializationManager
, ByVal obj
As Object) As IList
49 If obj Is
Nothing Then
50 Throw
New ArgumentNullException("obj")
53 Dim stack
As Stack
= TryCast(obj
, Stack
)
55 If stack Is
Nothing Then
56 Throw
New Exception(String.Format("The type of obj is not {0}", GetType(Stack
).FullName
))
59 Dim arrayList
As New ArrayList(stack
.ToArray())
65 #Region
"IDesignerSerializationProvider Members"
66 Public Function GetSerializer(ByVal manager
As System
.ComponentModel
.Design
.Serialization
.IDesignerSerializationManager
, ByVal currentSerializer
As Object, ByVal objectType
As System
.Type, ByVal serializerType
As System
.Type) As Object Implements System
.ComponentModel
.Design
.Serialization
.IDesignerSerializationProvider
.GetSerializer
67 If objectType Is
GetType(Stack
) Then
70 Return currentSerializer