From 1960a436e0d00987cb6fd4165df2c159eb9dc871 Mon Sep 17 00:00:00 2001 From: Scott Hanselman Date: Wed, 22 Apr 2026 22:28:53 -0700 Subject: [PATCH] fix: address WinUI3 code review findings (#203) - Add AutomationProperties.AutomationId to all interactive controls - Add AutomationProperties.Name to 4 icon-only WebChat toolbar buttons - Localize all SetupWizard strings via LocalizationHelper + .resw - Replace hardcoded colors with ThemeResource brushes - Replace raw FontSize with typography styles where appropriate Prepares codebase for automated UI testing (winapp ui) and proper Dark/Light/HighContrast theme support. --- .../Strings/en-us/Resources.resw | 132 ++++++++++++++++++ .../Strings/fr-fr/Resources.resw | 132 ++++++++++++++++++ .../Strings/nl-nl/Resources.resw | 132 ++++++++++++++++++ .../Strings/zh-cn/Resources.resw | 132 ++++++++++++++++++ .../Strings/zh-tw/Resources.resw | 132 ++++++++++++++++++ .../Windows/ActivityStreamWindow.xaml | 10 +- .../Windows/CanvasWindow.xaml | 4 +- .../Windows/NotificationHistoryWindow.xaml | 6 +- .../Windows/SettingsWindow.xaml | 54 +++---- .../Windows/SetupWizardWindow.cs | 127 +++++++++-------- .../Windows/StatusDetailWindow.xaml | 10 +- .../Windows/WebChatWindow.xaml | 16 ++- 12 files changed, 781 insertions(+), 106 deletions(-) diff --git a/src/OpenClaw.Tray.WinUI/Strings/en-us/Resources.resw b/src/OpenClaw.Tray.WinUI/Strings/en-us/Resources.resw index 41f28d3..1782815 100644 --- a/src/OpenClaw.Tray.WinUI/Strings/en-us/Resources.resw +++ b/src/OpenClaw.Tray.WinUI/Strings/en-us/Resources.resw @@ -624,6 +624,138 @@ Use one of these options: Open Activity Stream + + + + OpenClaw Setup + + + Step 1 of 3 — Connect + + + Connect to your gateway + + + On your gateway host (Mac/Linux), run this to get a setup code: + + + Setup Code + + + Paste the setup code from your gateway dashboard + + + Or enter URL and token manually ▾ + + + Hide manual entry ▴ + + + Gateway URL + + + ws://192.168.1.x:18789 + + + 💡 Accepts ws://, wss://, http://, or https:// + + + Gateway Token + + + Paste your token here + + + Test Connection + + + ⏳ Connecting to gateway... + + + ✅ Connected! + + + ✅ Gateway reached! Device needs pairing approval. + +On your gateway host (Mac/Linux), run: + + openclaw devices approve {0} + + + ❌ Token doesn't match. + +💡 Check gateway auth token: + cat ~/.openclaw/openclaw.json | grep token + + + ❌ Origin not allowed. + +💡 Add this machine to gateway.controlUi.allowedOrigins. + + + ❌ Rate-limited. Wait a minute and try again. + + + ❌ Timed out. Check the URL and gateway is running. + + + ❌ Please enter a token + + + ⚠️ Please test the connection first + + + ✅ Setup code decoded — press Test Connection + + + Enable Node Mode (optional) + + + Node Mode lets your Windows machine run tasks for OpenClaw — like screen capture, camera access, and canvas drawing. + + + Enable Node Mode + + + Device ID: loading... + + + Device ID: (will be generated on first connect) + + + 📋 Copy Device ID + + + ✅ Copied! + + + To approve this node, run on your gateway host: + + + 💡 You can finish setup now — pairing will continue in the background. You'll get a notification when approved. + + + 🎉 You're all set! + + + OpenClaw Tray will connect to your gateway and start monitoring. + + + Back + + + Next + + + Finish + + + Step 2 of 3 — Node Mode + + + Step 3 of 3 — Done + + diff --git a/src/OpenClaw.Tray.WinUI/Strings/fr-fr/Resources.resw b/src/OpenClaw.Tray.WinUI/Strings/fr-fr/Resources.resw index 332c082..7a44441 100644 --- a/src/OpenClaw.Tray.WinUI/Strings/fr-fr/Resources.resw +++ b/src/OpenClaw.Tray.WinUI/Strings/fr-fr/Resources.resw @@ -624,6 +624,138 @@ Utilisez l'une de ces options : Créer un nouveau flux d'activités + + + + Configuration d'OpenClaw + + + Étape 1 sur 3 — Connexion + + + Connectez-vous à votre passerelle + + + Sur votre hôte passerelle (Mac/Linux), exécutez cette commande pour obtenir un code de configuration : + + + Code de configuration + + + Collez le code de configuration depuis le tableau de bord de votre passerelle + + + Ou entrez l'URL et le jeton manuellement ▾ + + + Masquer la saisie manuelle ▴ + + + URL de la passerelle + + + ws://192.168.1.x:18789 + + + 💡 Accepte ws://, wss://, http:// ou https:// + + + Jeton de la passerelle + + + Collez votre jeton ici + + + Tester la connexion + + + ⏳ Connexion à la passerelle... + + + ✅ Connecté ! + + + ✅ Passerelle atteinte ! L'appareil nécessite une approbation d'appariement. + +Sur votre hôte passerelle (Mac/Linux), exécutez : + + openclaw devices approve {0} + + + ❌ Le jeton ne correspond pas. + +💡 Vérifiez le jeton d'authentification de la passerelle : + cat ~/.openclaw/openclaw.json | grep token + + + ❌ Origine non autorisée. + +💡 Ajoutez cette machine à gateway.controlUi.allowedOrigins. + + + ❌ Trop de tentatives. Attendez une minute et réessayez. + + + ❌ Délai expiré. Vérifiez l'URL et que la passerelle fonctionne. + + + ❌ Veuillez entrer un jeton + + + ⚠️ Veuillez d'abord tester la connexion + + + ✅ Code de configuration décodé — appuyez sur Tester la connexion + + + Activer le mode nœud (optionnel) + + + Le mode nœud permet à votre machine Windows d'exécuter des tâches pour OpenClaw — comme la capture d'écran, l'accès caméra et le dessin sur canevas. + + + Activer le mode nœud + + + ID de l'appareil : chargement... + + + ID de l'appareil : (sera généré lors de la première connexion) + + + 📋 Copier l'ID de l'appareil + + + ✅ Copié ! + + + Pour approuver ce nœud, exécutez sur votre hôte passerelle : + + + 💡 Vous pouvez terminer la configuration maintenant — l'appariement continuera en arrière-plan. Vous recevrez une notification une fois approuvé. + + + 🎉 Tout est prêt ! + + + OpenClaw Tray se connectera à votre passerelle et commencera la surveillance. + + + Retour + + + Suivant + + + Terminer + + + Étape 2 sur 3 — Mode nœud + + + Étape 3 sur 3 — Terminé + + diff --git a/src/OpenClaw.Tray.WinUI/Strings/nl-nl/Resources.resw b/src/OpenClaw.Tray.WinUI/Strings/nl-nl/Resources.resw index 57117e7..c177a1c 100644 --- a/src/OpenClaw.Tray.WinUI/Strings/nl-nl/Resources.resw +++ b/src/OpenClaw.Tray.WinUI/Strings/nl-nl/Resources.resw @@ -624,6 +624,138 @@ Gebruik een van deze opties: Activiteitenstroom openen + + + + OpenClaw Instellen + + + Stap 1 van 3 — Verbinden + + + Verbind met uw gateway + + + Voer op uw gateway-host (Mac/Linux) deze opdracht uit om een installatiecode te krijgen: + + + Installatiecode + + + Plak de installatiecode van uw gateway-dashboard + + + Of voer URL en token handmatig in ▾ + + + Handmatige invoer verbergen ▴ + + + Gateway-URL + + + ws://192.168.1.x:18789 + + + 💡 Accepteert ws://, wss://, http:// of https:// + + + Gateway-token + + + Plak hier uw token + + + Verbinding testen + + + ⏳ Verbinden met gateway... + + + ✅ Verbonden! + + + ✅ Gateway bereikt! Apparaat moet worden goedgekeurd voor koppeling. + +Voer op uw gateway-host (Mac/Linux) uit: + + openclaw devices approve {0} + + + ❌ Token komt niet overeen. + +💡 Controleer het gateway-verificatietoken: + cat ~/.openclaw/openclaw.json | grep token + + + ❌ Oorsprong niet toegestaan. + +💡 Voeg deze machine toe aan gateway.controlUi.allowedOrigins. + + + ❌ Te veel verzoeken. Wacht een minuut en probeer opnieuw. + + + ❌ Time-out. Controleer de URL en of de gateway draait. + + + ❌ Voer een token in + + + ⚠️ Test eerst de verbinding + + + ✅ Installatiecode gedecodeerd — druk op Verbinding testen + + + Knooppuntmodus inschakelen (optioneel) + + + Knooppuntmodus laat uw Windows-machine taken uitvoeren voor OpenClaw — zoals schermopname, cameratoegang en canvas-tekenen. + + + Knooppuntmodus inschakelen + + + Apparaat-ID: laden... + + + Apparaat-ID: (wordt gegenereerd bij eerste verbinding) + + + 📋 Apparaat-ID kopiëren + + + ✅ Gekopieerd! + + + Om dit knooppunt goed te keuren, voer uit op uw gateway-host: + + + 💡 U kunt de installatie nu voltooien — koppeling gaat op de achtergrond door. U ontvangt een melding wanneer goedgekeurd. + + + 🎉 Alles is klaar! + + + OpenClaw Tray zal verbinding maken met uw gateway en beginnen met monitoren. + + + Vorige + + + Volgende + + + Voltooien + + + Stap 2 van 3 — Knooppuntmodus + + + Stap 3 van 3 — Gereed + + diff --git a/src/OpenClaw.Tray.WinUI/Strings/zh-cn/Resources.resw b/src/OpenClaw.Tray.WinUI/Strings/zh-cn/Resources.resw index 043519a..7221528 100644 --- a/src/OpenClaw.Tray.WinUI/Strings/zh-cn/Resources.resw +++ b/src/OpenClaw.Tray.WinUI/Strings/zh-cn/Resources.resw @@ -624,6 +624,138 @@ 打开活动流 + + + + OpenClaw 设置 + + + 第 1 步(共 3 步)— 连接 + + + 连接到您的网关 + + + 在您的网关主机(Mac/Linux)上运行以下命令获取设置码: + + + 设置码 + + + 粘贴来自网关仪表板的设置码 + + + 或手动输入 URL 和令牌 ▾ + + + 隐藏手动输入 ▴ + + + 网关地址 + + + ws://192.168.1.x:18789 + + + 💡 支持 ws://、wss://、http:// 或 https:// + + + 网关令牌 + + + 在此粘贴您的令牌 + + + 测试连接 + + + ⏳ 正在连接网关... + + + ✅ 连接成功! + + + ✅ 已连接到网关!设备需要配对批准。 + +在您的网关主机(Mac/Linux)上运行: + + openclaw devices approve {0} + + + ❌ 令牌不匹配。 + +💡 检查网关认证令牌: + cat ~/.openclaw/openclaw.json | grep token + + + ❌ 来源不被允许。 + +💡 将此机器添加到 gateway.controlUi.allowedOrigins。 + + + ❌ 请求过于频繁。请等待一分钟后重试。 + + + ❌ 连接超时。请检查 URL 和网关是否正在运行。 + + + ❌ 请输入令牌 + + + ⚠️ 请先测试连接 + + + ✅ 设置码已解码 — 请点击"测试连接" + + + 启用节点模式(可选) + + + 节点模式允许您的 Windows 电脑为 OpenClaw 执行任务 — 如屏幕截图、摄像头访问和画布绘制。 + + + 启用节点模式 + + + 设备 ID:加载中... + + + 设备 ID:(将在首次连接时生成) + + + 📋 复制设备 ID + + + ✅ 已复制! + + + 要批准此节点,请在网关主机上运行: + + + 💡 您可以现在完成设置 — 配对将在后台继续。获得批准后会收到通知。 + + + 🎉 一切就绪! + + + OpenClaw 托盘将连接到您的网关并开始监控。 + + + 上一步 + + + 下一步 + + + 完成 + + + 第 2 步(共 3 步)— 节点模式 + + + 第 3 步(共 3 步)— 完成 + + diff --git a/src/OpenClaw.Tray.WinUI/Strings/zh-tw/Resources.resw b/src/OpenClaw.Tray.WinUI/Strings/zh-tw/Resources.resw index e945810..e33d5c0 100644 --- a/src/OpenClaw.Tray.WinUI/Strings/zh-tw/Resources.resw +++ b/src/OpenClaw.Tray.WinUI/Strings/zh-tw/Resources.resw @@ -624,6 +624,138 @@ 打開串流活動 + + + + OpenClaw 設定 + + + 第 1 步(共 3 步)— 連線 + + + 連線到您的閘道器 + + + 在您的閘道器主機(Mac/Linux)上執行以下命令取得設定碼: + + + 設定碼 + + + 貼上來自閘道器儀表板的設定碼 + + + 或手動輸入 URL 和權杖 ▾ + + + 隱藏手動輸入 ▴ + + + 閘道器網址 + + + ws://192.168.1.x:18789 + + + 💡 支援 ws://、wss://、http:// 或 https:// + + + 閘道器權杖 + + + 在此貼上您的權杖 + + + 測試連線 + + + ⏳ 正在連線到閘道器... + + + ✅ 已連線! + + + ✅ 已連線到閘道器!裝置需要配對核准。 + +在您的閘道器主機(Mac/Linux)上執行: + + openclaw devices approve {0} + + + ❌ 權杖不符。 + +💡 檢查閘道器認證權杖: + cat ~/.openclaw/openclaw.json | grep token + + + ❌ 來源不被允許。 + +💡 將此機器加入 gateway.controlUi.allowedOrigins。 + + + ❌ 請求過於頻繁。請等待一分鐘後重試。 + + + ❌ 連線逾時。請檢查網址和閘道器是否正在執行。 + + + ❌ 請輸入權杖 + + + ⚠️ 請先測試連線 + + + ✅ 設定碼已解碼 — 請點擊「測試連線」 + + + 啟用節點模式(選用) + + + 節點模式允許您的 Windows 電腦為 OpenClaw 執行任務 — 如螢幕擷取、攝影機存取和畫布繪製。 + + + 啟用節點模式 + + + 裝置 ID:載入中... + + + 裝置 ID:(將在首次連線時產生) + + + 📋 複製裝置 ID + + + ✅ 已複製! + + + 要核准此節點,請在閘道器主機上執行: + + + 💡 您可以現在完成設定 — 配對將在背景繼續。獲得核准後會收到通知。 + + + 🎉 一切就緒! + + + OpenClaw 系統匣將連線到您的閘道器並開始監控。 + + + 上一步 + + + 下一步 + + + 完成 + + + 第 2 步(共 3 步)— 節點模式 + + + 第 3 步(共 3 步)— 完成 + + diff --git a/src/OpenClaw.Tray.WinUI/Windows/ActivityStreamWindow.xaml b/src/OpenClaw.Tray.WinUI/Windows/ActivityStreamWindow.xaml index 371f98a..6958a78 100644 --- a/src/OpenClaw.Tray.WinUI/Windows/ActivityStreamWindow.xaml +++ b/src/OpenClaw.Tray.WinUI/Windows/ActivityStreamWindow.xaml @@ -25,7 +25,7 @@ Foreground="{ThemeResource TextFillColorSecondaryBrush}"/> - + @@ -34,7 +34,7 @@ - @@ -90,9 +90,9 @@ - - - - @@ -52,10 +56,10 @@ - + FontFamily="Consolas" Style="{StaticResource CaptionTextBlockStyle}"/>