PageOtherHelpDetail.xaml.vb 1.2 KB

123456789101112131415161718192021222324252627
  1. Public Class PageOtherHelpDetail
  2. Public Entry As HelpEntry
  3. Private Sub PageOtherHelpDetail_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
  4. PanBack.ScrollToTop()
  5. End Sub
  6. ''' <summary>
  7. ''' 根据特定帮助项初始化页面 UI,返回是否成功加载。
  8. ''' </summary>
  9. Public Function Init(Entry As HelpEntry) As Boolean
  10. Dim FileContent = "<StackPanel xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" xmlns:local=""clr-namespace:PCL;assembly=Plain Craft Launcher 2"">" & If(Entry.XamlContent, "") & "</StackPanel>"
  11. Try
  12. If String.IsNullOrEmpty(Entry.XamlContent) Then Throw New Exception("帮助 xaml 文件为空")
  13. Me.Entry = Entry
  14. PanCustom.Children.Clear()
  15. FileContent = HelpArgumentReplace(FileContent)
  16. PanCustom.Children.Add(GetObjectFromXML(FileContent))
  17. Return True
  18. Catch ex As Exception
  19. Log("[System] 自定义信息内容:" & vbCrLf & FileContent)
  20. Log(ex, "加载帮助 xaml 文件失败", LogLevel.Msgbox)
  21. Return False
  22. End Try
  23. End Function
  24. End Class