Skip to content

Commit b015d55

Browse files
committed
Add animation keys, TableView util, and code cleanup
Added new animation key constants for navigation scenarios in AnimationHelper. Improved nullability handling in container lookup. Introduced FindVisualElementFromTableView utility in PlatUtils for locating child elements in TableView rows. Removed unused field and cleaned up code in BaseViewModelWin.
1 parent 7930fef commit b015d55

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Dimmer/Dimmer.WinUI/Utils/AnimationHelper.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ public static class AnimationHelper
1313
// Define your keys here to avoid "Magic Strings"
1414
public const string Key_ListToDetail = "ForwardConnectedAnimation";
1515
public const string Key_DetailToList = "BackConnectedAnimation";
16+
public const string Key_ToViewQueue = "ViewNowPlayingQueueAnim";
17+
public const string Key_NowPlayingPage = "ViewNowPlayingPage";
18+
public const string Key_ToViewSingleSongPopUp = "ViewSingleSongPopup";
1619
public const string Key_ArtistToSong = "ArtistToSongDetailsAnim";
1720
public const string Key_Forward = "ForwardConnectedAnimation";
1821
public const string Key_Back = "BackConnectedAnimation";
1922

2023
public const string Key_DetailToEdit = "SwingFromSongDetailToEdit";
2124
/// <summary>
2225
/// Prepares the animation BEFORE navigation (Call this on Click)
26+
/// Can also be called in OnNavigatedTo so as to prepare the objects before they're loaded
2327
/// </summary>
2428
public static void Prepare(string key, UIElement? source, bool isList = false)
2529
{
@@ -93,7 +97,7 @@ public static async Task TryStartListReturn(ListViewBase listView, object itemTo
9397

9498
// 3. Enter a Retry Loop to find the container
9599
// We try 10 times with a 20ms delay (total approx 200ms wait max)
96-
FrameworkElement container = null;
100+
FrameworkElement? container = null;
97101
int retries = 0;
98102
const int maxRetries = 10;
99103

Dimmer/Dimmer.WinUI/Utils/StaticUtils/PlatUtils.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,13 @@ public static void ShowContextMenu(this Element element)
587587
FlyoutBase.ShowAttachedFlyout(platformView);
588588
}
589589
}
590-
590+
public static UIElement FindVisualElementFromTableView(TableView table,
591+
object concernedElt, string childName)
592+
{
593+
var row = table.ContainerFromItem(concernedElt) as FrameworkElement;
594+
var image = PlatUtils.FindVisualChild<Image>(row, "coverArtImage");
595+
return image;
596+
}
591597

592598
public static T? FindVisualChild<T>(DependencyObject? parent, string? childName) where T : FrameworkElement
593599
{

Dimmer/Dimmer.WinUI/ViewModel/BaseViewModelWin.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
namespace Dimmer.WinUI.ViewModel;
1515

1616
public partial class BaseViewModelWin : BaseViewModel, IArtistActions
17-
1817
{
1918

2019
public readonly IMauiWindowManagerService windowManager;
@@ -24,7 +23,7 @@ public partial class BaseViewModelWin : BaseViewModel, IArtistActions
2423

2524
public SessionManagementViewModel SessionMgtVM { get; }
2625

27-
private readonly IFolderPicker _folderPicker;
26+
2827
public DimmerMultiWindowCoordinator DimmerMultiWindowCoordinator;
2928

3029
public BaseViewModelWin(IDimmerStateService dimmerStateService,
@@ -46,8 +45,6 @@ public BaseViewModelWin(IDimmerStateService dimmerStateService,
4645
};
4746

4847
windowManager = mauiWindowManagerService;
49-
//AddNextEvent += BaseViewModelWin_AddNextEvent;
50-
//MainWindowActivated
5148

5249
this.WhenPropertyChange(nameof(base.IsAppScanning), v => (base.IsAppScanning))
5350
.ObserveOn(RxSchedulers.UI)

0 commit comments

Comments
 (0)