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

@@ -15,10 +15,10 @@ namespace Torch.Server.ViewModels.Blocks
{
public class BlockViewModel : EntityViewModel
{
public IMyTerminalBlock Block { get; }
public IMyTerminalBlock Block => (IMyTerminalBlock) Entity;
public MtObservableList<PropertyViewModel> Properties { get; } = new MtObservableList<PropertyViewModel>();
public string FullName => $"{Block.CubeGrid.CustomName} - {Block.CustomName}";
public string FullName => $"{Block?.CubeGrid.CustomName} - {Block?.CustomName}";
public override string Name
{
@@ -38,7 +38,7 @@ namespace Torch.Server.ViewModels.Blocks
public long BuiltBy
{
get => ((MySlimBlock)Block.SlimBlock).BuiltBy;
get => ((MySlimBlock)Block?.SlimBlock)?.BuiltBy ?? 0;
set
{
TorchBase.Instance.Invoke(() =>
@@ -59,7 +59,6 @@ namespace Torch.Server.ViewModels.Blocks
public BlockViewModel(IMyTerminalBlock block, EntityTreeViewModel tree) : base(block, tree)
{
Block = block;
if (Block == null)
return;