Skip to content

Commit b658376

Browse files
committed
add SRP column sorting
1 parent bb5a539 commit b658376

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

UnityLauncherPro/MainWindow.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
</DataGridTemplateColumn.CellTemplate>
184184
</DataGridTemplateColumn>
185185

186-
<DataGridTextColumn Header="Branch" x:Name="txtColumnRenderPipeline" Binding="{Binding SRP}" CellStyle="{StaticResource NoFocusCellStyle}" ClipboardContentBinding="{x:Null}" IsReadOnly="True" Width="60">
186+
<DataGridTextColumn Header="SRP" x:Name="txtColumnRenderPipeline" Binding="{Binding SRP}" CellStyle="{StaticResource NoFocusCellStyle}" ClipboardContentBinding="{x:Null}" IsReadOnly="True" Width="50">
187187
<DataGridTextColumn.HeaderTemplate>
188188
<DataTemplate>
189189
<TextBlock Text="SRP" IsHitTestVisible="False" />

UnityLauncherPro/MainWindow.xaml.cs

+6
Original file line numberDiff line numberDiff line change
@@ -3334,6 +3334,12 @@ public int Compare(Object a, Object b)
33343334
if (((Project)a).TargetPlatform == null) return direction == ListSortDirection.Ascending ? -1 : 1;
33353335
if (((Project)b).TargetPlatform == null) return direction == ListSortDirection.Ascending ? 1 : -1;
33363336
return direction == ListSortDirection.Ascending ? ((Project)a).TargetPlatform.CompareTo(((Project)b).TargetPlatform) : ((Project)b).TargetPlatform.CompareTo(((Project)a).TargetPlatform);
3337+
case "SRP":
3338+
// handle null values
3339+
if (((Project)a).SRP == null && ((Project)b).SRP == null) return 0;
3340+
if (((Project)a).SRP == null) return direction == ListSortDirection.Ascending ? -1 : 1;
3341+
if (((Project)b).SRP == null) return direction == ListSortDirection.Ascending ? 1 : -1;
3342+
return direction == ListSortDirection.Ascending ? ((Project)a).SRP.CompareTo(((Project)b).SRP) : ((Project)b).SRP.CompareTo(((Project)a).SRP);
33373343
default:
33383344
return 0;
33393345
}

0 commit comments

Comments
 (0)