mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
fix: crash when drag & drop on macOS
This commit is contained in:
parent
f586979ac5
commit
eca37e8d70
3 changed files with 7 additions and 4 deletions
|
@ -43,6 +43,7 @@ namespace SourceGit.Views
|
||||||
private void OnRowHeaderDragOver(object sender, DragEventArgs e)
|
private void OnRowHeaderDragOver(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (DataContext is ViewModels.InteractiveRebase vm &&
|
if (DataContext is ViewModels.InteractiveRebase vm &&
|
||||||
|
e.Data.Contains("InteractiveRebaseItem") &&
|
||||||
e.Data.Get("InteractiveRebaseItem") is ViewModels.InteractiveRebaseItem src &&
|
e.Data.Get("InteractiveRebaseItem") is ViewModels.InteractiveRebaseItem src &&
|
||||||
sender is Border { DataContext: ViewModels.InteractiveRebaseItem dst } border &&
|
sender is Border { DataContext: ViewModels.InteractiveRebaseItem dst } border &&
|
||||||
src != dst)
|
src != dst)
|
||||||
|
|
|
@ -216,7 +216,8 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
private void DropTab(object sender, DragEventArgs e)
|
private void DropTab(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.Get("MovedTab") is ViewModels.LauncherPage moved &&
|
if (e.Data.Contains("MovedTab") &&
|
||||||
|
e.Data.Get("MovedTab") is ViewModels.LauncherPage moved &&
|
||||||
sender is Border { DataContext: ViewModels.LauncherPage to } &&
|
sender is Border { DataContext: ViewModels.LauncherPage to } &&
|
||||||
to != moved)
|
to != moved)
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTreeViewKeyDown(object sender, KeyEventArgs e)
|
private void OnTreeViewKeyDown(object _, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (TreeContainer.SelectedItem is ViewModels.RepositoryNode node && e.Key == Key.Enter)
|
if (TreeContainer.SelectedItem is ViewModels.RepositoryNode node && e.Key == Key.Enter)
|
||||||
{
|
{
|
||||||
|
@ -163,7 +163,7 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
private void DropOnTreeView(object sender, DragEventArgs e)
|
private void DropOnTreeView(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.Get("MovedRepositoryTreeNode") is ViewModels.RepositoryNode moved)
|
if (e.Data.Contains("MovedRepositoryTreeNode") && e.Data.Get("MovedRepositoryTreeNode") is ViewModels.RepositoryNode moved)
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
ViewModels.Welcome.Instance.MoveNode(moved, null);
|
ViewModels.Welcome.Instance.MoveNode(moved, null);
|
||||||
|
@ -224,7 +224,8 @@ namespace SourceGit.Views
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Data.Get("MovedRepositoryTreeNode") is ViewModels.RepositoryNode moved)
|
if (e.Data.Contains("MovedRepositoryTreeNode") &&
|
||||||
|
e.Data.Get("MovedRepositoryTreeNode") is ViewModels.RepositoryNode moved)
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue