Skip to content

Commit 7dc84ef

Browse files
committed
Code Quality: Combined statements and updated comments
1 parent 8f5a5e4 commit 7dc84ef

File tree

1 file changed

+14
-33
lines changed

1 file changed

+14
-33
lines changed

src/Files.App/Views/Layouts/BaseLayoutPage.cs

+14-33
Original file line numberDiff line numberDiff line change
@@ -1216,14 +1216,9 @@ private void RefreshItem(SelectorItem container, object item, bool inRecycleQueu
12161216

12171217
protected internal void FileListItem_PointerPressed(object sender, PointerRoutedEventArgs e)
12181218
{
1219-
if (!itemDragging)
1220-
{
1221-
// No need to bring the window to the front again
1222-
if (MainWindow.Instance.SetCanWindowToFront(true))
1223-
{
1224-
Win32Helper.BringToForegroundEx(new(MainWindow.Instance.WindowHandle));
1225-
}
1226-
}
1219+
// Set can window to front and bring the window to the front if necessary
1220+
if ((!itemDragging) && MainWindow.Instance.SetCanWindowToFront(true))
1221+
Win32Helper.BringToForegroundEx(new(MainWindow.Instance.WindowHandle));
12271222

12281223
if (sender is not SelectorItem selectorItem)
12291224
return;
@@ -1250,6 +1245,7 @@ protected internal void FileListItem_PointerPressed(object sender, PointerRouted
12501245

12511246
protected internal void FileListItem_PointerEntered(object sender, PointerRoutedEventArgs e)
12521247
{
1248+
// Set can window to front before the item is dragged
12531249
if (sender is SelectorItem selectorItem && selectorItem.IsSelected)
12541250
MainWindow.Instance.SetCanWindowToFront(false);
12551251

@@ -1299,9 +1295,9 @@ selectedItems is not null &&
12991295

13001296
protected internal void FileListItem_PointerExited(object sender, PointerRoutedEventArgs e)
13011297
{
1298+
// Set can window to front
13021299
if (!itemDragging)
13031300
MainWindow.Instance.SetCanWindowToFront(true);
1304-
// No need to bring the window to the front
13051301

13061302
if (!UserSettingsService.FoldersSettingsService.SelectFilesOnHover)
13071303
return;
@@ -1312,38 +1308,23 @@ protected internal void FileListItem_PointerExited(object sender, PointerRoutedE
13121308

13131309
protected void FileListItem_Tapped(object sender, TappedRoutedEventArgs e)
13141310
{
1315-
if (!itemDragging)
1316-
{
1317-
// No need to bring the window to the front again
1318-
if (MainWindow.Instance.SetCanWindowToFront(true))
1319-
{
1320-
Win32Helper.BringToForegroundEx(new(MainWindow.Instance.WindowHandle));
1321-
}
1322-
}
1311+
// Set can window to front and bring the window to the front if necessary
1312+
if ((!itemDragging) && MainWindow.Instance.SetCanWindowToFront(true))
1313+
Win32Helper.BringToForegroundEx(new(MainWindow.Instance.WindowHandle));
13231314
}
13241315

13251316
protected void FileListItem_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
13261317
{
1327-
if (!itemDragging)
1328-
{
1329-
// No need to bring the window to the front again
1330-
if (MainWindow.Instance.SetCanWindowToFront(true))
1331-
{
1332-
Win32Helper.BringToForegroundEx(new(MainWindow.Instance.WindowHandle));
1333-
}
1334-
}
1318+
// Set can window to front and bring the window to the front if necessary
1319+
if ((!itemDragging) && MainWindow.Instance.SetCanWindowToFront(true))
1320+
Win32Helper.BringToForegroundEx(new(MainWindow.Instance.WindowHandle));
13351321
}
13361322

13371323
protected void FileListItem_RightTapped(object sender, RightTappedRoutedEventArgs e)
13381324
{
1339-
if (!itemDragging)
1340-
{
1341-
// No need to bring the window to the front again
1342-
if (MainWindow.Instance.SetCanWindowToFront(true))
1343-
{
1344-
Win32Helper.BringToForegroundEx(new(MainWindow.Instance.WindowHandle));
1345-
}
1346-
}
1325+
// Set can window to front and bring the window to the front if necessary
1326+
if ((!itemDragging) && MainWindow.Instance.SetCanWindowToFront(true))
1327+
Win32Helper.BringToForegroundEx(new(MainWindow.Instance.WindowHandle));
13471328

13481329
var rightClickedItem = GetItemFromElement(sender);
13491330

0 commit comments

Comments
 (0)