XCITrimmerLog.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Avalonia.Threading;
  2. using Ryujinx.Ava.UI.ViewModels;
  3. namespace Ryujinx.Ava.Common
  4. {
  5. public static class XCITrimmerLog
  6. {
  7. internal class MainWindow : Ryujinx.Common.Logging.XCIFileTrimmerLog
  8. {
  9. private readonly MainWindowViewModel _viewModel;
  10. public MainWindow(MainWindowViewModel viewModel)
  11. {
  12. _viewModel = viewModel;
  13. }
  14. public override void Progress(long current, long total, string text, bool complete)
  15. {
  16. Dispatcher.UIThread.Post(() =>
  17. {
  18. _viewModel.StatusBarProgressMaximum = (int)(total);
  19. _viewModel.StatusBarProgressValue = (int)(current);
  20. });
  21. }
  22. }
  23. internal class TrimmerWindow : Ryujinx.Common.Logging.XCIFileTrimmerLog
  24. {
  25. private readonly XCITrimmerViewModel _viewModel;
  26. public TrimmerWindow(XCITrimmerViewModel viewModel)
  27. {
  28. _viewModel = viewModel;
  29. }
  30. public override void Progress(long current, long total, string text, bool complete)
  31. {
  32. Dispatcher.UIThread.Post(() =>
  33. {
  34. _viewModel.SetProgress((int)(current), (int)(total));
  35. });
  36. }
  37. }
  38. }
  39. }