2006-03-10 Peter Dennis Bartok <pbartok@novell.com>
[mono.git] / mcs / class / System.Messaging / System.Messaging / PeekCompletedEventArgs.cs
index c84cdb471bc008edced851c6b864dd6250a48229..f282296ecdf3d5204d432f160c172de3ea321abc 100644 (file)
@@ -7,6 +7,28 @@
 //\r
 // (C) 2003 Peter Van Isacker\r
 //\r
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+\r
 using System;\r
 using System.Runtime.Remoting.Messaging;\r
 \r
@@ -14,18 +36,32 @@ namespace System.Messaging
 {\r
        public class PeekCompletedEventArgs : EventArgs \r
        {\r
-               public IAsyncResult AsyncResult;\r
-               public Message Message;\r
+               private MessageQueue _sender;\r
+               private IAsyncResult _result;\r
+               private Message _message;\r
 \r
-               internal PeekCompletedEventArgs(AsyncResult AsyncResult, Message Message)\r
+               internal PeekCompletedEventArgs(MessageQueue sender, IAsyncResult result)\r
                {\r
-                       this.AsyncResult = AsyncResult;\r
-                       this.Message = Message;\r
+                       _sender = sender;\r
+                       _result = result;\r
                }\r
-               \r
-               [MonoTODO]\r
-               ~PeekCompletedEventArgs()\r
+\r
+               public IAsyncResult AsyncResult\r
+               {\r
+                       get { return _result; }\r
+                       set { _result = value; }\r
+               }\r
+\r
+               public Message Message\r
                {\r
+                       get\r
+                       {\r
+                               if (_message == null)\r
+                               {\r
+                                       _message = _sender.EndPeek (_result);\r
+                               }\r
+                               return _message;\r
+                       }\r
                }\r
        }\r
 }\r