PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/Visual Studio 2008/VBRemotingSharedLibrary/ClientActivatedObject.vb

#
Visual Basic | 73 lines | 23 code | 11 blank | 39 comment | 0 complexity | de20d28746ff6f04ebb1b1c475d9f890 MD5 | raw file
  1. '****************************** Module Header ******************************'
  2. ' Module Name: ClientActivatedObject.vb
  3. ' Project: VBRemotingSharedLibrary
  4. ' Copyright (c) Microsoft Corporation.
  5. '
  6. ' ClientActivatedObject.vb defines a client-activated type for .NET Remoting.
  7. ' Client-activated objects are created by the server and their lifetime is
  8. ' managed by the client. In contrast to server-activated objects, client-
  9. ' activated objects are created as soon as the client calls "new" or any
  10. ' other object creation methods. Client-activated objects are specific to the
  11. ' client, and objects are not shared among different clients; object instance
  12. ' exists until the lease expires or the client destroys the object.
  13. '
  14. ' This source is subject to the Microsoft Public License.
  15. ' See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
  16. ' All other rights reserved.
  17. '
  18. ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
  19. ' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
  20. ' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
  21. '***************************************************************************'
  22. Imports System.Runtime.InteropServices
  23. ''' <summary>
  24. ''' A client-activated type for .NET Remoting.
  25. ''' </summary>
  26. Public Class ClientActivatedObject
  27. Inherits MarshalByRefObject
  28. ''' <summary>
  29. ''' A float property.
  30. ''' </summary>
  31. Public Property FloatProperty() As Single
  32. Get
  33. Return fField
  34. End Get
  35. Set(ByVal value As Single)
  36. fField = value
  37. End Set
  38. End Property
  39. Private fField As Single
  40. ''' <summary>
  41. ''' Get the type of the remote object.
  42. ''' </summary>
  43. Public Overridable Function GetRemoteObjectType() As String
  44. Return "ClientActivatedObject"
  45. End Function
  46. ''' <summary>
  47. ''' Get the current process ID and thread ID.
  48. ''' </summary>
  49. ''' <param name="processId">current process ID</param>
  50. ''' <param name="threadId">current thread ID</param>
  51. ''' <remarks></remarks>
  52. Public Sub GetProcessThreadID(<Out()> ByRef processId As UInt32, <Out()> ByRef threadId As UInt32)
  53. processId = Process.GetCurrentProcess.Id
  54. threadId = GetCurrentThreadId()
  55. End Sub
  56. ''' <summary>
  57. ''' Get the current thread ID.
  58. ''' </summary>
  59. <DllImport("kernel32.dll")> _
  60. Friend Shared Function GetCurrentThreadId() As UInt32
  61. End Function
  62. End Class