public override void OnFrameworkInitializationCompleted() { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { try { QuestPatcherService questPatcherService = new QuestPatcherUIService(desktop); desktop.Exit += (_, _) => { questPatcherService.CleanUp(); }; } catch (Exception ex) { DialogBuilder dialog = new() { Title = "Critical Error", Text = "QuestPatcher encountered a critical error during early startup, which was unrecoverable.", HideCancelButton = true }; dialog.WithException(ex); dialog.OpenDialogue(null, WindowStartupLocation.CenterScreen); } } base.OnFrameworkInitializationCompleted(); } }
/// <summary> /// This exists instead of a constructor since the prompter must be immediately passed on QuestPatcherService's creation, so we initialise its members after the fact. /// Maybe there's a better workaround, but this works fine for now /// </summary> public void Init(Window mainWindow, Config config, QuestPatcherUIService uiService, SpecialFolders specialFolders) { _mainWindow = mainWindow; _config = config; _uiService = uiService; _specialFolders = specialFolders; }
public ToolsViewModel(Config config, ProgressViewModel progressView, OperationLocker locker, Window mainWindow, SpecialFolders specialFolders, Logger logger, PatchingManager patchingManager, AndroidDebugBridge debugBridge, QuestPatcherUIService uiService, InfoDumper dumper) { Config = config; ProgressView = progressView; Locker = locker; _mainWindow = mainWindow; _specialFolders = specialFolders; _logger = logger; _patchingManager = patchingManager; _debugBridge = debugBridge; _uiService = uiService; _dumper = dumper; _debugBridge.StoppedLogging += (_, _) => { _logger.Information("ADB log exited"); _isAdbLogging = false; this.RaisePropertyChanged(nameof(AdbButtonText)); }; }