Splash.xaml.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using Notifications.Wpf;
  2. using System;
  3. using System.Threading.Tasks;
  4. using System.Windows;
  5. namespace DeviceCenter
  6. {
  7. /// <summary>
  8. /// Splash.xaml 的交互逻辑
  9. /// </summary>
  10. public partial class Splash : Window
  11. {
  12. private NotificationManager notificationManager = new NotificationManager();
  13. public Splash()
  14. {
  15. InitializeComponent();
  16. //CarCamSDK.Net_Init();
  17. //Login login = new Login();
  18. //login.Show();
  19. //Close();
  20. init();
  21. }
  22. private async void init()
  23. {
  24. await Task.Run(() =>
  25. {
  26. int code = CarCamSDK.Net_Init();
  27. notificationManager.Show(new NotificationContent
  28. {
  29. Title = "Info",
  30. Message = "CarCamSDK Net_Init " + code,
  31. Type = NotificationType.Information
  32. });
  33. if (!CHCNetSDK.NET_DVR_Init())
  34. {
  35. notificationManager.Show(new NotificationContent
  36. {
  37. Title = "Error",
  38. Message = "NET_DVR_Init Error",
  39. Type = NotificationType.Error
  40. });
  41. }
  42. else
  43. {
  44. notificationManager.Show(new NotificationContent
  45. {
  46. Title = "Success",
  47. Message = "NET_DVR_Init Succss",
  48. Type = NotificationType.Success
  49. });
  50. }
  51. Application.Current.Dispatcher.Invoke((Action)(() =>
  52. {
  53. Login login = new Login();
  54. login.Show();
  55. Close();
  56. }));
  57. });
  58. }
  59. }
  60. }