private void Optimize(ArchiveInformationView view) { ArchiveOptimizer optimizer = null; ArchiveInformation newInfo = null; Dispatcher.Invoke(() => { newInfo = view.Info; optimizer = new ArchiveOptimizer(view.Info); view.StartProgress(); optimizer.Progress += view.OnProgress; }); try { newInfo = optimizer.Optimize(); } catch (Exception ex) { UIHelper.ShowError(ex); } Dispatcher.Invoke(() => { view.Info = newInfo; view.StopProgress(); }); }
private void LoadOptions() { try { ContinueButton.IsEnabled = false; ObservableCollection <ArchiveInformationView> archiveCollection = ArchivesList.Archives; foreach (string archivePath in Options.GetGameArchivesPaths()) { ArchiveInformationAccessor accessor = new ArchiveInformationAccessor(archivePath); ArchiveInformation info = accessor.ReadOrCreate(); ArchiveInformationView view = new ArchiveInformationView(info); archiveCollection.Add(view); } ReserveControl.AbsoluteValue = Options.AbsoluteReserve; ReserveControl.RelativeValue = Options.RelativeReserve; ContinueButton.IsEnabled = true; } catch (Exception ex) { UIHelper.ShowError(ex); } }