27 lines
977 B
C#
27 lines
977 B
C#
using Avalonia.Controls;
|
|
using Avalonia.Input;
|
|
using Avalonia.VisualTree;
|
|
using ClaudeDo.Ui.ViewModels.Islands;
|
|
|
|
namespace ClaudeDo.Ui.Views.MissionControl;
|
|
|
|
public partial class MonitorPaneView : UserControl
|
|
{
|
|
public MonitorPaneView() => InitializeComponent();
|
|
|
|
private async void OnHeaderPressed(object? sender, PointerPressedEventArgs e)
|
|
{
|
|
if (DataContext is not TaskMonitorViewModel m || m.SubscribedTaskId is not { } id) return;
|
|
if (e.Source is not Avalonia.Visual src) return;
|
|
if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
|
|
|
|
// Don't start a drag when the press landed on a header action button.
|
|
var button = src as Button ?? src.FindAncestorOfType<Button>();
|
|
if (button is not null) return;
|
|
|
|
var data = new DataTransfer();
|
|
data.Add(DataTransferItem.Create(MissionControlView.PaneFormat, id));
|
|
await DragDrop.DoDragDropAsync(e, data, DragDropEffects.Move);
|
|
}
|
|
}
|