Adding point works

This commit is contained in:
retr0volkov
2025-06-30 20:13:36 +03:00 Unverified
parent e5f8982c44
commit 7beee75d14
39 changed files with 4138 additions and 38 deletions
+38
View File
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices.JavaScript;
using Avalonia.Media.Imaging;
using CommunityToolkit.Mvvm.ComponentModel;
using GazpromApp.Models;
namespace GazpromApp.ViewModels;
public partial class ImageViewModel : ViewModelBase
{
[ObservableProperty]
private byte[]? _bytes;
// EF stuff
[ObservableProperty]
private List<Point>? _points;
[ObservableProperty]
private List<Equipment>? _equipment;
[ObservableProperty]
private Bitmap? _fileName;
public ImageViewModel(Image image)
{
Bytes = image.Bytes;
Equipment = image.Equipment;
Points = image.Points;
}
public Image GetImage()
{
return new Image()
{
Bytes = Bytes ?? [],
Equipment = Equipment ?? [],
Points = Points ?? [],
};
}
}
+47
View File
@@ -0,0 +1,47 @@
using System.Collections.Generic;
using CommunityToolkit.Mvvm.ComponentModel;
using GazpromApp.Models;
namespace GazpromApp.ViewModels;
public partial class PointViewModel : ViewModelBase
{
[ObservableProperty]
private string? _name;
[ObservableProperty]
private string? _description;
[ObservableProperty]
private double? _latitude;
[ObservableProperty]
private double? _longitude;
// EF stuff
[ObservableProperty]
private List<Image>? _images;
[ObservableProperty]
private List<Equipment>? _equipment;
[ObservableProperty]
private List<Property>? _properties;
public PointViewModel(Models.Point point)
{
Name = point.Name;
Description = point.Description;
Latitude = point.Latitude;
Longitude = point.Longitude;
Images = point.Images;
Equipment = point.Equipment;
Properties = point.Properties;
}
public Models.Point GetPoint()
{
return new Models.Point()
{
Name = this.Name,
Description = this.Description
};
}
}