ComplianceNFs/ComplianceNFs.Monitor/MonitorViewModel.cs
Giuliano Paschoalino 690ab131aa feat: Initialize ComplianceNFs project structure with core, infrastructure, service, and monitor components
- Created ComplianceNFs.Core project with domain entities and ports
- Implemented BuyingRecord, EnergyInvoice, ParsedInvoice entities
- Defined domain interfaces for mail listening, XML and PDF parsing, and repository access
- Established ComplianceNFs.Infrastructure project with file archiving, mail listening, and data access implementations
- Developed PDF and XML parsers for invoice data extraction
- Set up AccessDbRepository and AttachmentRepository for data retrieval and storage
- Created ComplianceNFs.Service project for background processing and service orchestration
- Implemented Worker service for periodic tasks
- Established ComplianceNFs.Monitor project with WPF UI for monitoring invoice statuses
- Added ViewModel for UI data binding and command handling
- Configured project files for .NET 9.0 and necessary package references
- Created initial appsettings.json for configuration management
- Added TODOs and roadmap for future development
2025-06-05 14:47:28 -03:00

48 lines
1.5 KiB
C#

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Input;
using ComplianceNFs.Core.Entities;
namespace ComplianceNFs.Monitor
{
public class MonitorViewModel : INotifyPropertyChanged
{
public ObservableCollection<EnergyInvoice> RecentInvoices { get; } = new();
public ICommand ForceScanCommand { get; }
public event PropertyChangedEventHandler PropertyChanged;
public MonitorViewModel()
{
// TODO: Inject IInvoiceStatusStream and subscribe to updates
ForceScanCommand = new RelayCommand(_ => ForceScan());
}
private void ForceScan()
{
// TODO: Call service to force ingestion cycle
}
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}
public class RelayCommand : ICommand
{
private readonly Action<object> _execute;
private readonly Func<object, bool> _canExecute;
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
{
_execute = execute;
_canExecute = canExecute;
}
public bool CanExecute(object parameter) => _canExecute == null || _canExecute(parameter);
public void Execute(object parameter) => _execute(parameter);
public event EventHandler CanExecuteChanged { add { } remove { } }
}
}