Files
OfficeTool/Pages/ConfigPage.xaml.cs
hariel1985 0401910711 v1.04 — Config layout, button contrast, Skype default, Win11 for 2019
- Arch + Language side by side on config page
- Removed redundant hint text under app checkboxes
- Primary button: white text on blue (TextElement.Foreground fix)
- Skype for Business unchecked by default
- Office 2019: added Windows 11 support, end-of-support note
- Version display synced to v1.04

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 06:12:51 +02:00

92 sor
2.8 KiB
C#

using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using InstaSoftOfficeTool.Models;
namespace InstaSoftOfficeTool.Pages
{
public partial class ConfigPage : Page, IWizardPage
{
private readonly MainWindow _main;
private readonly InstallConfig _config;
private readonly List<CheckBox> _appCheckBoxes = new List<CheckBox>();
public ConfigPage(MainWindow main, InstallConfig config)
{
InitializeComponent();
_main = main;
_config = config;
// Restore arch
if (_config.Architecture == "32")
{
Rb32.IsChecked = true;
}
// Populate language combo
foreach (var lang in LanguageList.Languages)
{
CbLanguage.Items.Add(new ComboBoxItem
{
Content = lang.Name + " (" + lang.Code + ")",
Tag = lang.Code
});
}
// Select current language
for (int i = 0; i < CbLanguage.Items.Count; i++)
{
var item = (ComboBoxItem)CbLanguage.Items[i];
if ((string)item.Tag == _config.Language)
{
CbLanguage.SelectedIndex = i;
break;
}
}
if (CbLanguage.SelectedIndex < 0) CbLanguage.SelectedIndex = 0;
// Populate app checkboxes
foreach (var app in ExcludableApps.Apps)
{
// Ha m\u00e1r van ment\u00e9s a configban, azt haszn\u00e1ljuk; k\u00fcl\u00f6nben a default\u00f6t
bool isChecked = _config.ExcludedApps.Count > 0
? !_config.ExcludedApps.Contains(app.Id)
: app.DefaultChecked;
var cb = new CheckBox
{
Content = app.DisplayName,
IsChecked = isChecked,
Tag = app.Id,
Style = (Style)FindResource("FluentCheckBox"),
Margin = new Thickness(0, 4, 24, 4),
MinWidth = 160
};
_appCheckBoxes.Add(cb);
AppCheckBoxes.Children.Add(cb);
}
}
public bool Validate()
{
_config.Architecture = Rb64.IsChecked == true ? "64" : "32";
if (CbLanguage.SelectedItem is ComboBoxItem selected)
{
_config.Language = (string)selected.Tag;
}
_config.ExcludedApps.Clear();
foreach (var cb in _appCheckBoxes)
{
if (cb.IsChecked != true)
{
_config.ExcludedApps.Add((string)cb.Tag);
}
}
return true;
}
}
}