Beispiel #1
0
        internal MessageImpl(ServiceImpl service, Type message)
        {
            if (!typeof(Delegate).IsAssignableFrom(message))
            {
                throw new ArgumentException("Message type " + message + " is not a delegate type");
            }

            Attribute attribute;

            foreach (Attribute attr in message.GetCustomAttributes(false))
            {
                if (attr.GetType().FullName == typeof(PartMessageDelegate).FullName)
                {
                    attribute = attr;
                    goto foundAttribute;
                }
            }
            throw new ArgumentException("Message does not have the PartMessageDelegate attribute");

foundAttribute:
            DelegateType = message;

            ifMsg = ServiceImpl.AsDelegate(attribute);
            if (ifMsg.Parent != null)
            {
                parent = (MessageImpl)service.AsIPartMessage(ifMsg.Parent);
            }
        }
Beispiel #2
0
            public virtual void Dispose()
            {
                if (service == null)
                {
                    throw new InvalidOperationException("Already disposed");
                }

                filters.Remove(node);
                if (filters.Count == 0)
                {
                    filters = null;
                }
                service = null;
            }
Beispiel #3
0
            public override void Dispose()
            {
                ServiceImpl theService = service;

                base.Dispose();

                // Safe as we've already deregistered the filter, so no loops.
                foreach (ICurrentEventInfo message in messageList)
                {
                    CurrentEventInfoImpl info = (CurrentEventInfoImpl)message;
                    info.filterComplete = false;
                    theService.Send((CurrentEventInfoImpl)message);
                }
                messageList = null;
            }