Skip to content

Commit d3746fe

Browse files
committed
review changes
1 parent ff3239f commit d3746fe

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

WolvenKit.App/ViewModels/Dialogs/AddRadioExtFilesDialogViewModel.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,23 +128,19 @@ public void AddSongs(List<RadioSongItem> newItems)
128128

129129
public void RemoveSong(RadioSongItem songItem)
130130
{
131-
if (!SongItems.Select(s => s.FilePath).ToList().Contains(songItem.FilePath))
131+
var index = SongItems.FindIndex(s => s.FilePath == songItem.FilePath);
132+
if (index == -1)
132133
{
133134
return;
134135
}
135136

136-
var songItems = SongItems.ToList();
137-
songItems.Remove(songItem);
138-
139-
if (songItems.FirstOrDefault(f => f.Index > 0) is not null)
137+
SongItems.RemoveAt(index);
138+
for (var i = index; i < SongItems.Count; i++)
140139
{
141-
for (var i = 0; i < songItems.Count; i++)
142-
{
143-
songItems[i].Index = i;
144-
}
140+
SongItems[i].Index = i;
145141
}
146142

147-
SongItems = songItems;
143+
SongItems = SongItems.ToList();
148144
}
149145

150146
public void MoveSongOrder(RadioSongItem? songItem, int newIndex)

WolvenKit/Views/Dialogs/Windows/AddRadioExtFilesDialogView.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
IconPack="Material"
179179
Kind="DragVertical"
180180
Size="{DynamicResource WolvenKitIconTiny}"
181+
Tag="DragHandle"
181182
ToolTip="Drag to reorder" />
182183
</DataTemplate>
183184
</syncfusion:GridTemplateColumn.CellTemplate>

0 commit comments

Comments
 (0)