2024-06-13 02:55:22 -07:00
|
|
|
using Avalonia;
|
2024-06-11 00:30:06 -07:00
|
|
|
using Avalonia.Controls;
|
|
|
|
using Avalonia.Input;
|
|
|
|
|
|
|
|
namespace SourceGit.Views
|
|
|
|
{
|
2024-06-12 20:54:10 -07:00
|
|
|
public partial class BranchCompare : ChromelessWindow
|
2024-06-11 00:30:06 -07:00
|
|
|
{
|
|
|
|
public BranchCompare()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void MaximizeOrRestoreWindow(object sender, TappedEventArgs e)
|
|
|
|
{
|
2024-06-13 05:26:24 -07:00
|
|
|
_pressedTitleBar = false;
|
|
|
|
|
2024-06-11 00:30:06 -07:00
|
|
|
if (WindowState == WindowState.Maximized)
|
|
|
|
WindowState = WindowState.Normal;
|
|
|
|
else
|
|
|
|
WindowState = WindowState.Maximized;
|
|
|
|
|
|
|
|
e.Handled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
|
|
|
{
|
2024-06-13 02:55:22 -07:00
|
|
|
if (e.ClickCount != 2)
|
|
|
|
_pressedTitleBar = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void MoveWindow(object sender, PointerEventArgs e)
|
|
|
|
{
|
|
|
|
if (!_pressedTitleBar)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var visual = (Visual)e.Source;
|
|
|
|
BeginMoveDrag(new PointerPressedEventArgs(
|
|
|
|
e.Source,
|
|
|
|
e.Pointer,
|
|
|
|
visual,
|
|
|
|
e.GetPosition(visual),
|
|
|
|
e.Timestamp,
|
|
|
|
new PointerPointProperties(RawInputModifiers.None, PointerUpdateKind.LeftButtonPressed),
|
|
|
|
e.KeyModifiers));
|
|
|
|
}
|
|
|
|
|
|
|
|
private void EndMoveWindow(object sender, PointerReleasedEventArgs e)
|
|
|
|
{
|
|
|
|
_pressedTitleBar = false;
|
2024-06-11 00:30:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
private void OnChangeContextRequested(object sender, ContextRequestedEventArgs e)
|
|
|
|
{
|
|
|
|
if (DataContext is ViewModels.BranchCompare vm && sender is ChangeCollectionView view)
|
|
|
|
{
|
|
|
|
var menu = vm.CreateChangeContextMenu();
|
|
|
|
view.OpenContextMenu(menu);
|
|
|
|
}
|
|
|
|
|
|
|
|
e.Handled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnPressedSHA(object sender, PointerPressedEventArgs e)
|
|
|
|
{
|
|
|
|
if (DataContext is ViewModels.BranchCompare vm && sender is TextBlock block)
|
|
|
|
vm.NavigateTo(block.Text);
|
|
|
|
|
|
|
|
e.Handled = true;
|
|
|
|
}
|
2024-06-13 02:55:22 -07:00
|
|
|
|
|
|
|
private bool _pressedTitleBar = false;
|
2024-06-11 00:30:06 -07:00
|
|
|
}
|
|
|
|
}
|