From ab78de8078b141b9ef987a74fcc370d1de942acb Mon Sep 17 00:00:00 2001 From: PeterZhong Date: Mon, 16 Jun 2025 00:35:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E8=A1=8C=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E5=92=8C=E5=9B=9E=E8=BD=A6=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/dockpane/DialogDockpane.xaml | 2 +- ui/dockpane/DialogDockpane.xaml.cs | 40 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/ui/dockpane/DialogDockpane.xaml b/ui/dockpane/DialogDockpane.xaml index b62fab7..fd7b7fc 100644 --- a/ui/dockpane/DialogDockpane.xaml +++ b/ui/dockpane/DialogDockpane.xaml @@ -61,7 +61,7 @@ - + diff --git a/ui/dockpane/DialogDockpane.xaml.cs b/ui/dockpane/DialogDockpane.xaml.cs index 6d535d6..306cf19 100644 --- a/ui/dockpane/DialogDockpane.xaml.cs +++ b/ui/dockpane/DialogDockpane.xaml.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Collections.Specialized; using System.ComponentModel; using System.IO; using System.Net.Http; @@ -14,6 +15,7 @@ using Microsoft.Extensions.Logging; using System.Text.Json; using System.Threading; using System.Windows.Documents; +using System.Windows.Input; using System.Windows.Media; using ArcGIS.Desktop.Core; using ArcGIS.Desktop.Core.Geoprocessing; @@ -639,5 +641,43 @@ namespace LinkToolAddin.ui.dockpane string model = ModelComboBox.SelectedValue.ToString(); log.Info(model); } + + private void QuestionTextbox_OnKeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) + { + // Shift + Enter: 插入换行 + QuestionTextbox.SelectedText = Environment.NewLine; + e.Handled = true; + } + else + { + // Enter: 触发发送 + e.Handled = true; + SendButton_OnClick(sender, null); + } + } + } + + private void QuestionTextbox_OnPreviewKeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Enter) + { + if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) + { + // Shift + Enter: 插入换行 + QuestionTextbox.SelectedText = Environment.NewLine; + e.Handled = true; + } + else + { + // Enter: 触发发送 + e.Handled = true; + SendButton_OnClick(sender, null); + } + } + } } }