Removed dialogs for editing equipment and points, and their related resources

This commit is contained in:
retr0volkov
2025-07-30 09:08:22 +03:00 Unverified
parent edae732fac
commit 08eaa30209
77 changed files with 1498 additions and 1543 deletions
+23
View File
@@ -1,6 +1,10 @@
using System;
using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using GazpromApp.Enums;
using GazpromApp.Messages;
using GazpromApp.Models;
namespace GazpromApp.ViewModels;
@@ -11,6 +15,8 @@ public partial class InspectionViewModel : ViewModelBase
[ObservableProperty]
private string _name;
[ObservableProperty]
private DateTime _creationDate;
[ObservableProperty]
private DateTimeOffset _inspectionDate;
[ObservableProperty]
private PeriodType _periodType;
@@ -21,10 +27,25 @@ public partial class InspectionViewModel : ViewModelBase
[ObservableProperty]
private bool _isEditing;
[RelayCommand]
private void EditInspection()
{
IsEditing = !IsEditing;
}
[RelayCommand]
private void RemoveInspection() => WeakReferenceMessenger.Default.Send(new RemoveInspectionMessage(this));
// ReSharper disable once MemberCanBeMadeStatic.Global
public PeriodType[] AllPeriods => Enum.GetValues<PeriodType>()
.Where(p => p != PeriodType.Unknown)
.ToArray();
public InspectionViewModel()
{
Name = string.Empty;
CreationDate = DateTime.Now;
InspectionDate = DateTimeOffset.Now;
PeriodType = 0;
PeriodValue = 1;
@@ -34,6 +55,7 @@ public partial class InspectionViewModel : ViewModelBase
public InspectionViewModel(Inspection inspection)
{
Name = inspection.Name;
CreationDate = inspection.CreationDate;
InspectionDate = inspection.InspectionDate;
PeriodType = inspection.PeriodType.ToPeriodType();
PeriodValue = inspection.PeriodValue;
@@ -43,6 +65,7 @@ public partial class InspectionViewModel : ViewModelBase
public Inspection GetInspection()
{
Inspection.Name = Name;
Inspection.CreationDate = CreationDate;
Inspection.InspectionDate = InspectionDate;
Inspection.PeriodType = PeriodType.ToDescription();
Inspection.PeriodValue = PeriodValue;