DB integration added, multiple images for equipment
This commit is contained in:
@@ -8,6 +8,8 @@ namespace GazpromApp.ViewModels;
|
||||
|
||||
public partial class PropertyViewModel : ViewModelBase
|
||||
{
|
||||
private Property Property { get; }
|
||||
|
||||
[ObservableProperty]
|
||||
private string _name;
|
||||
|
||||
@@ -18,22 +20,18 @@ public partial class PropertyViewModel : ViewModelBase
|
||||
|
||||
// Visual and other properties
|
||||
|
||||
public PropertyViewModel? Parent { get; set; }
|
||||
public PropertyViewModel? Parent { get; init; }
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _isEditing;
|
||||
|
||||
public Property GetProperty(Property? parent = null)
|
||||
{
|
||||
var p = new Property
|
||||
{
|
||||
Name = Name,
|
||||
Value = Value,
|
||||
Properties = [],
|
||||
Parent = parent
|
||||
};
|
||||
p.Properties = Properties.Select(e => e.GetProperty(p)).ToList();
|
||||
return p;
|
||||
Property.Name = Name;
|
||||
Property.Value = Value;
|
||||
Property.Parent = parent;
|
||||
Property.Properties = Properties.Select(e => e.GetProperty(Property)).ToList();
|
||||
return Property;
|
||||
}
|
||||
|
||||
public PropertyViewModel()
|
||||
@@ -42,6 +40,7 @@ public partial class PropertyViewModel : ViewModelBase
|
||||
Value = "Значение свойства";
|
||||
Properties = [];
|
||||
Parent = null;
|
||||
Property = new Property();
|
||||
}
|
||||
|
||||
public PropertyViewModel(Property property, PropertyViewModel? parent = null)
|
||||
@@ -51,6 +50,7 @@ public partial class PropertyViewModel : ViewModelBase
|
||||
Properties = new ObservableCollection<PropertyViewModel>(
|
||||
property.Properties.Select(e => new PropertyViewModel(e, this)));
|
||||
Parent = property.Parent is null ? null : parent;
|
||||
Property = property;
|
||||
}
|
||||
|
||||
public PropertyViewModel(PropertyViewModel property)
|
||||
@@ -59,5 +59,6 @@ public partial class PropertyViewModel : ViewModelBase
|
||||
Value = "Значение свойства";
|
||||
Properties = [];
|
||||
Parent = property;
|
||||
Property = new Property();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user