protected async override void OnStartup(StartupEventArgs e) { base.OnStartup(e); AppDomain.CurrentDomain.UnhandledException += HandleUnhandledException; StopIfApplicationAlreadyRunning(); #if !DEBUG StopIfArgumentDoesNotMatch(); #endif PreloadWindow preloadWindow = new PreloadWindow(); preloadWindow.Show(); InitializeWebClient(); var remotePatchFiles = GetRemotePatchFiles(); var obsoletePatchFiles = new List <PatchFile>(); if (IsUpdateRequired(remotePatchFiles)) { preloadWindow.ShowUpdate(); obsoletePatchFiles = await SearchForObsoletePatchFiles(remotePatchFiles); } var frontNews = GetFrontNews(); preloadWindow.Hide(); var patcherWindowViewModel = new PatcherWindowViewModel { FrontNews = frontNews }; PatcherWindow patcherWindow = new PatcherWindow(Client, ObsoleteFileFinder, remotePatchFiles, obsoletePatchFiles); patcherWindow.DataContext = patcherWindowViewModel; patcherWindow.Show(); patcherWindow.StartUpdateIfNeeded(); }
public DownloadListener(PatcherWindow w, HTTPDownloader d) { window = w; downloader = d; baseCurrentSize = 0; totalSize = d.getTotalSize(); d.setProgressChangedEventHandler(new DownloadProgressChangedEventHandler(OnDownloadProgress)); d.setAfterNewFileEventHandler(new AfterFileDownloadedEventHandler(OnAfterNewFile)); d.setAllFileDownloadedEventHandler(new AllFileDownloadedEventHandler(allFileDownloaded)); }