using System.Windows; using System.Windows.Controls; using InstaSoftOfficeTool.Models; namespace InstaSoftOfficeTool.Pages { public partial class EditionPage : Page, IWizardPage { private readonly MainWindow _main; private readonly InstallConfig _config; private readonly OfficeEdition[] _editions; public EditionPage(MainWindow main, InstallConfig config) { InitializeComponent(); _main = main; _config = config; _editions = OfficeEdition.GetEditions(_config.Version); SubtitleText.Text = _config.GetVersionDisplayName() + " \u2014 melyik kiad\u00e1st szeretn\u00e9?"; BuildEditionCards(); } private void BuildEditionCards() { EditionPanel.Children.Clear(); for (int i = 0; i < _editions.Length; i++) { var edition = _editions[i]; var rb = new RadioButton { GroupName = "Edition", IsChecked = i == 0 || (_config.Edition != null && _config.Edition.ProductId == edition.ProductId), Style = (Style)FindResource("CardRadioButton"), Margin = new Thickness(0, 0, 0, 10), Tag = i }; var sp = new StackPanel { Margin = new Thickness(8, 2, 8, 2) }; var titleBlock = new TextBlock { Text = edition.DisplayName, FontSize = 18, FontWeight = FontWeights.SemiBold }; sp.Children.Add(titleBlock); var descBlock = new TextBlock { Text = edition.Description, FontSize = 12, Foreground = (System.Windows.Media.Brush)FindResource("TextSecondaryBrush"), TextWrapping = TextWrapping.Wrap, Margin = new Thickness(0, 2, 0, 0) }; sp.Children.Add(descBlock); rb.Content = sp; EditionPanel.Children.Add(rb); } } public bool Validate() { foreach (var child in EditionPanel.Children) { if (child is RadioButton rb && rb.IsChecked == true) { int idx = (int)rb.Tag; _config.Edition = _editions[idx]; return true; } } return false; } } }