home *** CD-ROM | disk | FTP | other *** search
/ nrsys.ke.euroweb.sk / nrsys.ke.euroweb.sk.tar / nrsys.ke.euroweb.sk / incoming / NETCFSetupv2.msi / F_NETCFv2.wce5.mipsii.cab.7268F488_53D1_4565_BEEC_1251BC587315 / MICROS~2.017 / RCDATA / 300
Text File  |  2005-08-26  |  10KB  |  235 lines

  1. Option Strict On
  2. Option Explicit On
  3. Option Compare Binary
  4.  
  5. '* Copyright (C) Microsoft Corporation. All Rights Reserved.
  6.  
  7. #If TARGET = "module" AndAlso _MYTYPE = "" Then
  8. #Const _MYTYPE="Empty"
  9. #End If
  10.  
  11. #If _MYTYPE = "WindowsForms" Then
  12.  
  13. #Const _MYFORMS = True
  14. #Const _MYWEBSERVICES = True
  15. #Const _MYUSERTYPE = "Windows"
  16. #Const _MYCOMPUTERTYPE = "Windows"
  17. #Const _MYAPPLICATIONTYPE = "WindowsForms"
  18.  
  19. #ElseIf _MYTYPE = "WindowsFormsWithCustomSubMain" Then
  20.  
  21. #Const _MYFORMS = True
  22. #Const _MYWEBSERVICES = True
  23. #Const _MYUSERTYPE = "Windows"
  24. #Const _MYCOMPUTERTYPE = "Windows"
  25. #Const _MYAPPLICATIONTYPE = "Console"
  26.  
  27. #ElseIf _MYTYPE = "Windows" OrElse _MYTYPE = "" Then
  28.  
  29. #Const _MYWEBSERVICES = True
  30. #Const _MYUSERTYPE = "Windows"
  31. #Const _MYCOMPUTERTYPE = "Windows"
  32. #Const _MYAPPLICATIONTYPE = "Windows"
  33.  
  34. #ElseIf _MYTYPE = "Console" Then
  35.  
  36. #Const _MYWEBSERVICES = True
  37. #Const _MYUSERTYPE = "Windows"
  38. #Const _MYCOMPUTERTYPE = "Windows"
  39. #Const _MYAPPLICATIONTYPE = "Console"
  40.  
  41. #ElseIf _MYTYPE = "Web" Then
  42.  
  43. #Const _MYFORMS = False
  44. #Const _MYWEBSERVICES = False
  45. #Const _MYUSERTYPE = "Web"
  46. #Const _MYCOMPUTERTYPE = "Web"
  47.  
  48. #ElseIf _MYTYPE = "WebControl" Then
  49.  
  50. #Const _MYFORMS = False
  51. #Const _MYWEBSERVICES = True
  52. #Const _MYUSERTYPE = "Web"
  53. #Const _MYCOMPUTERTYPE = "Web"
  54.  
  55. #ElseIf _MYTYPE = "Custom" Then
  56.  
  57. #ElseIf _MYTYPE <> "Empty" Then
  58.  
  59. #Const _MYTYPE = "Empty"
  60.  
  61. #End If
  62.  
  63. #If _MYTYPE <> "Empty" Then
  64.  
  65. Namespace My
  66.  
  67.  
  68.  
  69.     <Global.Microsoft.VisualBasic.HideModuleName()> _
  70.     <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("MyTemplate", "8.0.0.0")> _
  71.     Friend Module MyProject
  72. #If _MYFORMS = True Then
  73.  
  74. #Const STARTUP_MY_FORM_FACTORY = "My.MyProject.Forms"
  75.  
  76.         Friend ReadOnly Property Forms() As MyForms
  77.             <Global.System.Diagnostics.DebuggerHidden()> _
  78.             Get
  79.                 Return m_MyFormsObjectProvider.GetInstance()
  80.             End Get
  81.         End Property
  82.  
  83.         <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
  84.         <Global.Microsoft.VisualBasic.MyGroupCollection("System.Windows.Forms.Form", "Create__Instance__", "Dispose__Instance__", "My.MyProject.Forms")> _
  85.         Friend NotInheritable Class MyForms
  86.             <Global.System.Diagnostics.DebuggerHidden()> _
  87.             Private Shared Function Create__Instance__(Of T As {New, Global.System.Windows.Forms.Form})(ByVal Instance As T) As T
  88.                 If Instance Is Nothing Then
  89.                     If m_FormBeingCreated IsNot Nothing Then
  90.                         If m_FormBeingCreated.ContainsKey(GetType(T)) = True Then
  91.                             Throw New Global.System.InvalidOperationException(Global.Microsoft.VisualBasic.CompilerServices.Utils.GetResourceString("WinForms_RecursiveFormCreate"))
  92.                         End If
  93.                     Else
  94.                         m_FormBeingCreated = New Global.System.Collections.Hashtable()
  95.                     End If
  96.                     m_FormBeingCreated.Add(GetType(T), Nothing)
  97.                     Try
  98.                         Return New T()
  99.                     Catch ex As Global.System.Reflection.TargetInvocationException When ex.InnerException IsNot Nothing
  100.                         Dim BetterMessage As String = Global.Microsoft.VisualBasic.CompilerServices.Utils.GetResourceString("WinForms_SeeInnerException", ex.InnerException.Message)
  101.                         Throw New Global.System.InvalidOperationException(BetterMessage, ex.InnerException)
  102.                     Finally
  103.                         m_FormBeingCreated.Remove(GetType(T))
  104.                     End Try
  105.                 Else
  106.                     Return Instance
  107.                 End If
  108.             End Function
  109.  
  110.             <Global.System.Diagnostics.DebuggerHidden()> _
  111.             Private Sub Dispose__Instance__(Of T As Global.System.Windows.Forms.Form)(ByRef instance As T)
  112.                 instance.Dispose()
  113.                 instance = Nothing
  114.             End Sub
  115.  
  116.             <Global.System.Diagnostics.DebuggerHidden()> _
  117.             <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
  118.             Public Sub New()
  119.                MyBase.New()
  120.             End Sub
  121.  
  122.             Private Shared m_FormBeingCreated As Global.System.Collections.Hashtable
  123.  
  124.             <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function Equals(ByVal o As Object) As Boolean
  125.                 Return MyBase.Equals(o)
  126.             End Function
  127.             <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function GetHashCode() As Integer
  128.                 Return MyBase.GetHashCode
  129.             End Function
  130.             <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> _
  131.             Friend Overloads Function [GetType]() As Global.System.Type
  132.                 Return GetType(MyForms)
  133.             End Function
  134.             <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never)> Public Overrides Function ToString() As String
  135.                 Return MyBase.ToString
  136.             End Function
  137.         End Class
  138.  
  139.         Private m_MyFormsObjectProvider As New ThreadSafeObjectProvider(Of MyForms)
  140.  
  141. #End If
  142.  
  143. #If _MYWEBSERVICES = True Then
  144.  
  145.         Friend ReadOnly Property WebServices() As MyWebServices
  146.              <Global.System.Diagnostics.DebuggerHidden()> _
  147.              Get
  148.                 Return m_MyWebServicesObjectProvider.GetInstance()
  149.             End Get
  150.         End Property
  151.  
  152.         <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
  153.         <Global.Microsoft.VisualBasic.MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtocol", "Create__Instance__", "Dispose__Instance__", "")> _
  154.         Friend NotInheritable Class MyWebServices
  155.  
  156.             <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never), Global.System.Diagnostics.DebuggerHidden()> _
  157.             Public Overrides Function Equals(ByVal o As Object) As Boolean
  158.                 Return MyBase.Equals(o)
  159.             End Function
  160.             <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never), Global.System.Diagnostics.DebuggerHidden()> _
  161.             Public Overrides Function GetHashCode() As Integer
  162.                 Return MyBase.GetHashCode
  163.             End Function
  164.             <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never), Global.System.Diagnostics.DebuggerHidden()> _
  165.             Friend Overloads Function [GetType]() As Global.System.Type
  166.                 Return GetType(MyWebServices)
  167.             End Function
  168.             <Global.System.ComponentModel.EditorBrowsable(Global.System.ComponentModel.EditorBrowsableState.Never), Global.System.Diagnostics.DebuggerHidden()> _
  169.             Public Overrides Function ToString() As String
  170.                 Return MyBase.ToString
  171.             End Function
  172.  
  173.            <Global.System.Diagnostics.DebuggerHidden()> _
  174.            Private Shared Function Create__Instance__(Of T As {New})(ByVal instance As T) As T
  175.                 If instance Is Nothing Then
  176.                     Return New T()
  177.                 Else
  178.                     Return instance
  179.                 End If
  180.             End Function
  181.  
  182.             <Global.System.Diagnostics.DebuggerHidden()> _
  183.             Private Sub Dispose__Instance__(Of T)(ByRef instance As T)
  184.                 instance = Nothing
  185.             End Sub
  186.  
  187.             <Global.System.Diagnostics.DebuggerHidden()> _
  188.             <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
  189.             Public Sub New()
  190.                MyBase.New()
  191.             End Sub
  192.         End Class
  193.  
  194.         Private ReadOnly m_MyWebServicesObjectProvider As New ThreadSafeObjectProvider(Of MyWebServices)
  195. #End If
  196.  
  197.         <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
  198.         <Global.System.Runtime.InteropServices.ComVisible(False)> _
  199.         Friend NotInheritable Class ThreadSafeObjectProvider(Of T As New)
  200.             Friend ReadOnly Property GetInstance() As T
  201.                 Get
  202.                     'Don't need a SyncLock here because only one thread can get to it
  203.  
  204.                     'Security - Get a unique name for the data slot so that
  205.                     '           this slot cannot be accessed in user code.
  206.                     Static DataSlotName As String
  207.                     If DataSlotName Is Nothing OrElse DataSlotName.Length() = 0 Then
  208.                         Dim ran As New Global.System.Random()
  209.                         DataSlotName = String.Format(Global.System.Globalization.CultureInfo.CurrentCulture, "{0}.Microsoft.VisualBasic.CompilerServices.ProjectData", ran.Next() )
  210.                     End If
  211.  
  212.                     'GetNamedDataSlot, GetData, and SetData always execute on the current thread
  213.                     Dim DataSlot As Global.System.LocalDataStoreSlot = Global.System.Threading.Thread.GetNamedDataSlot(DataSlotName)
  214.  
  215.                     Dim obj As Object = Global.System.Threading.Thread.GetData(DataSlot)
  216.                     Dim ThreadStaticValue As T = CType(obj, T)
  217.  
  218.                     If ThreadStaticValue Is Nothing Then
  219.                         ThreadStaticValue = New T
  220.                         Global.System.Threading.Thread.SetData(DataSlot, ThreadStaticValue)
  221.                     End If
  222.                     Return ThreadStaticValue
  223.                 End Get
  224.             End Property
  225.  
  226.             <Global.System.Diagnostics.DebuggerHidden()> _
  227.             <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
  228.             Public Sub New()
  229.                 MyBase.New()
  230.             End Sub
  231.  
  232.         End Class
  233.     End Module
  234. End Namespace
  235. #End If