25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 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. this.Closed += (sender, ev) =>
  29. {
  30. App.Current.Shutdown(0);
  31. };
  32. InitView2(input);
  33. }
  34. public async void InitView2(string input)
  35. {
  36. StringBuilder sb = new StringBuilder();
  37. sb.Append($"<html><body>{input}</body></html>");
  38. var html = sb.ToString();
  39. await view2.EnsureCoreWebView2Async(null);
  40. view2.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;
  41. view2.CoreWebView2.Settings.AreDevToolsEnabled = false;
  42. view2.CoreWebView2.NavigateToString(html);
  43. }
  44. }
  45. }