Office deployment wizard for InstaSoft customers: - Install Office 2019/2021/2024 (Standard, Professional Plus, Home & Business) - Auto-download ODT from Microsoft, generate config XML, run setup - Remove existing Office installations (C2R + MSI) - License troubleshooting via ospp.vbs (dstatus, unpkey) - Fluent Design UI (WPF .NET Framework 4.8, Win7+ compatible) - Hungarian interface, multi-language Office installation - Product key input with auto-activation support Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
107 sor
3.9 KiB
C#
107 sor
3.9 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Media;
|
|
using InstaSoftOfficeTool.Services;
|
|
|
|
namespace InstaSoftOfficeTool.Pages
|
|
{
|
|
public partial class TroubleshootPage : Page
|
|
{
|
|
private readonly MainWindow _main;
|
|
private readonly LicenseManager _licenseManager = new LicenseManager();
|
|
|
|
public TroubleshootPage(MainWindow main)
|
|
{
|
|
InitializeComponent();
|
|
_main = main;
|
|
Loaded += async (s, e) => await RefreshStatus();
|
|
}
|
|
|
|
private async System.Threading.Tasks.Task RefreshStatus()
|
|
{
|
|
OutputText.Text = "Keres\u00e9s folyamatban...\n";
|
|
BtnRemoveAll.IsEnabled = false;
|
|
BtnRefresh.IsEnabled = false;
|
|
|
|
bool found = _licenseManager.FindOspp();
|
|
|
|
if (!found)
|
|
{
|
|
OsppStatusIcon.Text = "\uE711";
|
|
OsppStatusIcon.Foreground = (Brush)FindResource("ErrorBrush");
|
|
OsppStatusText.Text = "Az ospp.vbs nem tal\u00e1lhat\u00f3. Nincs telep\u00edtett Office?";
|
|
OutputText.Text = "Az ospp.vbs f\u00e1jl nem tal\u00e1lhat\u00f3 a sz\u00e1m\u00edt\u00f3g\u00e9pen.\n\n" +
|
|
"Lehets\u00e9ges okok:\n" +
|
|
"- Nincs telep\u00edtett Microsoft Office\n" +
|
|
"- Az Office nem a szok\u00e1sos helyre lett telep\u00edtve";
|
|
BtnRefresh.IsEnabled = true;
|
|
return;
|
|
}
|
|
|
|
OsppStatusIcon.Text = "\uE73E";
|
|
OsppStatusIcon.Foreground = (Brush)FindResource("SuccessBrush");
|
|
OsppStatusText.Text = "ospp.vbs megtal\u00e1lva: " + _licenseManager.OsppPath;
|
|
|
|
OutputText.Text = "Licenc-\u00e1llapot lek\u00e9rdez\u00e9se...\n";
|
|
|
|
try
|
|
{
|
|
string status = await _licenseManager.GetStatusAsync();
|
|
OutputText.Text = status;
|
|
|
|
var keys = _licenseManager.ParseLicenseKeys(status);
|
|
BtnRemoveAll.IsEnabled = keys.Count > 0;
|
|
|
|
if (keys.Count > 0)
|
|
{
|
|
OutputText.Text += "\n--- " + keys.Count + " term\u00e9kkulcs tal\u00e1lhat\u00f3 ---";
|
|
}
|
|
else
|
|
{
|
|
OutputText.Text += "\n--- Nincs telep\u00edtett term\u00e9kkulcs ---";
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
OutputText.Text = "Hiba a lek\u00e9rdez\u00e9s sor\u00e1n: " + ex.Message;
|
|
}
|
|
|
|
BtnRefresh.IsEnabled = true;
|
|
}
|
|
|
|
private async void BtnRefresh_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
await RefreshStatus();
|
|
}
|
|
|
|
private async void BtnRemoveAll_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var result = MessageBox.Show(
|
|
"Biztosan el szeretn\u00e9 t\u00e1vol\u00edtani az \u00f6sszes telep\u00edtett term\u00e9kkulcsot?\n\n" +
|
|
"Ez nem t\u00f6r\u00f6l adatot, csak az aktiv\u00e1ci\u00f3s \u00e1llapotot \u00e1ll\u00edtja vissza.",
|
|
"Meger\u0151s\u00edt\u00e9s", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
|
|
|
if (result != MessageBoxResult.Yes) return;
|
|
|
|
BtnRemoveAll.IsEnabled = false;
|
|
BtnRefresh.IsEnabled = false;
|
|
|
|
OutputText.Text += "\n\nTerm\u00e9kkulcsok elt\u00e1vol\u00edt\u00e1sa...\n";
|
|
|
|
try
|
|
{
|
|
string cleanResult = await _licenseManager.RemoveAllKeysAsync();
|
|
OutputText.Text += cleanResult + "\n";
|
|
OutputText.Text += "\nK\u00e9sz. Kattintson az '\u00c1llapot friss\u00edt\u00e9se' gombra az eredm\u00e9ny ellen\u0151rz\u00e9s\u00e9hez.";
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
OutputText.Text += "Hiba: " + ex.Message;
|
|
}
|
|
|
|
BtnRefresh.IsEnabled = true;
|
|
}
|
|
}
|
|
}
|