App.xaml.cs 963 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Net;
  3. using System.Windows;
  4. using System.Windows.Media;
  5. using System.Windows.Media.Imaging;
  6. namespace LocalizationTool
  7. {
  8. public partial class App : Application
  9. {
  10. /// <summary>应用图标(app.ico 以 Resource 嵌入,各窗口标题栏/任务栏共用)。</summary>
  11. public static ImageSource AppIcon { get; } = LoadIcon();
  12. private static ImageSource LoadIcon()
  13. {
  14. try
  15. {
  16. return new BitmapImage(new Uri("pack://application:,,,/app.ico"));
  17. }
  18. catch
  19. {
  20. return null;
  21. }
  22. }
  23. protected override void OnStartup(StartupEventArgs e)
  24. {
  25. base.OnStartup(e);
  26. // 保证 https 翻译接口可用(net48 默认协议不满 TLS1.2)
  27. ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
  28. }
  29. }
  30. }