Files
OfficeTool/Pages/EditionPage.xaml.cs
hariel1985 8e4ad331f1 v1.19 — Bug fixes, Hungarian accents, better error handling
- Fix: Back button was always visible (ternary always returned Visible)
- Fix: Missing Hungarian accents on EditionPage ("Válasszon kiadást")
- Fix: Better ODT download error messages (network/timeout distinguished)
- Signed with Azure Trusted Signing (Microsoft root CA, instant SmartScreen trust)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 17:04:11 +02:00

81 sor
2.5 KiB
C#

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;
}
}
}