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.ExcludedApps.Count > 0) SumExcluded.Text = string.Join(", ", _config.ExcludedApps); else SumExcluded.Text = "Nincs (minden alkalmaz\u00e1s telep\u00fcl)"; _generatedXml = OdtXmlGenerator.Generate(_config); XmlPreview.Text = _generatedXml; } 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; } } }