재구성 AX Agent 설정과 채팅 UI를 Claude형 구조로
Some checks failed
Release Gate / gate (push) Has been cancelled
Some checks failed
Release Gate / gate (push) Has been cancelled
This commit is contained in:
@@ -3,9 +3,12 @@ using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using AxCopilot.Services;
|
||||
using FormsCursor = System.Windows.Forms.Cursor;
|
||||
using FormsScreen = System.Windows.Forms.Screen;
|
||||
|
||||
namespace AxCopilot.Views;
|
||||
|
||||
@@ -48,14 +51,19 @@ public partial class DockBarWindow : Window
|
||||
private DispatcherTimer? _glowTimer;
|
||||
|
||||
/// <summary>설정 저장 콜백 (위치 저장용).</summary>
|
||||
public Action<double, double>? OnPositionChanged { get; set; }
|
||||
public Action<string, double, double>? OnPositionChanged { get; set; }
|
||||
|
||||
public DockBarWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
MouseLeftButtonDown += (_, e) => { if (e.LeftButton == MouseButtonState.Pressed) try { DragMove(); } catch { } };
|
||||
LocationChanged += (_, _) => OnPositionChanged?.Invoke(Left, Top);
|
||||
LocationChanged += (_, _) =>
|
||||
{
|
||||
var deviceName = GetCurrentMonitorDeviceName();
|
||||
if (!string.IsNullOrWhiteSpace(deviceName))
|
||||
OnPositionChanged?.Invoke(deviceName, Left, Top);
|
||||
};
|
||||
Loaded += (_, _) => PositionDock();
|
||||
Closed += (_, _) => { _timer?.Stop(); _glowTimer?.Stop(); _cpuCounter?.Dispose(); };
|
||||
}
|
||||
@@ -65,7 +73,7 @@ public partial class DockBarWindow : Window
|
||||
{
|
||||
Opacity = Math.Clamp(opacity, 0.3, 1.0);
|
||||
|
||||
if (left >= 0 && top >= 0)
|
||||
if (left >= 0 && top >= 0 && IsWithinConnectedScreen(left, top))
|
||||
{
|
||||
Left = left;
|
||||
Top = top;
|
||||
@@ -269,11 +277,34 @@ public partial class DockBarWindow : Window
|
||||
|
||||
private void PositionDock()
|
||||
{
|
||||
var screen = SystemParameters.WorkArea;
|
||||
Left = (screen.Width - ActualWidth) / 2 + screen.Left;
|
||||
var screen = FormsScreen.FromPoint(FormsCursor.Position).WorkingArea;
|
||||
Left = screen.Left + (screen.Width - ActualWidth) / 2;
|
||||
Top = screen.Bottom - ActualHeight - 8;
|
||||
}
|
||||
|
||||
private string GetCurrentMonitorDeviceName()
|
||||
{
|
||||
var handle = new WindowInteropHelper(this).Handle;
|
||||
return handle != IntPtr.Zero
|
||||
? FormsScreen.FromHandle(handle).DeviceName
|
||||
: FormsScreen.FromPoint(FormsCursor.Position).DeviceName;
|
||||
}
|
||||
|
||||
private bool IsWithinConnectedScreen(double left, double top)
|
||||
{
|
||||
var width = ActualWidth > 0 ? ActualWidth : (Width > 0 ? Width : 420);
|
||||
var height = ActualHeight > 0 ? ActualHeight : (Height > 0 ? Height : 56);
|
||||
|
||||
foreach (var screen in FormsScreen.AllScreens)
|
||||
{
|
||||
var area = screen.WorkingArea;
|
||||
if (left >= area.Left && top >= area.Top && left + width <= area.Right && top + height <= area.Bottom)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OnTick(object? sender, EventArgs e)
|
||||
{
|
||||
if (_clockText != null)
|
||||
|
||||
Reference in New Issue
Block a user