1 //------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //------------------------------------------------------------
5 using System.Collections;
6 using System.Collections.Generic;
8 using System.Diagnostics;
9 using System.Globalization;
10 using System.Workflow.ComponentModel;
11 using System.Runtime.Serialization;
13 namespace System.Workflow.Runtime
16 internal sealed class EventQueueState
18 Queue deliveredMessages;
19 List<ActivityExecutorDelegateInfo<QueueEventArgs>> synchronousListeners;
20 List<ActivityExecutorDelegateInfo<QueueEventArgs>> asynchronousListeners;
22 bool transactional = true;
25 internal IComparable queueName;
28 bool dirty = false; // dirty flag set to true until a transaction completes
30 internal EventQueueState()
32 this.deliveredMessages = new Queue();
33 this.synchronousListeners = new List<ActivityExecutorDelegateInfo<QueueEventArgs>>();
34 this.asynchronousListeners = new List<ActivityExecutorDelegateInfo<QueueEventArgs>>();
37 internal Queue Messages
39 get { return this.deliveredMessages; }
41 internal List<ActivityExecutorDelegateInfo<QueueEventArgs>> AsynchronousListeners
43 get { return this.asynchronousListeners; }
45 internal List<ActivityExecutorDelegateInfo<QueueEventArgs>> SynchronousListeners
47 get { return this.synchronousListeners; }
51 get { return this.enabled; }
52 set { this.enabled = value; }
54 internal bool Transactional
56 get { return this.transactional; }
57 set { this.transactional = value; }
62 get { return this.dirty; }
63 set { this.dirty = value; }
66 internal void CopyFrom(EventQueueState copyFromState)
68 this.deliveredMessages = new Queue(copyFromState.Messages);
70 // don't copy Subscribers since this gets fixed
71 // up at access time based on these tracking context ints
72 this.asynchronousListeners.AddRange(copyFromState.AsynchronousListeners.ToArray());
73 this.synchronousListeners.AddRange(copyFromState.SynchronousListeners.ToArray());
75 this.enabled = copyFromState.Enabled;
76 this.transactional = copyFromState.Transactional;