Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.

Commit

Permalink
改进语言列表加载
Browse files Browse the repository at this point in the history
  • Loading branch information
Berrysoft committed May 5, 2018
1 parent 9cc1e4b commit c203033
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion TsinghuaNet/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<UniformGrid Grid.Row="0" Rows="1">
<RadioButton x:Name="Auth4" Foreground="{StaticResource TsinghuaPurple}" HorizontalAlignment="Center" VerticalAlignment="Center" VerticalContentAlignment="Center" ToolTip="https://auth4.tsinghua.edu.cn">Auth4</RadioButton>
<RadioButton x:Name="Auth6" Foreground="{StaticResource TsinghuaPurple}" HorizontalAlignment="Center" VerticalAlignment="Center" VerticalContentAlignment="Center" ToolTip="https://auth6.tsinghua.edu.cn">Auth6</RadioButton>
<RadioButton x:Name="Net" Foreground="{StaticResource TsinghuaPurple}" HorizontalAlignment="Center" VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="True" ToolTip="https://net.tsinghua.edu.cn">Net</RadioButton>
<RadioButton x:Name="Net" Foreground="{StaticResource TsinghuaPurple}" HorizontalAlignment="Center" VerticalAlignment="Center" VerticalContentAlignment="Center" ToolTip="https://net.tsinghua.edu.cn">Net</RadioButton>
</UniformGrid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
Expand Down
19 changes: 9 additions & 10 deletions TsinghuaNet/MainWindow.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,17 @@ Class MainWindow
Model.Password = log.Password
Model.State = log.State
Model.MoreInformation = log.MoreInf
GetFlux()
Dim currentcul As CultureInfo = Thread.CurrentThread.CurrentUICulture
Model.FlowDirection = If(currentcul.TextInfo.IsRightToLeft, FlowDirection.RightToLeft, FlowDirection.LeftToRight)
Dim langs As New List(Of CultureInfo)(Directory.GetDirectories(Directory.GetCurrentDirectory()).Select(
Function(fullName)
Try
Return New CultureInfo((New DirectoryInfo(fullName).Name))
Catch ex As CultureNotFoundException
Return Nothing
End Try
End Function).Where(Function(cul) cul IsNot Nothing))
langs.Add(New CultureInfo(""))
Dim langs As New List(Of CultureInfo)()
langs.Add(CultureInfo.InvariantCulture)
For Each dirname In Directory.EnumerateDirectories(Directory.GetCurrentDirectory())
Try
langs.Add(New CultureInfo((New DirectoryInfo(dirname)).Name))
Catch ex As CultureNotFoundException

End Try
Next
langs.Sort(New CultureInfoComparer(currentcul))
For i = 0 To langs.Count - 1
Model.Languages.Add(langs(i))
Expand Down
3 changes: 2 additions & 1 deletion TsinghuaNet/Settings.vb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Class Settings
End If
End If
Dim moreinf As String = logFile.<user>.<more>.Value
If StrComp(moreinf, "true", CompareMethod.Text) = 0 Then
Dim moreinfResult As Boolean
If Boolean.TryParse(moreinf, moreinfResult) AndAlso moreinfResult Then
Me.MoreInf = True
End If
Dim lang As String = logFile.<user>.<language>.Value
Expand Down

0 comments on commit c203033

Please sign in to comment.