You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 regels
1.2 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Shapes;
  14. namespace HKCardOUT.Views
  15. {
  16. /// <summary>
  17. /// AdWindow.xaml 的交互逻辑
  18. /// </summary>
  19. public partial class AdWindow : Window
  20. {
  21. public AdWindow(string input)
  22. {
  23. InitializeComponent();
  24. this.Loaded += (sender, ev) =>
  25. {
  26. this.WindowState = WindowState.Maximized;
  27. };
  28. InitView2(input);
  29. }
  30. public async void InitView2(string input)
  31. {
  32. StringBuilder sb = new StringBuilder();
  33. sb.Append($"<html><body>{input}</body></html>");
  34. var html = sb.ToString();
  35. await view2.EnsureCoreWebView2Async(null);
  36. view2.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;
  37. view2.CoreWebView2.Settings.AreDevToolsEnabled = false;
  38. view2.CoreWebView2.NavigateToString(html);
  39. }
  40. }
  41. }