diff --git a/App.axaml.cs b/App.axaml.cs index 802b767..81e127a 100644 --- a/App.axaml.cs +++ b/App.axaml.cs @@ -1,15 +1,14 @@ +using System.Linq; using Avalonia; using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Data.Core; using Avalonia.Data.Core.Plugins; -using System.Linq; using Avalonia.Markup.Xaml; using GazpromApp.ViewModels; using GazpromApp.Views; namespace GazpromApp; -public partial class App : Application +public class App : Application { public override void Initialize() { @@ -25,7 +24,7 @@ public partial class App : Application DisableAvaloniaDataAnnotationValidation(); desktop.MainWindow = new MainWindow { - DataContext = new MainWindowViewModel(), + DataContext = new MainWindowViewModel() }; } diff --git a/Messages/NewPointMessage.cs b/Messages/NewPointMessage.cs index 73d4a80..b376345 100644 --- a/Messages/NewPointMessage.cs +++ b/Messages/NewPointMessage.cs @@ -1,5 +1,6 @@ -using GazpromApp.ViewModels; -using CommunityToolkit.Mvvm.Messaging.Messages; +using CommunityToolkit.Mvvm.Messaging.Messages; +using GazpromApp.ViewModels; + namespace GazpromApp.Messages; public class NewPointMessage : AsyncRequestMessage; \ No newline at end of file diff --git a/Models/Equipment.cs b/Models/Equipment.cs index 5f50c56..242074e 100644 --- a/Models/Equipment.cs +++ b/Models/Equipment.cs @@ -1,6 +1,6 @@ -using System.ComponentModel.DataAnnotations; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using System.Collections.Generic; namespace GazpromApp.Models; @@ -20,7 +20,7 @@ public class Equipment // EF stuff public Image? Image { get; set; } - public Models.Point? Point { get; set; } + public Point? Point { get; set; } public List Properties { get; set; } = []; public List Inspections { get; set; } = []; } \ No newline at end of file diff --git a/Models/Error.cs b/Models/Error.cs index 937a4cc..56268b7 100644 --- a/Models/Error.cs +++ b/Models/Error.cs @@ -1,5 +1,4 @@ using GazpromApp.Enums; -using GazpromApp.ViewModels; namespace GazpromApp.Models; diff --git a/Models/Image.cs b/Models/Image.cs index fc83231..b12933a 100644 --- a/Models/Image.cs +++ b/Models/Image.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/Models/Inspection.cs b/Models/Inspection.cs index 6db5585..f4fe4cd 100644 --- a/Models/Inspection.cs +++ b/Models/Inspection.cs @@ -17,8 +17,9 @@ public class Inspection public string PeriodType { get; set; } = string.Empty; [Required] public float PeriodValue { get; set; } + public int EquipmentId { get; set; } // EF stuff - public Equipment? Equipment { get; set; } + public Equipment? Equipment { get; } = new(); } \ No newline at end of file diff --git a/Models/Point.cs b/Models/Point.cs index 0f4f22a..f2c6b39 100644 --- a/Models/Point.cs +++ b/Models/Point.cs @@ -14,9 +14,9 @@ public class Point [Required] public string? Description { get; set; } = string.Empty; [Required] - public double Latitude { get; set; } = 0; + public double Latitude { get; set; } [Required] - public double Longitude { get; set; } = 0; + public double Longitude { get; set; } // EF stuff public List Images { get; set; } = []; public List Equipment { get; set; } = []; diff --git a/Models/Property.cs b/Models/Property.cs index 75388fc..8b72b0c 100644 --- a/Models/Property.cs +++ b/Models/Property.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; + namespace GazpromApp.Models; public class Property @@ -15,6 +16,6 @@ public class Property // EF stuff public Property? Parent { get; set; } public List Properties{ get; set; } = []; - public List Points { get; set; } = []; + public List Points { get; set; } = []; public List Equipment { get; } = []; } \ No newline at end of file diff --git a/Program.cs b/Program.cs index 68c3d53..9c0bc40 100644 --- a/Program.cs +++ b/Program.cs @@ -1,5 +1,5 @@ -using Avalonia; -using System; +using System; +using Avalonia; namespace GazpromApp; @@ -7,7 +7,7 @@ sealed class Program { // Initialization code. Don't use any Avalonia, third-party APIs or any // SynchronizationContext-reliant code before AppMain is called: things aren't initialized - // yet and stuff might break. + // yet, and stuff might break. [STAThread] public static void Main(string[] args) => BuildAvaloniaApp() .StartWithClassicDesktopLifetime(args); diff --git a/Utils/AppDbContext.cs b/Utils/AppDbContext.cs index 2592521..e127a40 100644 --- a/Utils/AppDbContext.cs +++ b/Utils/AppDbContext.cs @@ -1,13 +1,13 @@ -using Microsoft.EntityFrameworkCore; -using GazpromApp.Models; +using GazpromApp.Models; +using Microsoft.EntityFrameworkCore; namespace GazpromApp.Utils; public class AppDbContext : DbContext { - public DbSet Image { get; set; } + public DbSet Image { get; set; } public DbSet Equipment { get; set; } - public DbSet Point { get; set; } + public DbSet Point { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { @@ -20,7 +20,7 @@ public class AppDbContext : DbContext base.OnModelCreating(modelBuilder); // Images - modelBuilder.Entity() + modelBuilder.Entity() .HasMany(e => e.Images) .WithMany(e => e.Points); @@ -30,7 +30,7 @@ public class AppDbContext : DbContext .HasForeignKey(e => e.ImageId); // Properties - modelBuilder.Entity() + modelBuilder.Entity() .HasMany(e => e.Properties) .WithMany(e => e.Points); diff --git a/Utils/DateCalculator.cs b/Utils/DateCalculator.cs index e934585..ff5e680 100644 --- a/Utils/DateCalculator.cs +++ b/Utils/DateCalculator.cs @@ -1,7 +1,6 @@ using System; using System.Linq; using GazpromApp.Enums; -using GazpromApp.Models; using GazpromApp.ViewModels; namespace GazpromApp.Utils; @@ -19,11 +18,11 @@ public static class DateCalculator return [inspection.InspectionDate.DateTime, firstFutureDate]; } - DateTime futureDate = Enumerable.Range(1, int.MaxValue) + var futureDate = Enumerable.Range(1, int.MaxValue) .Select(i => AddPeriod(inspection.InspectionDate.DateTime, inspection.PeriodType, inspection.PeriodValue * i)) .First(d => d > today); - DateTime pastDate = SubtractPeriod(futureDate, inspection.PeriodType, inspection.PeriodValue); + var pastDate = SubtractPeriod(futureDate, inspection.PeriodType, inspection.PeriodValue); return [pastDate, futureDate]; } @@ -36,6 +35,7 @@ public static class DateCalculator PeriodType.Week => date.AddDays(value * 7), PeriodType.Month => date.AddDays(value * 30.436875), // Avg days/month PeriodType.Year => date.AddDays(value * 365.2425), // Avg days/year (incl. leap years) + PeriodType.Unknown => throw new ArgumentException("Invalid period type"), _ => throw new ArgumentException("Invalid period type") }; } diff --git a/ViewModels/Basic/EquipmentViewModel.cs b/ViewModels/Basic/EquipmentViewModel.cs index 1882c1b..8a1c4c6 100644 --- a/ViewModels/Basic/EquipmentViewModel.cs +++ b/ViewModels/Basic/EquipmentViewModel.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using CommunityToolkit.Mvvm.ComponentModel; @@ -43,7 +42,7 @@ public partial class EquipmentViewModel : ViewModelBase Image = new ImageViewModel(equipment.Image ?? new Image()); Properties = new ObservableCollection(equipment.Properties.Select(e => new PropertyViewModel(e))); - List times = (equipment.Inspections.Select(e => new InspectionViewModel(e))) + var times = equipment.Inspections.Select(e => new InspectionViewModel(e)) .Select(e => e.GetNearestDates()) .ToList(); @@ -62,12 +61,12 @@ public partial class EquipmentViewModel : ViewModelBase public Equipment GetEquipment() { - return new Equipment() + return new Equipment { Name = Name, Description = Description, Image = Image?.GetImage(), - Inspections = Inspections.Select(e => e.GetInspection()).ToList(), + Inspections = Inspections.Select(e => e.GetInspection()).ToList() }; } } \ No newline at end of file diff --git a/ViewModels/Basic/ErrorViewModel.cs b/ViewModels/Basic/ErrorViewModel.cs index 2ea9be6..7a262d9 100644 --- a/ViewModels/Basic/ErrorViewModel.cs +++ b/ViewModels/Basic/ErrorViewModel.cs @@ -20,7 +20,7 @@ public partial class ErrorViewModel : ViewModelBase w.Close(); } - private ErrorSeverity severity; + private readonly ErrorSeverity _severity; // Visual and other properties [ObservableProperty] private bool _isErrorVisible; @@ -38,7 +38,7 @@ public partial class ErrorViewModel : ViewModelBase { Title = error.Title; Message = error.Message; - severity = error.Severity; + _severity = error.Severity; switch (error.Severity) { case ErrorSeverity.Error: @@ -48,21 +48,20 @@ public partial class ErrorViewModel : ViewModelBase IsWarnVisible = true; break; case ErrorSeverity.Message: - IsInfoVisible = true; - break; default: IsInfoVisible = true; break; } } + // ReSharper disable once UnusedMember.Global public Error GetError() { - Error error = new Error() + var error = new Error { Title = Title, Message = Message, - Severity = severity, + Severity = _severity }; return error; } diff --git a/ViewModels/Basic/ImageViewModel.cs b/ViewModels/Basic/ImageViewModel.cs index a3816c0..5aeeb62 100644 --- a/ViewModels/Basic/ImageViewModel.cs +++ b/ViewModels/Basic/ImageViewModel.cs @@ -35,13 +35,13 @@ public partial class ImageViewModel : ViewModelBase public Image GetImage() { - MemoryStream ms = new MemoryStream(); + var ms = new MemoryStream(); FileName?.Save(ms); - return new Image() + return new Image { Bytes = ms.ToArray(), Equipment = Equipment ?? [], - Points = Points ?? [], + Points = Points ?? [] }; } } \ No newline at end of file diff --git a/ViewModels/Basic/InspectionViewModel.cs b/ViewModels/Basic/InspectionViewModel.cs index 46c186c..f7e03c2 100644 --- a/ViewModels/Basic/InspectionViewModel.cs +++ b/ViewModels/Basic/InspectionViewModel.cs @@ -19,7 +19,7 @@ public partial class InspectionViewModel : ViewModelBase // Visual properties [ObservableProperty] - private bool _isEditing = false; + private bool _isEditing; public InspectionViewModel() { @@ -39,7 +39,7 @@ public partial class InspectionViewModel : ViewModelBase public Inspection GetInspection() { - return new Inspection() + return new Inspection { Name = Name, InspectionDate = InspectionDate, diff --git a/ViewModels/Basic/PointViewModel.cs b/ViewModels/Basic/PointViewModel.cs index d0b78db..d92bfd9 100644 --- a/ViewModels/Basic/PointViewModel.cs +++ b/ViewModels/Basic/PointViewModel.cs @@ -26,7 +26,7 @@ public partial class PointViewModel : ViewModelBase [ObservableProperty] private List? _properties; - public PointViewModel(Models.Point point) + public PointViewModel(Point point) { Name = point.Name; Description = point.Description; @@ -37,14 +37,15 @@ public partial class PointViewModel : ViewModelBase Properties = point.Properties; } - public Models.Point GetPoint() + // ReSharper disable once UnusedMember.Global + public Point GetPoint() { - return new Models.Point() + return new Point { - Name = this.Name, - Description = this.Description, - Equipment = this.Equipment ?? [], - Properties = this.Properties ?? [], + Name = Name, + Description = Description, + Equipment = Equipment ?? [], + Properties = Properties ?? [] }; } } \ No newline at end of file diff --git a/ViewModels/Basic/PropertyViewModel.cs b/ViewModels/Basic/PropertyViewModel.cs index 512658a..3a6f32c 100644 --- a/ViewModels/Basic/PropertyViewModel.cs +++ b/ViewModels/Basic/PropertyViewModel.cs @@ -1,7 +1,6 @@ using System.Collections.ObjectModel; using System.Linq; using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; using GazpromApp.Models; namespace GazpromApp.ViewModels; @@ -26,7 +25,7 @@ public partial class PropertyViewModel : ViewModelBase public Property GetProperty(Property? parent = null) { - Property p = new Property + var p = new Property { Name = Name, Value = Value, diff --git a/ViewModels/EditEquipmentDialogViewModel.cs b/ViewModels/EditEquipmentDialogViewModel.cs index 35f9c94..8b356f8 100644 --- a/ViewModels/EditEquipmentDialogViewModel.cs +++ b/ViewModels/EditEquipmentDialogViewModel.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; @@ -13,6 +12,7 @@ using CommunityToolkit.Mvvm.Messaging; using GazpromApp.Enums; using GazpromApp.Messages; using GazpromApp.Models; +using Image = GazpromApp.Models.Image; namespace GazpromApp.ViewModels; @@ -54,26 +54,26 @@ public partial class EditEquipmentDialogViewModel : ViewModelBase [RelayCommand] private async Task AddImage(Window w) { - IReadOnlyList files = await w.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions() + var files = await w.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions { AllowMultiple = false, Title = "Выберите картинку", - FileTypeFilter = [FilePickerFileTypes.ImageAll], + FileTypeFilter = [FilePickerFileTypes.ImageAll] }); IsImageSelected = files.Count > 0; try { - Image = IsImageSelected ? new ImageViewModel(new Models.Image()) { FileName = new Bitmap(HttpUtility.UrlDecode(files[0].Path.AbsolutePath)) } : null; + Image = IsImageSelected ? new ImageViewModel(new Image()) { FileName = new Bitmap(HttpUtility.UrlDecode(files[0].Path.AbsolutePath)) } : null; } catch (ArgumentException) { - Error error = new Error() + var error = new Error { Title = "Ошибка обработки картинки", Message = "Картинка не была добавлена", - Severity = ErrorSeverity.Error, + Severity = ErrorSeverity.Error }; _ = await WeakReferenceMessenger.Default.Send(new ErrorMessage(new ErrorViewModel(error))); @@ -142,13 +142,13 @@ public partial class EditEquipmentDialogViewModel : ViewModelBase private void CompleteEdit() { IsClosed = true; - Equipment equipment = new Equipment + var equipment = new Equipment { Name = Name, Description = Description, Image = Image?.GetImage(), Inspections = Inspections.Select(e => e.GetInspection()).ToList(), - Properties = Properties.Select(e => e.GetProperty()).ToList(), + Properties = Properties.Select(e => e.GetProperty()).ToList() }; WeakReferenceMessenger.Default.Send(new EditEquipmentDone(new EquipmentViewModel(equipment))); } diff --git a/ViewModels/EditPointDialogViewModel.cs b/ViewModels/EditPointDialogViewModel.cs index 28b8b19..72527ae 100644 --- a/ViewModels/EditPointDialogViewModel.cs +++ b/ViewModels/EditPointDialogViewModel.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using System.Web; @@ -14,7 +12,6 @@ using CommunityToolkit.Mvvm.Messaging; using GazpromApp.Enums; using GazpromApp.Messages; using GazpromApp.Models; -using GazpromApp.Views; using Image = GazpromApp.Models.Image; namespace GazpromApp.ViewModels; @@ -54,11 +51,11 @@ public partial class EditPointDialogViewModel : ViewModelBase [RelayCommand] private async Task AddImage(Window w) { - IReadOnlyList files = await w.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions() + var files = await w.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions { AllowMultiple = true, Title = "Выберите одну или несколько картинок", - FileTypeFilter = [FilePickerFileTypes.ImageAll], + FileTypeFilter = [FilePickerFileTypes.ImageAll] }); foreach (var file in files) { @@ -68,11 +65,11 @@ public partial class EditPointDialogViewModel : ViewModelBase } catch (ArgumentException) { - Error error = new Error() + var error = new Error { Title = "Ошибка обработки картинки", Message = $"Картинка не была добавлена: \"{HttpUtility.UrlDecode(file.Name)}\"", - Severity = ErrorSeverity.Error, + Severity = ErrorSeverity.Error }; _ = await WeakReferenceMessenger.Default.Send(new ErrorMessage(new ErrorViewModel(error))); } @@ -96,7 +93,7 @@ public partial class EditPointDialogViewModel : ViewModelBase [RelayCommand] private async Task AddEquipment() { - EquipmentViewModel? equipment = await WeakReferenceMessenger.Default.Send(new NewEquipmentMessage()); + var equipment = await WeakReferenceMessenger.Default.Send(new NewEquipmentMessage()); if (equipment != null) Equipment.Add(equipment); @@ -107,7 +104,7 @@ public partial class EditPointDialogViewModel : ViewModelBase [RelayCommand] private async Task EditEquipment(EquipmentViewModel equipment) { - EquipmentViewModel e = await WeakReferenceMessenger.Default.Send(new EditEquipmentMessage(equipment)) ?? equipment; + var e = await WeakReferenceMessenger.Default.Send(new EditEquipmentMessage(equipment)) ?? equipment; Equipment[Equipment.IndexOf(equipment)] = e; } @@ -145,13 +142,13 @@ public partial class EditPointDialogViewModel : ViewModelBase private void CompleteEdit() { IsClosed = true; - Point point = new Point() + var point = new Point { Name = Name, Description = Description, Images = Images.Select(e => e.GetImage()).ToList(), Equipment = Equipment.Select(e => e.GetEquipment()).ToList(), - Properties = Properties.Select(e => e.GetProperty()).ToList(), + Properties = Properties.Select(e => e.GetProperty()).ToList() }; WeakReferenceMessenger.Default.Send(new EditPointDone(new PointViewModel(point))); } @@ -234,8 +231,8 @@ public partial class EditPointDialogViewModel : ViewModelBase Value = "Property Value", Properties = [], Parent = null - }, - ], + } + ], Parent = null }, new PropertyViewModel diff --git a/ViewModels/MainWindowViewModel.cs b/ViewModels/MainWindowViewModel.cs index 691087c..e34b320 100644 --- a/ViewModels/MainWindowViewModel.cs +++ b/ViewModels/MainWindowViewModel.cs @@ -1,10 +1,10 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using GazpromApp.Messages; -using CommunityToolkit.Mvvm.Input; -using CommunityToolkit.Mvvm.Messaging; -using System.Collections.ObjectModel; +using System.Collections.ObjectModel; using System.Threading.Tasks; using Avalonia.Controls; +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using CommunityToolkit.Mvvm.Messaging; +using GazpromApp.Messages; using GazpromApp.Models; namespace GazpromApp.ViewModels; @@ -16,7 +16,7 @@ public partial class MainWindowViewModel : ViewModelBase [RelayCommand] private async Task AddPoint() { - PointViewModel? point = await WeakReferenceMessenger.Default.Send(new NewPointMessage()); + var point = await WeakReferenceMessenger.Default.Send(new NewPointMessage()); if (point != null) Points.Add(point); @@ -27,7 +27,7 @@ public partial class MainWindowViewModel : ViewModelBase [RelayCommand] private async Task EditPoint(PointViewModel point) { - PointViewModel p = await WeakReferenceMessenger.Default.Send(new EditPointMessage(point)) ?? point; + var p = await WeakReferenceMessenger.Default.Send(new EditPointMessage(point)) ?? point; Points[Points.IndexOf(point)] = p; } diff --git a/ViewModels/NewEquipmentDialogViewModel.cs b/ViewModels/NewEquipmentDialogViewModel.cs index 638544b..b5fc1ea 100644 --- a/ViewModels/NewEquipmentDialogViewModel.cs +++ b/ViewModels/NewEquipmentDialogViewModel.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Threading.Tasks; using System.Web; using Avalonia.Controls; @@ -11,6 +10,7 @@ using CommunityToolkit.Mvvm.Messaging; using GazpromApp.Enums; using GazpromApp.Messages; using GazpromApp.Models; +using Image = GazpromApp.Models.Image; namespace GazpromApp.ViewModels; @@ -30,26 +30,26 @@ public partial class NewEquipmentDialogViewModel : ViewModelBase [RelayCommand] private async Task AddImage(Window w) { - IReadOnlyList files = await w.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions() + var files = await w.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions { AllowMultiple = false, Title = "Выберите картинку", - FileTypeFilter = [FilePickerFileTypes.ImageAll], + FileTypeFilter = [FilePickerFileTypes.ImageAll] }); IsImageSelected = files.Count > 0; try { - Image = IsImageSelected ? new ImageViewModel(new Models.Image()) { FileName = new Bitmap(HttpUtility.UrlDecode(files[0].Path.AbsolutePath)) } : null; + Image = IsImageSelected ? new ImageViewModel(new Image()) { FileName = new Bitmap(HttpUtility.UrlDecode(files[0].Path.AbsolutePath)) } : null; } catch (ArgumentException) { - Error error = new Error() + var error = new Error { Title = "Ошибка обработки картинки", Message = "Картинка не была добавлена", - Severity = ErrorSeverity.Error, + Severity = ErrorSeverity.Error }; _ = await WeakReferenceMessenger.Default.Send(new ErrorMessage(new ErrorViewModel(error))); @@ -69,7 +69,7 @@ public partial class NewEquipmentDialogViewModel : ViewModelBase [RelayCommand (CanExecute = nameof(CanEnterEquipment))] private void EnterEquipment() { - Equipment equipment = new Equipment() + var equipment = new Equipment { Name = Name, Description = Description ?? string.Empty, diff --git a/ViewModels/NewPointDialogViewModel.cs b/ViewModels/NewPointDialogViewModel.cs index e801605..b8a6c22 100644 --- a/ViewModels/NewPointDialogViewModel.cs +++ b/ViewModels/NewPointDialogViewModel.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using System.Web; @@ -34,11 +32,11 @@ public partial class NewPointDialogViewModel : ViewModelBase [RelayCommand] private async Task AddImage(Window w) { - IReadOnlyList files = await w.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions() + var files = await w.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions { AllowMultiple = true, Title = "Выберите одну или несколько картинок", - FileTypeFilter = [FilePickerFileTypes.ImageAll], + FileTypeFilter = [FilePickerFileTypes.ImageAll] }); foreach (var file in files) { @@ -48,11 +46,11 @@ public partial class NewPointDialogViewModel : ViewModelBase } catch (ArgumentException) { - Error error = new Error() + var error = new Error { Title = "Ошибка обработки картинки", Message = $"Картинка не была добавлена: \"{HttpUtility.UrlDecode(file.Name)}\"", - Severity = ErrorSeverity.Error, + Severity = ErrorSeverity.Error }; _ = await WeakReferenceMessenger.Default.Send(new ErrorMessage(new ErrorViewModel(error))); } @@ -73,7 +71,7 @@ public partial class NewPointDialogViewModel : ViewModelBase [RelayCommand (CanExecute = nameof(CanEnterPoint))] private void EnterPoint() { - Point point = new Point() + var point = new Point { Name = Name, Description = Description, diff --git a/ViewModels/ViewModelBase.cs b/ViewModels/ViewModelBase.cs index 0543fb6..9e47ae9 100644 --- a/ViewModels/ViewModelBase.cs +++ b/ViewModels/ViewModelBase.cs @@ -2,6 +2,4 @@ namespace GazpromApp.ViewModels; -public class ViewModelBase : ObservableObject -{ -} \ No newline at end of file +public class ViewModelBase : ObservableObject; \ No newline at end of file diff --git a/Views/EditEquipmentDialog.axaml b/Views/EditEquipmentDialog.axaml index 1e3b669..f2739ba 100644 --- a/Views/EditEquipmentDialog.axaml +++ b/Views/EditEquipmentDialog.axaml @@ -18,7 +18,7 @@ - + @@ -31,6 +31,7 @@ + @@ -116,7 +117,7 @@