Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ErrorModel.cs
1using System.ComponentModel;
2using Waher.Events;
3using Waher.Things;
4
6{
11 public class ErrorModel(ThingError Error) : INotifyPropertyChanged
12 {
13 private ThingError error = Error;
14
18 public string ErrorMessage => this.error.ErrorMessage;
19
23 public DateTime Timestamp => this.error.Timestamp;
24
28 public ThingError Error
29 {
30 get => this.error;
31 set
32 {
33 bool ErrorMessageChanged = this.error.ErrorMessage != value.ErrorMessage;
34 bool TimestampChanged = this.error.Timestamp != value.Timestamp;
35
36 this.error = value;
37
38 if (ErrorMessageChanged)
39 this.RaisePropertyChanged(nameof(this.ErrorMessage));
40
41 if (TimestampChanged)
42 this.RaisePropertyChanged(nameof(this.Timestamp));
43 }
44 }
45
46 private void RaisePropertyChanged(string Name)
47 {
48 try
49 {
50 this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(Name));
51 }
52 catch (Exception ex)
53 {
54 Log.Exception(ex);
55 }
56 }
57
61 public event PropertyChangedEventHandler? PropertyChanged;
62 }
63}
Static class managing the application event log. Applications and services log events on this static ...
Definition: Log.cs:13
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Definition: Log.cs:1647
Contains information about an error on a thing
Definition: ThingError.cs:10
DateTime Timestamp
Timestamp of error.
Definition: ThingError.cs:65
string ErrorMessage
Error message.
Definition: ThingError.cs:70