PageOtherHelpDetail.xaml.vb 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. Public Class PageOtherHelpDetail
  2. Implements IRefreshable
  3. Public Entry As HelpEntry
  4. Public Sub Refresh() Implements IRefreshable.Refresh
  5. Init(New HelpEntry(Entry.RawPath))
  6. End Sub
  7. Private Sub PageOtherHelpDetail_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
  8. PanBack.ScrollToTop()
  9. End Sub
  10. ''' <summary>
  11. ''' 根据特定帮助项初始化页面 UI,返回是否成功加载。
  12. ''' </summary>
  13. Public Function Init(Entry As HelpEntry) As Boolean
  14. 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>"
  15. Try
  16. If String.IsNullOrEmpty(Entry.XamlContent) Then Throw New Exception("帮助 xaml 文件为空")
  17. Me.Entry = Entry
  18. PanCustom.Children.Clear()
  19. FileContent = HelpArgumentReplace(FileContent)
  20. PanCustom.Children.Add(GetObjectFromXML(FileContent))
  21. Return True
  22. Catch ex As Exception
  23. Log("[System] 自定义信息内容:" & vbCrLf & FileContent)
  24. Log(ex, "加载帮助 xaml 文件失败", LogLevel.Msgbox)
  25. Return False
  26. End Try
  27. End Function
  28. End Class