<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ComponentDefinition xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ironspeed.com/designer">
  <Generator>Iron Speed Designer</Generator>
  <Version>4.0</Version>
  <Self>
    <Name>SetLanguagePage</Name>
    <Type>Page</Type>
    <GenerateDirectory>Language</GenerateDirectory>
    <Layout>Language\SetLanguagePage.html</Layout>
    <DisplayName>SetLanguagePage</DisplayName>
    <Description />
    <CheckSum>CUSTOMIZED</CheckSum>
    <GenClassCustomCode>
        <![CDATA[

Private Sub MyPage_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    AddHandler Me.Button.Button.Click, AddressOf Custom_Button_Click
End Sub    	
    	
  Private Sub MyPage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            
		' Get the resource directory of the application. It is "bin" for .NET Framework 1.1 applications
		' and "App_GlobalResources" for .NET Framework 2.0 applications
		Dim resourceDir As String = "bin"
		
		' Get full path of resource directory
		Dim resourcePath As String = Me.Request.PhysicalApplicationPath() & resourceDir & "\"

		If System.IO.Directory.Exists(resourcePath) Then

			' Find all the resource files of the type AppName.culture.resx
			Dim resourceFiles() As String = System.IO.Directory.GetFiles(resourcePath, "*.*.resx")
			Dim resourceFile As String = ""
			Dim sortedLangList As SortedList = New SortedList

			For Each resourceFile In resourceFiles

			    ' Get the file name
			    Dim finfo As  System.IO.FileInfo = New  System.IO.FileInfo(resourceFile)
			    Dim fileName As String = finfo.Name

			    ' Split the filename by the "."
			    Dim splitBy As String = "."
			    Dim namePieces As String() = fileName.Split(splitBy.ToCharArray())
			    
			    Dim length As Integer = namePieces.Length
			    Dim index As Integer = length - 2
			    
			    ' Get the culture name portion of the filename like "en-US"
			    Dim cultureName As String = namePieces(index)

			    'Create a CultureInfo object to represent the culture
			    Dim cultureInfo As System.Globalization.CultureInfo = New System.Globalization.CultureInfo(cultureName)
			    
			    If Not sortedLangList.ContainsKey(cultureInfo.DisplayName) Then
			    	sortedLangList.Add(cultureInfo.DisplayName, cultureInfo.Name)
			    End If

			    

			Next resourceFile
			
			Dim key As String
			Dim val As String

			For Each key In sortedLangList.Keys
				val = CType(sortedLangList.Item(key), String)
				' Populate the cultures list
				Dim li As ListItem = New ListItem(key, val)
				If Not Me.LanguageBox.Items.Contains(li) Then
					Me.LanguageBox.Items.Add(li)
					' Select the current culture of the application
					If System.Threading.Thread.CurrentThread.CurrentUICulture.Name = val Then
						li.Selected = True
					End If
				End If

		    	Next
		End If

	End Sub

	''' &lt;summary&gt;
	'''     The standard event handler for Button events.
	''' &lt;/summary&gt;          
	Public Sub Custom_Button_Click(ByVal sender As Object, ByVal e As EventArgs)
      Try
          ' Set the value of the culture UI of the thread
          System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo(Me.LanguageBox.SelectedItem.Value)
          Session("AppCultureUI") = Me.LanguageBox.SelectedItem.Value

      Catch ex As Exception

      End Try

      Dim url As String = "../default.aspx"
      Me.Response.Redirect(url)
      
  End Sub

    
]]>
</GenClassCustomCode>
</Self>
<ComposedOf>
    <ContainedComponent>
      <Name>Menu</Name>
      <Type>Menu</Type>
      <Layout>..\Menu Panels\Menu.html</Layout>
    </ContainedComponent>
    <ContainedComponent>
      <Name>PageFooter</Name>
      <Type>Footer</Type>
      <Layout>..\Header and Footer\Footer.html</Layout>
    </ContainedComponent>
    <ContainedComponent>
      <Name>PageHeader</Name>
      <Type>Header</Type>
      <Layout>..\Header and Footer\Header.html</Layout>
    </ContainedComponent>
  </ComposedOf>
</ComponentDefinition>