Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
IdentityNotificationEvent.cs
1using System.Text;
2using System.Xml;
3using Microsoft.Maui.Controls.Shapes;
10
12{
17 {
18 private LegalIdentity? identity;
19
24 : base()
25 {
26 }
27
33 : base()
34 {
35 this.Identity = e.RequestorIdentity;
36 this.Category = e.RequestorIdentity.Id;
37 this.RequestorFullJid = e.RequestorFullJid;
38 this.SignatoryIdentityId = e.SignatoryIdentityId;
39 this.PetitionId = e.PetitionId;
40 this.Purpose = e.Purpose;
41 this.ContentToSign = e.ContentToSign;
42 this.Type = NotificationEventType.Contracts;
43 this.Received = DateTime.UtcNow;
44 }
45
51 : base()
52 {
53 this.Identity = e.RequestorIdentity;
54 this.Category = e.RequestorIdentity.Id;
55 this.RequestorFullJid = e.RequestorFullJid;
56 this.SignatoryIdentityId = e.RequestedIdentityId;
57 this.PetitionId = e.PetitionId;
58 this.Purpose = e.Purpose;
59 this.ContentToSign = null;
60 this.Type = NotificationEventType.Identities;
61 this.Received = DateTime.UtcNow;
62 }
63
69 : base()
70 {
71 this.Identity = e.RequestedIdentity;
72 this.Category = e.RequestedIdentity.Id;
73 this.Type = NotificationEventType.Identities;
74 this.PetitionId = e.PetitionId;
75 this.ContentToSign = e.Signature;
76 this.Received = DateTime.UtcNow;
77 }
78
84 : base()
85 {
86 this.Identity = e.RequestedIdentity;
87 this.Category = e.RequestedIdentity.Id;
88 this.PetitionId = e.PetitionId;
89 this.Type = NotificationEventType.Identities;
90 }
91
95 public string? RequestorFullJid { get; }
96
100 public string? SignatoryIdentityId { get; }
101
105 public string? PetitionId { get; }
106
110 public string? Purpose { get; }
111
115 public byte[]? ContentToSign { get; }
116
120 public string? IdentityXml { get; set; }
121
127 {
128 get
129 {
130 if (this.identity is null && !string.IsNullOrEmpty(this.IdentityXml))
131 {
132 XmlDocument Doc = new()
133 {
134 PreserveWhitespace = true
135 };
136 Doc.LoadXml(this.IdentityXml);
137
138 this.identity = LegalIdentity.Parse(Doc.DocumentElement);
139 }
140
141 return this.identity;
142 }
143
144 set
145 {
146 this.identity = value;
147
148 if (value is null)
149 this.IdentityXml = null;
150 else
151 {
152 StringBuilder Xml = new();
153 value.Serialize(Xml, true, true, true, true, true, true, true);
154 this.IdentityXml = Xml.ToString();
155 }
156 }
157 }
158
163 public override Task<Geometry> GetCategoryIcon()
164 {
165 return Task.FromResult(Geometries.PersonPath);
166 }
167
171 public override Task<string> GetDescription()
172 {
173 if (this.identity is null)
174 return Task.FromResult(string.Empty);
175 else
176 return Task.FromResult(ContactInfo.GetFriendlyName(this.identity));
177 }
178
182 public override async Task Prepare()
183 {
184 if (this.identity?.Attachments is not null)
185 {
186 foreach (Attachment Attachment in this.identity.Attachments.GetImageAttachments())
187 {
188 try
189 {
190 await PhotosLoader.LoadPhoto(Attachment);
191 }
192 catch (Exception ex)
193 {
194 ServiceRef.LogService.LogException(ex);
195 }
196 }
197 }
198 }
199
200 }
201}
Contains information about a contact.
Definition: ContactInfo.cs:22
static async Task< string > GetFriendlyName(CaseInsensitiveString RemoteId)
Gets the friendly name of a remote identity (Legal ID or Bare JID).
Definition: ContactInfo.cs:258
IdentityNotificationEvent(LegalIdentityPetitionResponseEventArgs e)
Abstract base class of Identity notification events.
IdentityNotificationEvent(SignaturePetitionEventArgs e)
Abstract base class of Identity notification events.
override async Task Prepare()
Performs perparatory tasks, that will simplify opening the notification.
IdentityNotificationEvent()
Abstract base class of Identity notification events.
override Task< string > GetDescription()
Gets a descriptive text for the category of event.
override Task< Geometry > GetCategoryIcon()
Gets an icon for the category of event.
IdentityNotificationEvent(LegalIdentityPetitionEventArgs e)
Abstract base class of Identity notification events.
IdentityNotificationEvent(SignaturePetitionResponseEventArgs e)
Abstract base class of Identity notification events.
Base class that references services in the app.
Definition: ServiceRef.cs:43
static ILogService LogService
Log service.
Definition: ServiceRef.cs:214
Static class containing SVG Paths for symbols used in the app.
Definition: Geometries.cs:11
static readonly Geometry PersonPath
Person button glyph
Definition: Geometries.cs:559
Contains a reference to an attachment assigned to a legal object.
Definition: Attachment.cs:10
LegalIdentity RequestorIdentity
Legal Identity of requesting entity.
LegalIdentity RequestedIdentity
Requested identity, if accepted, null if rejected.
abstract class NotificationEvent()
Abstract base class of notification events.
NotificationEventType
Button on which event is to be displayed.