Splash.xaml.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Windows;
  3. using MahApps.Metro.Controls;
  4. using MediaBrowser.Common.Logging;
  5. using MediaBrowser.Model.Progress;
  6. namespace MediaBrowser.Common.UI
  7. {
  8. /// <summary>
  9. /// Interaction logic for Splash.xaml
  10. /// </summary>
  11. public partial class Splash : MetroWindow
  12. {
  13. public Splash(Progress<TaskProgress> progress)
  14. {
  15. InitializeComponent();
  16. progress.ProgressChanged += progress_ProgressChanged;
  17. Loaded+=Splash_Loaded;
  18. }
  19. void progress_ProgressChanged(object sender, TaskProgress e)
  20. {
  21. // If logging has loaded, put a message in the log.
  22. if (Logger.LoggerInstance != null)
  23. {
  24. Logger.LogInfo(e.Description);
  25. }
  26. this.lblProgress.Content = e.Description;
  27. this.pbProgress.Value = (double)e.PercentComplete;
  28. }
  29. private void Splash_Loaded(object sender, RoutedEventArgs e)
  30. {
  31. // Setting this in markup throws an exception at runtime
  32. ShowTitleBar = false;
  33. }
  34. }
  35. }