using System.ComponentModel; namespace EonaCat.PortMonitor { public class ConnectionInfo : INotifyPropertyChanged { private System.Windows.Media.SolidColorBrush _connectionColor; public string Protocol { get; set; } public string LocalAddress { get; set; } public int LocalPort { get; set; } public string RemoteAddress { get; set; } public int RemotePort { get; set; } public string State { get; set; } public int ProcessId { get; set; } public string ProcessName { get; set; } public DateTime ConnectionTime { get; set; } public DateTime FirstConnectionTime { get; set; } public string ConnectionStatus { get; set; } public TimeSpan ConnectionDuration => DateTime.Now - FirstConnectionTime; public string FormattedConnectionDuration => ConnectionDuration.ToString(@"hh\:mm\:ss"); public System.Windows.Media.SolidColorBrush ConnectionColor { get { return _connectionColor; } set { if (_connectionColor != value) { _connectionColor = value; OnPropertyChanged(nameof(ConnectionColor)); } } } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }