using System.Linq; using System.Windows; using System.Windows.Controls; using InstaSoftOfficeTool.Models; using InstaSoftOfficeTool.Services; using Microsoft.Win32; namespace InstaSoftOfficeTool.Pages { public partial class SummaryPage : Page, IWizardPage { private readonly MainWindow _main; private readonly InstallConfig _config; private string _generatedXml; public SummaryPage(MainWindow main, InstallConfig config) { InitializeComponent(); _main = main; _config = config; Loaded += (s, e) => RefreshSummary(); } private void RefreshSummary() { SumVersion.Text = _config.GetVersionDisplayName(); SumEdition.Text = _config.Edition?.DisplayName ?? "-"; SumArch.Text = _config.Architecture + "-bit"; SumLanguage.Text = _config.GetLanguageDisplayName() + " (" + _config.Language + ")"; SumKey.Text = string.IsNullOrEmpty(_config.ProductKey) ? "Nincs megadva" : _config.ProductKey; if (_config.IsMsiInstall) { // MSI mode: no app exclusion, show ISO info instead of XML SumExcluded.Text = "(a Microsoft telepítőben választható)"; string isoUrl = _config.GetIsoUrl(); XmlPreview.Text = "Telepítési mód: ISO letöltés + MSI telepítő\n" + "ISO URL: " + (isoUrl ?? "Nem elérhető") + "\n\n" + "A telepítő ISO fájl letöltése után a Microsoft Office\n" + "saját telepítője indul el automatikusan."; BtnSaveXml.Visibility = System.Windows.Visibility.Collapsed; } else { if (_config.ExcludedApps.Count > 0) SumExcluded.Text = string.Join(", ", _config.ExcludedApps); else SumExcluded.Text = "Nincs (minden alkalmazás települ)"; _generatedXml = OdtXmlGenerator.Generate(_config); XmlPreview.Text = _generatedXml; BtnSaveXml.Visibility = System.Windows.Visibility.Visible; } } private void BtnSaveXml_Click(object sender, RoutedEventArgs e) { var dlg = new SaveFileDialog { Filter = "XML f\u00e1jl (*.xml)|*.xml", FileName = "configuration.xml" }; if (dlg.ShowDialog() == true) { System.IO.File.WriteAllText(dlg.FileName, _generatedXml); MessageBox.Show("XML sikeresen mentve:\n" + dlg.FileName, "Ment\u00e9s", MessageBoxButton.OK, MessageBoxImage.Information); } } public bool Validate() { return true; } } }