Observable collection base code for those without a true backing collection.

Observable sorted dictionary
Grid view now displays blocks grouped by subtype.
Null propagation in entity view models because WPF.
This commit is contained in:
Westin Miller
2017-12-04 23:52:03 -08:00
parent 5b098c68aa
commit c188367749
17 changed files with 909 additions and 540 deletions

View File

@@ -29,11 +29,10 @@ namespace Torch.Server.ViewModels.Entities
await TorchBase.Instance.InvokeAsync(() => MyEntities.GetTopMostEntitiesInBox(ref box, entities)).ConfigureAwait(false);
foreach (var entity in entities.Where(e => e is IMyCubeGrid))
{
var gridModel = Tree.Grids.FirstOrDefault(g => g.Entity.EntityId == entity.EntityId);
if (gridModel == null)
if (Tree.Grids.TryGetValue(entity.EntityId, out var gridModel))
{
gridModel = new GridViewModel((MyCubeGrid)entity, Tree);
Tree.Grids.Add(gridModel);
Tree.Grids.Add(entity.EntityId, gridModel);
}
AttachedGrids.Add(gridModel);