using System.Windows; using System.Windows.Input; using AxCopilot.Models; namespace AxCopilot.Views; public partial class LauncherWindow { private QuickLookWindow? _quickLookWindow; private async void QuickActionChip_Click(object sender, MouseButtonEventArgs e) { if (((FrameworkElement)sender).DataContext is not QuickActionChip chip) return; var expanded = Environment.ExpandEnvironmentVariables(chip.Path); Hide(); try { await Task.Run(() => System.Diagnostics.Process.Start( new System.Diagnostics.ProcessStartInfo(expanded) { UseShellExecute = true })); _ = Task.Run(() => Services.UsageRankingService.RecordExecution(chip.Path)); } catch (Exception ex) { Services.LogService.Error($"빠른 실행 칩 열기 실패: {expanded} - {ex.Message}"); } } internal void ToggleQuickLook() { if (_quickLookWindow != null) { _quickLookWindow.Close(); _quickLookWindow = null; return; } if (_vm.SelectedItem?.Data is not Services.IndexEntry indexEntry) return; var path = Environment.ExpandEnvironmentVariables(indexEntry.Path); if (!System.IO.File.Exists(path) && !System.IO.Directory.Exists(path)) return; var qlLeft = Left + ActualWidth + 8; var qlTop = Top; var screen = System.Windows.Forms.Screen.FromHandle( new System.Windows.Interop.WindowInteropHelper(this).Handle); if (qlLeft + 400 > screen.WorkingArea.Right) qlLeft = Left - 408; _quickLookWindow = new QuickLookWindow(path, this) { Left = qlLeft, Top = qlTop }; _quickLookWindow.Closed += (_, _) => _quickLookWindow = null; _quickLookWindow.Show(); } }