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:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user