diff --git a/InstaSoftOfficeTool.csproj b/InstaSoftOfficeTool.csproj
index 3f8de2b..908a07d 100644
--- a/InstaSoftOfficeTool.csproj
+++ b/InstaSoftOfficeTool.csproj
@@ -9,9 +9,9 @@
InstaSoft Zrt.
InstaSoft Office Tool
Copyright (c) InstaSoft Zrt. 2026
- 1.0.5
- 1.0.5.0
- 1.0.5.0
+ 1.0.6
+ 1.0.6.0
+ 1.0.6.0
app.manifest
latest
diff --git a/MainWindow.xaml b/MainWindow.xaml
index ee1b491..06d51b6 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -42,7 +42,7 @@
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,-2,0,0"/>
-
diff --git a/Pages/ProductKeyPage.xaml.cs b/Pages/ProductKeyPage.xaml.cs
index 079b6a8..ec18b1d 100644
--- a/Pages/ProductKeyPage.xaml.cs
+++ b/Pages/ProductKeyPage.xaml.cs
@@ -27,6 +27,40 @@ namespace InstaSoftOfficeTool.Pages
_keyBoxes[i].Text = parts[i];
}
}
+
+ // Intercept paste on all boxes
+ foreach (var box in _keyBoxes)
+ {
+ DataObject.AddPastingHandler(box, OnPaste);
+ }
+ }
+
+ private void OnPaste(object sender, DataObjectPastingEventArgs e)
+ {
+ if (!e.DataObject.GetDataPresent(typeof(string))) return;
+
+ var pasted = (string)e.DataObject.GetData(typeof(string));
+ var allAlphaNum = Regex.Replace(pasted, "[^A-Za-z0-9]", "");
+
+ // Only intercept if it looks like a full key (more than 5 chars)
+ if (allAlphaNum.Length <= 5) return;
+
+ e.CancelCommand(); // prevent default paste
+
+ _suppressAutoTab = true;
+ for (int i = 0; i < 5; i++)
+ {
+ int start = i * 5;
+ if (start < allAlphaNum.Length)
+ {
+ int len = System.Math.Min(5, allAlphaNum.Length - start);
+ _keyBoxes[i].Text = allAlphaNum.Substring(start, len).ToUpper();
+ }
+ }
+ _suppressAutoTab = false;
+ _keyBoxes[4].Focus();
+ _keyBoxes[4].CaretIndex = _keyBoxes[4].Text.Length;
+ ValidationMessage.Visibility = Visibility.Collapsed;
}
private void KeyBox_TextChanged(object sender, TextChangedEventArgs e)
@@ -36,28 +70,6 @@ namespace InstaSoftOfficeTool.Pages
var tb = (TextBox)sender;
var raw = tb.Text;
- // Detect full key paste (contains dash or longer than 5 chars with alphanumerics)
- var allAlphaNum = Regex.Replace(raw, "[^A-Za-z0-9]", "");
- if (allAlphaNum.Length > 5 && tb == _keyBoxes[0])
- {
- // Full key pasted — distribute across all boxes
- _suppressAutoTab = true;
- for (int i = 0; i < 5; i++)
- {
- int start = i * 5;
- if (start < allAlphaNum.Length)
- {
- int len = System.Math.Min(5, allAlphaNum.Length - start);
- _keyBoxes[i].Text = allAlphaNum.Substring(start, len).ToUpper();
- }
- }
- _suppressAutoTab = false;
- _keyBoxes[4].Focus();
- _keyBoxes[4].CaretIndex = _keyBoxes[4].Text.Length;
- ValidationMessage.Visibility = Visibility.Collapsed;
- return;
- }
-
// Clean non-alphanumeric chars
var cleaned = Regex.Replace(raw, "[^A-Za-z0-9]", "");
if (cleaned != raw)