Skip to content

Commit

Permalink
add SRP column sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
unitycoder committed Nov 28, 2024
1 parent bb5a539 commit b658376
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion UnityLauncherPro/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

<DataGridTextColumn Header="Branch" x:Name="txtColumnRenderPipeline" Binding="{Binding SRP}" CellStyle="{StaticResource NoFocusCellStyle}" ClipboardContentBinding="{x:Null}" IsReadOnly="True" Width="60">
<DataGridTextColumn Header="SRP" x:Name="txtColumnRenderPipeline" Binding="{Binding SRP}" CellStyle="{StaticResource NoFocusCellStyle}" ClipboardContentBinding="{x:Null}" IsReadOnly="True" Width="50">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="SRP" IsHitTestVisible="False" />
Expand Down
6 changes: 6 additions & 0 deletions UnityLauncherPro/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3334,6 +3334,12 @@ public int Compare(Object a, Object b)
if (((Project)a).TargetPlatform == null) return direction == ListSortDirection.Ascending ? -1 : 1;
if (((Project)b).TargetPlatform == null) return direction == ListSortDirection.Ascending ? 1 : -1;
return direction == ListSortDirection.Ascending ? ((Project)a).TargetPlatform.CompareTo(((Project)b).TargetPlatform) : ((Project)b).TargetPlatform.CompareTo(((Project)a).TargetPlatform);
case "SRP":
// handle null values
if (((Project)a).SRP == null && ((Project)b).SRP == null) return 0;
if (((Project)a).SRP == null) return direction == ListSortDirection.Ascending ? -1 : 1;
if (((Project)b).SRP == null) return direction == ListSortDirection.Ascending ? 1 : -1;
return direction == ListSortDirection.Ascending ? ((Project)a).SRP.CompareTo(((Project)b).SRP) : ((Project)b).SRP.CompareTo(((Project)a).SRP);
default:
return 0;
}
Expand Down

0 comments on commit b658376

Please sign in to comment.