public int CompareTo([AllowNull] ImageData other) { if (other is null) { return(1); } if (ManifestImage is null || other.ManifestImage is null) { throw new InvalidOperationException($"Can't compare {nameof(ImageData)} objects if {nameof(ManifestImage)} is null."); } if (ManifestImage == other.ManifestImage) { return(0); } // If we're comparing two different image items, compare them by the first Platform to // provide deterministic ordering. PlatformData thisFirstPlatform = Platforms .OrderBy(platform => platform) .FirstOrDefault(); PlatformData otherFirstPlatform = other.Platforms .OrderBy(platform => platform) .FirstOrDefault(); return(thisFirstPlatform?.CompareTo(otherFirstPlatform) ?? 1); }
/// <summary> /// we will draw one column at a time /// /// /// x /// layer /// last increase will be y /// </summary> public void Sort() { Platforms = Platforms.OrderByDescending(a => a.layer).ToList(); Platforms = Platforms.OrderBy(a => a.x).ToList(); // y form 0..1..2..etc Platforms = Platforms.OrderBy(a => a.y).ToList(); }
public void Update(RiseSectionUpdateSource source) { Platforms = Platforms.OrderBy(pd => pd.Y).ToList(); RaiseDataChangedEvent(source); }