Skip to content

Commit

Permalink
Merge pull request #205 from wieslawsoltes/DoNotUseFirstCalls
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes authored Jul 20, 2021
2 parents 27c15b9 + 75eb2ab commit 299d239
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Dock.Model/DockManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,21 +320,24 @@ private bool DockDockIntoDock(IDock sourceDock, IDock targetDock, DragAction act

if (visible.Count == 1)
{
if (DockDockableIntoDock(visible.First(), targetDock, action, operation, bExecute) == false)
var sourceDockable = visible.FirstOrDefault();
if (sourceDockable is null || DockDockableIntoDock(sourceDockable, targetDock, action, operation, bExecute) == false)
{
return false;
}
}
else
{
if (DockDockableIntoDock(visible.First(), targetDock, action, operation, bExecute) == false)
var sourceDockable = visible.FirstOrDefault();
if (sourceDockable is null || DockDockableIntoDock(sourceDockable, targetDock, action, operation, bExecute) == false)
{
return false;
}

foreach (var dockable in visible.Skip(1))
{
if (DockDockableIntoDockable(dockable, visible.First(), action, bExecute) == false)
var targetDockable = visible.FirstOrDefault();
if (targetDockable is null || DockDockableIntoDockable(dockable, targetDockable, action, bExecute) == false)
{
return false;
}
Expand Down

0 comments on commit 299d239

Please sign in to comment.