using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Threading; using AxCopilot.SDK; using AxCopilot.Views; namespace AxCopilot.Handlers; public class ColorPickHandler : IActionHandler { public string? Prefix => "pick"; public PluginMetadata Metadata => new PluginMetadata("ColorPick", "스포이드 색상 추출 — pick", "1.0", "AX"); public Task> GetItemsAsync(string query, CancellationToken ct) { return Task.FromResult((IEnumerable)new _003C_003Ez__ReadOnlySingleElementList(new LauncherItem("스포이드로 화면 색상 추출", "Enter → 스포이드 모드 진입 · 화면 아무 곳을 클릭하면 색상 코드 추출 · Esc 취소", null, "__PICK__", null, "\ue771"))); } public async Task ExecuteAsync(LauncherItem item, CancellationToken ct) { object data = item.Data; if (!(data is string s) || s != "__PICK__") { return; } await Task.Delay(200, ct); Application current = Application.Current; if (current == null) { return; } ((DispatcherObject)current).Dispatcher.Invoke((Action)delegate { EyeDropperWindow eyeDropperWindow = new EyeDropperWindow(); eyeDropperWindow.ShowDialog(); if (eyeDropperWindow.PickedColor.HasValue) { ColorPickResultWindow colorPickResultWindow = new ColorPickResultWindow(eyeDropperWindow.PickedColor.Value, eyeDropperWindow.PickX, eyeDropperWindow.PickY); colorPickResultWindow.Show(); } }); } }