Files
OfficeTool/Pages/ConfigPage.xaml.cs
hariel1985 12b86e0707 v1.22 — Office 2016 MSI ISO telepítés támogatás
Office 2016 Standard és Professional Plus telepítése ISO letöltéssel
(soft.direct), ISO csatolással és a Microsoft MSI telepítő indításával.
A 2019/2021/2024 verziók továbbra is ODT-vel működnek.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 23:27:14 +02:00

143 sor
5.0 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;
bool isMsi = _config.IsMsiInstall;
// Restore arch
if (_config.Architecture == "32")
{
Rb32.IsChecked = true;
}
// MSI: handle architecture constraints
if (isMsi && _config.Edition != null && !_config.Edition.HasArchitecture("32"))
{
Rb32.IsEnabled = false;
Rb64.IsChecked = true;
ArchNote.Text = "A Professional Plus kiadáshoz csak 64-bites telepítő érhető el.";
ArchNote.Visibility = Visibility.Visible;
}
// 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;
// MSI: language is baked into the ISO
if (isMsi)
{
CbLanguage.IsEnabled = false;
// Force Hungarian selection
for (int i = 0; i < CbLanguage.Items.Count; i++)
{
var item = (ComboBoxItem)CbLanguage.Items[i];
if ((string)item.Tag == "hu-hu")
{
CbLanguage.SelectedIndex = i;
break;
}
}
LanguageNote.Text = "Az Office 2016 telepítő ISO magyar nyelvű. A nyelv nem módosítható.";
LanguageNote.Visibility = Visibility.Visible;
}
// MSI: app exclusion not available through our tool
if (isMsi)
{
AppTitle.Visibility = Visibility.Collapsed;
AppCheckBoxes.Visibility = Visibility.Collapsed;
AppNote.Text = "Az alkalmazások kiválasztása a Microsoft telepítő felületén lehetséges.";
AppNote.Visibility = Visibility.Visible;
}
else
{
// Populate app checkboxes (ODT mode)
foreach (var app in ExcludableApps.Apps)
{
bool isChecked = _config.ExcludedApps.Count > 0
? !_config.ExcludedApps.Contains(app.Id)
: app.DefaultChecked;
bool isProPlus = _config.Edition != null &&
_config.Edition.ProductId.Contains("ProPlus");
bool isStandard = _config.Edition != null &&
_config.Edition.ProductId.Contains("Standard");
bool unavailable = false;
if (app.MinEdition == "proplus" && !isProPlus)
unavailable = true;
else if (app.MinEdition == "standard+" && !isProPlus && !isStandard)
unavailable = true;
var cb = new CheckBox
{
Content = app.DisplayName,
IsChecked = unavailable ? false : isChecked,
IsEnabled = !unavailable,
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 || !cb.IsEnabled)
{
_config.ExcludedApps.Add((string)cb.Tag);
}
}
return true;
}
}
}