Opens a modal when PlanningMergeConflict fires, listing conflicted files with options to open in VS Code, continue, or abort the merge. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
57 lines
1.8 KiB
C#
57 lines
1.8 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Input;
|
|
using ClaudeDo.Ui.ViewModels;
|
|
using ClaudeDo.Ui.Views.Planning;
|
|
|
|
namespace ClaudeDo.Ui.Views;
|
|
|
|
public partial class MainWindow : Window
|
|
{
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
KeyDown += OnWindowKeyDown;
|
|
DataContextChanged += OnDataContextChanged;
|
|
}
|
|
|
|
private void OnDataContextChanged(object? sender, EventArgs e)
|
|
{
|
|
if (DataContext is IslandsShellViewModel vm)
|
|
{
|
|
vm.ShowConflictDialog = async (conflictVm) =>
|
|
{
|
|
var modal = new ConflictResolutionView { DataContext = conflictVm };
|
|
await modal.ShowDialog(this);
|
|
};
|
|
}
|
|
}
|
|
|
|
private void OnWindowKeyDown(object? sender, KeyEventArgs e)
|
|
{
|
|
if (e.Key == Key.Space
|
|
&& FocusManager?.GetFocusedElement() is not TextBox
|
|
&& DataContext is IslandsShellViewModel vm)
|
|
{
|
|
e.Handled = true;
|
|
_ = vm.ToggleSelectedDoneAsync();
|
|
}
|
|
}
|
|
|
|
private void OnTitleBarPressed(object? sender, PointerPressedEventArgs e)
|
|
{
|
|
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
|
|
BeginMoveDrag(e);
|
|
}
|
|
private void OnMinimize(object? s, Avalonia.Interactivity.RoutedEventArgs e) =>
|
|
WindowState = WindowState.Minimized;
|
|
private void OnToggleMax(object? s, Avalonia.Interactivity.RoutedEventArgs e) =>
|
|
WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
|
|
private void OnClose(object? s, Avalonia.Interactivity.RoutedEventArgs e) => Close();
|
|
|
|
protected override void OnSizeChanged(SizeChangedEventArgs e)
|
|
{
|
|
base.OnSizeChanged(e);
|
|
if (DataContext is IslandsShellViewModel vm) vm.WindowWidth = Bounds.Width;
|
|
}
|
|
}
|