diff --git a/AutoCat/Pages/HistoryPage.axaml b/AutoCat/Pages/HistoryPage.axaml
index b93e88b..1e9b6f5 100644
--- a/AutoCat/Pages/HistoryPage.axaml
+++ b/AutoCat/Pages/HistoryPage.axaml
@@ -20,19 +20,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AutoCat/ViewModels/HistoryViewModel.cs b/AutoCat/ViewModels/HistoryViewModel.cs
index ce17623..903dead 100644
--- a/AutoCat/ViewModels/HistoryViewModel.cs
+++ b/AutoCat/ViewModels/HistoryViewModel.cs
@@ -1,46 +1,25 @@
using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
+using System.Collections.ObjectModel;
using System.Threading.Tasks;
+using AutoCat.Utils;
using AutoCatCore.Model;
using AutoCatCore.Services.Storage;
-using ReactiveUI;
namespace AutoCat.ViewModels;
-public class HistoryViewModel: ViewModelBase
+public class HistoryViewModel(IStorageService storageService) : ViewModelBase
{
- #region Dependencies
+ public ObservableCollection Vehicles { get; set; } = storageService.GetVehicles();
- private readonly IStorageService _storageService;
-
- #endregion
-
- #region Properties
-
- public ICollection Vehicles { get; set; }
-
- #endregion
-
- public HistoryViewModel(IStorageService storageService)
- {
- _storageService = storageService;
- Vehicles = storageService.GetVehicles();
- this.RaisePropertyChanged(nameof(Vehicles));
- }
-
public async Task AddVehicle(Vehicle vehicle)
{
try
{
- await _storageService.AddVehicle(vehicle);
+ await storageService.AddVehicle(vehicle);
}
catch (Exception ex)
{
- Console.WriteLine($"Exception: {ex.Message}");
- Console.WriteLine($"Inner exception: {ex.InnerException?.Message}");
- Console.WriteLine("");
+ Alerts.ShowError(ex);
}
-
}
}
\ No newline at end of file
diff --git a/AutoCatCore/AutoCatCore.csproj b/AutoCatCore/AutoCatCore.csproj
index c93e9f1..2558624 100644
--- a/AutoCatCore/AutoCatCore.csproj
+++ b/AutoCatCore/AutoCatCore.csproj
@@ -14,6 +14,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/AutoCatCore/FodyWeavers.xml b/AutoCatCore/FodyWeavers.xml
new file mode 100644
index 0000000..cc07b89
--- /dev/null
+++ b/AutoCatCore/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/AutoCatCore/FodyWeavers.xsd b/AutoCatCore/FodyWeavers.xsd
new file mode 100644
index 0000000..224a0a4
--- /dev/null
+++ b/AutoCatCore/FodyWeavers.xsd
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+ THIS IS DEPRECATED - USE `AnalyticsCollection` INSTEAD. Disables anonymized
+ usage information from being sent on build. Read more about what data is being collected and
+ why here: https://github.com/realm/realm-dotnet/blob/main/Realm/Realm.Weaver/Analytics.cs
+
+
+
+
+ Controls what anonymized usage information is being sent on build. Read more
+ about what data is being collected and why here:
+ https://github.com/realm/realm-dotnet/blob/main/Realm/Realm.Weaver/Analytics/Analytics.cs
+
+
+
+
+
+ Analytics collection will run normally. This is the default behavior
+ and we hope you don't change it as the anonymized data collected is critical for
+ making the right decisions about the future of the Realm SDK.
+
+
+
+
+ Analytics collection will run but will not send it to the server. This
+ is useful in combination with `AnalyticsLogPath` if you want to review the data being
+ sent.
+
+
+
+
+ Analytics collection is disabled. No data will be sent on build.
+
+
+
+
+
+
+
+ Controls where the payload for the anonymized metrics collection will be
+ stored. This can be useful if you want to review the data being collected by Realm.
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/AutoCatCore/Services/Storage/IStorageService.cs b/AutoCatCore/Services/Storage/IStorageService.cs
index 175df57..60d9895 100644
--- a/AutoCatCore/Services/Storage/IStorageService.cs
+++ b/AutoCatCore/Services/Storage/IStorageService.cs
@@ -1,5 +1,7 @@
+using System.Collections.ObjectModel;
using System.Collections.Specialized;
using AutoCatCore.Model;
+using Microsoft.EntityFrameworkCore.ChangeTracking;
namespace AutoCatCore.Services.Storage;
@@ -13,5 +15,5 @@ public interface IStorageService
public Task AddVehicle(Vehicle vehicle);
- public ICollection GetVehicles();
+ public ObservableCollection GetVehicles();
}
\ No newline at end of file
diff --git a/AutoCatCore/Services/Storage/StorageService.cs b/AutoCatCore/Services/Storage/StorageService.cs
index 6bf49b8..c7461db 100644
--- a/AutoCatCore/Services/Storage/StorageService.cs
+++ b/AutoCatCore/Services/Storage/StorageService.cs
@@ -42,9 +42,9 @@ public class StorageService: IStorageService
await _dbContext.SaveChangesAsync();
}
- public ICollection GetVehicles()
+ public ObservableCollection GetVehicles()
{
_dbContext.Vehicles.Load();
- return _dbContext.Vehicles.Local;
+ return _dbContext.Vehicles.Local.ToObservableCollection();
}
}
\ No newline at end of file