From 26989dcd4db2af887e5c1a0bb2ac14bf2cc4c84c Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Thu, 5 Mar 2026 11:07:08 -0500 Subject: [PATCH] Fix obsolete IClipboard.GetTextAsync() warnings Replace GetTextAsync() with ClipboardExtensions.TryGetTextAsync() in both QuerySessionControl and MainWindow paste handlers. Closes #3 Co-Authored-By: Claude Opus 4.6 --- src/PlanViewer.App/Controls/QuerySessionControl.axaml.cs | 3 ++- src/PlanViewer.App/MainWindow.axaml.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PlanViewer.App/Controls/QuerySessionControl.axaml.cs b/src/PlanViewer.App/Controls/QuerySessionControl.axaml.cs index 2dcb52f..7bc9cfa 100644 --- a/src/PlanViewer.App/Controls/QuerySessionControl.axaml.cs +++ b/src/PlanViewer.App/Controls/QuerySessionControl.axaml.cs @@ -8,6 +8,7 @@ using System.Xml.Linq; using Avalonia.Controls; using Avalonia.Input; +using Avalonia.Input.Platform; using Avalonia.Interactivity; using Avalonia.Layout; using Avalonia.Media; @@ -120,7 +121,7 @@ private void SetupEditorContextMenu() { var clipboard = TopLevel.GetTopLevel(this)?.Clipboard; if (clipboard == null) return; - var text = await clipboard.GetTextAsync(); + var text = await clipboard.TryGetTextAsync(); if (string.IsNullOrEmpty(text)) return; QueryEditor.TextArea.PerformTextInput(text); }; diff --git a/src/PlanViewer.App/MainWindow.axaml.cs b/src/PlanViewer.App/MainWindow.axaml.cs index 3304a71..726e80a 100644 --- a/src/PlanViewer.App/MainWindow.axaml.cs +++ b/src/PlanViewer.App/MainWindow.axaml.cs @@ -9,6 +9,7 @@ using System.Xml.Linq; using Avalonia.Controls; using Avalonia.Input; +using Avalonia.Input.Platform; using Avalonia.Interactivity; using Avalonia.Layout; using Avalonia.Media; @@ -370,7 +371,7 @@ private async Task PasteXmlAsync() var clipboard = this.Clipboard; if (clipboard == null) return; - var xml = await clipboard.GetTextAsync(); + var xml = await clipboard.TryGetTextAsync(); if (string.IsNullOrWhiteSpace(xml)) { ShowError("The clipboard does not contain any text.");