Properties added
This commit is contained in:
@@ -89,10 +89,7 @@ public partial class EditPointDialogViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private static async Task ViewImage(ImageViewModel image)
|
||||
{
|
||||
_ = await WeakReferenceMessenger.Default.Send(new ViewImageMessage(image));
|
||||
}
|
||||
private static async Task ViewImage(ImageViewModel image) => _ = await WeakReferenceMessenger.Default.Send(new ViewImageMessage(image));
|
||||
|
||||
public ObservableCollection<EquipmentViewModel> Equipment { get; set; }
|
||||
|
||||
@@ -122,6 +119,26 @@ public partial class EditPointDialogViewModel : ViewModelBase
|
||||
IsEquipmentEmpty = Equipment.Count == 0;
|
||||
}
|
||||
|
||||
public ObservableCollection<PropertyViewModel> Properties { get; set; }
|
||||
|
||||
[RelayCommand]
|
||||
private void AddPropertySimple() => Properties.Add(new PropertyViewModel());
|
||||
|
||||
[RelayCommand]
|
||||
private static void AddProperty(PropertyViewModel property) => property.Properties.Add(new PropertyViewModel(property));
|
||||
|
||||
[RelayCommand]
|
||||
private static void EditProperty(PropertyViewModel property) => property.IsEditing = !property.IsEditing;
|
||||
|
||||
[RelayCommand]
|
||||
private void DeleteProperty(PropertyViewModel property)
|
||||
{
|
||||
if (property.Parent is null)
|
||||
Properties.Remove(property);
|
||||
else
|
||||
property.Parent?.Properties.Remove(property);
|
||||
}
|
||||
|
||||
private bool CanCompleteEdit() => !string.IsNullOrWhiteSpace(Name);
|
||||
|
||||
[RelayCommand(CanExecute = nameof(CanCompleteEdit))]
|
||||
@@ -133,7 +150,8 @@ public partial class EditPointDialogViewModel : ViewModelBase
|
||||
Name = Name,
|
||||
Description = Description,
|
||||
Images = Images.Select(e => e.GetImage()).ToList(),
|
||||
Equipment = Equipment.Select(e => e.GetEquipment()).ToList()
|
||||
Equipment = Equipment.Select(e => e.GetEquipment()).ToList(),
|
||||
Properties = Properties.Select(e => e.GetProperty()).ToList(),
|
||||
};
|
||||
WeakReferenceMessenger.Default.Send(new EditPointDone(new PointViewModel(point)));
|
||||
}
|
||||
@@ -175,6 +193,59 @@ public partial class EditPointDialogViewModel : ViewModelBase
|
||||
Description = "Really big description for the equipment to show the long textReally big description for the equipment to show the long textReally big description for the equipment to show the long textReally big description for the equipment to show the long text", Image = null
|
||||
}
|
||||
];
|
||||
Properties = [
|
||||
new PropertyViewModel
|
||||
{
|
||||
Name = "Property Name",
|
||||
Value = "Property Value",
|
||||
Properties = [
|
||||
new PropertyViewModel
|
||||
{
|
||||
Name = "Property Name",
|
||||
Value = "Property Value",
|
||||
Properties = [
|
||||
new PropertyViewModel
|
||||
{
|
||||
Name = "Property Name",
|
||||
Value = "Property Value",
|
||||
Properties = [],
|
||||
Parent = null
|
||||
},
|
||||
new PropertyViewModel
|
||||
{
|
||||
Name = "Property Name",
|
||||
Value = "Property Value",
|
||||
Properties = [],
|
||||
Parent = null
|
||||
},
|
||||
new PropertyViewModel
|
||||
{
|
||||
Name = "Property Name",
|
||||
Value = "Property Value",
|
||||
Properties = [],
|
||||
Parent = null
|
||||
}
|
||||
],
|
||||
Parent = null
|
||||
},
|
||||
new PropertyViewModel
|
||||
{
|
||||
Name = "Property Name",
|
||||
Value = "Property Value",
|
||||
Properties = [],
|
||||
Parent = null
|
||||
},
|
||||
],
|
||||
Parent = null
|
||||
},
|
||||
new PropertyViewModel
|
||||
{
|
||||
Name = "Property Name",
|
||||
Value = "Property Value",
|
||||
Properties = [],
|
||||
Parent = null
|
||||
}
|
||||
];
|
||||
|
||||
IsImagesEmpty = true;
|
||||
IsEquipmentEmpty = true;
|
||||
@@ -188,6 +259,7 @@ public partial class EditPointDialogViewModel : ViewModelBase
|
||||
Description = point.Description;
|
||||
Images = new ObservableCollection<ImageViewModel>((point.Images ?? []).Select(e => new ImageViewModel(e)));
|
||||
Equipment = new ObservableCollection<EquipmentViewModel>((point.Equipment ?? []).Select(e => new EquipmentViewModel(e)));
|
||||
Properties = new ObservableCollection<PropertyViewModel>((point.Properties ?? []).Select(e => new PropertyViewModel(e)));
|
||||
|
||||
IsImagesEmpty = Images.Count == 0;
|
||||
IsEquipmentEmpty = Equipment.Count == 0;
|
||||
|
||||
Reference in New Issue
Block a user