Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ServiceRef.cs
1using System;
2using System.Diagnostics;
3using System.Dynamic;
4using System.Globalization;
5using System.Reflection;
6using System.Threading.Tasks;
7using Microsoft.Extensions.Localization;
34using ZXing;
36
38{
42 public static class ServiceRef
43 {
48 public static IServiceProvider Provider { get; private set; } = null!;
49
50 private static IXmppService? xmppService;
51 private static IUiService? uiService;
52 private static INavigationService? navigationService;
53 private static ITagProfile? tagProfile;
54 private static ILogService? logService;
55 private static INetworkService? networkService;
56 private static IContractOrchestratorService? contractOrchestratorService;
57 private static IThingRegistryOrchestratorService? thingRegistryOrchestratorService;
58 private static INeuroWalletOrchestratorService? neuroWalletOrchestratorService;
59 private static IAttachmentCacheService? attachmentCacheService;
60 private static ICryptoService? cryptoService;
61 private static ISettingsService? settingsService;
62 private static IStorageService? storageService;
63 private static INfcService? nfcService;
64 private static INotificationService? notificationService;
65 private static IPushNotificationService? pushNotificationService;
66 private static IReportingStringLocalizer? localizer;
67 private static IPlatformSpecific? platformSpecific;
68 private static IBarcodeReader? barcodeReader;
69 private static IPermissionService? permissionService;
70 private static IIntentService? intentService;
71 private static IInternetCacheService? internetCacheService;
72 private static IThemeService? themeService;
73 private static IKycService? kycService;
74 private static IXmlSchemaValidationService? xmlSchemaValidationService;
75 private static IPopupService? popupService;
76 private static IToastService? toastService;
77 private static IKeyboardInsetsService? keyboardInsetsService;
78
79 private static IAuthenticationService? authenticationService;
80
86 public static void Initialize(IServiceProvider provider)
87 {
88 Provider = provider ?? throw new ArgumentNullException(nameof(provider));
89
90 xmppService = null;
91 uiService = null;
92 navigationService = null;
93 tagProfile = null;
94 logService = null;
95 networkService = null;
96 contractOrchestratorService = null;
97 thingRegistryOrchestratorService = null;
98 neuroWalletOrchestratorService = null;
99 attachmentCacheService = null;
100 cryptoService = null;
101 settingsService = null;
102 storageService = null;
103 nfcService = null;
104 notificationService = null;
105 pushNotificationService = null;
106 localizer = null;
107 platformSpecific = null;
108 barcodeReader = null;
109 permissionService = null;
110 intentService = null;
111 internetCacheService = null;
112 themeService = null;
113 kycService = null;
114 xmlSchemaValidationService = null;
115 popupService = null;
116 toastService = null;
117 keyboardInsetsService = null;
118 authenticationService = null;
119 }
120
124 public static Task ServicesReadyTask => App.ServicesReady;
125
129 public static IUiService UiService
130 {
131 get
132 {
133 uiService ??= Provider.GetRequiredService<IUiService>();
134 return uiService;
135 }
136 }
137
142 {
143 get
144 {
145 popupService ??= Provider.GetRequiredService<IPopupService>();
146 return popupService;
147 }
148 }
149
154 {
155 get
156 {
157 toastService ??= Provider.GetRequiredService<IToastService>();
158 return toastService;
159 }
160 }
161
166 {
167 get
168 {
169 keyboardInsetsService ??= Provider.GetRequiredService<IKeyboardInsetsService>();
170 return keyboardInsetsService;
171 }
172 }
173
178 {
179 get
180 {
181 navigationService ??= Provider.GetRequiredService<INavigationService>();
182 return navigationService;
183 }
184 }
185
190 {
191 get
192 {
193 xmppService ??= Provider.GetRequiredService<IXmppService>();
194 return xmppService;
195 }
196 }
197
202 {
203 get
204 {
205 tagProfile ??= Provider.GetRequiredService<ITagProfile>();
206 return tagProfile;
207 }
208 }
209
214 {
215 get
216 {
217 logService ??= Provider.GetRequiredService<ILogService>();
218 return logService;
219 }
220 }
221
226 {
227 get
228 {
229 networkService ??= Provider.GetRequiredService<INetworkService>();
230 return networkService;
231 }
232 }
233
238 {
239 get
240 {
241 contractOrchestratorService ??= Provider.GetRequiredService<IContractOrchestratorService>();
242 return contractOrchestratorService;
243 }
244 }
245
250 {
251 get
252 {
253 thingRegistryOrchestratorService ??= Provider.GetRequiredService<IThingRegistryOrchestratorService>();
254 return thingRegistryOrchestratorService;
255 }
256 }
257
262 {
263 get
264 {
265 neuroWalletOrchestratorService ??= Provider.GetRequiredService<INeuroWalletOrchestratorService>();
266 return neuroWalletOrchestratorService;
267 }
268 }
269
274 {
275 get
276 {
277 attachmentCacheService ??= Provider.GetRequiredService<IAttachmentCacheService>();
278 return attachmentCacheService;
279 }
280 }
281
286 {
287 get
288 {
289 cryptoService ??= Provider.GetRequiredService<ICryptoService>();
290 return cryptoService;
291 }
292 }
293
298 {
299 get
300 {
301 settingsService ??= Provider.GetRequiredService<ISettingsService>();
302 return settingsService;
303 }
304 }
305
310 {
311 get
312 {
313 storageService ??= Provider.GetRequiredService<IStorageService>();
314 return storageService;
315 }
316 }
317
322 {
323 get
324 {
325 nfcService ??= Provider.GetRequiredService<INfcService>();
326 return nfcService;
327 }
328 }
329
334 {
335 get
336 {
337 notificationService ??= Provider.GetRequiredService<INotificationService>();
338 return notificationService;
339 }
340 }
341
346 {
347 get
348 {
349 pushNotificationService ??= Provider.GetRequiredService<IPushNotificationService>();
350 return pushNotificationService;
351 }
352 }
353
358 {
359 get
360 {
361 permissionService ??= Provider.GetRequiredService<IPermissionService>();
362 return permissionService;
363 }
364 }
365
370 {
371 get
372 {
373 localizer ??= new ReportingStringLocalizer(LocalizationManager.GetStringLocalizer<AppResources>());
374 return localizer;
375 }
376 }
377
378
383 {
384 get
385 {
386 platformSpecific ??= ServiceHelper.GetService<IPlatformSpecific>();
387 return platformSpecific;
388 }
389 }
390
391
395 public static IBarcodeReader BarcodeReader
396 {
397 get
398 {
399 barcodeReader ??= ServiceHelper.GetService<IBarcodeReader>();
400 return barcodeReader;
401 }
402 }
403
404 public static IIntentService IntentService
405 {
406 get
407 {
408 intentService ??= Provider.GetRequiredService<IIntentService>();
409 return intentService;
410 }
411 }
412
413 public static IInternetCacheService InternetCacheService
414 {
415 get
416 {
417 internetCacheService ??= Provider.GetRequiredService<IInternetCacheService>();
418 return internetCacheService;
419 }
420 }
421
422 public static IThemeService ThemeService
423 {
424 get
425 {
426 themeService ??= Provider.GetRequiredService<IThemeService>();
427 return themeService;
428 }
429 }
430
431 public static IKycService KycService
432 {
433 get
434 {
435 kycService ??= Provider.GetRequiredService<IKycService>();
436 return kycService;
437 }
438 }
439
444 {
445 get
446 {
447 xmlSchemaValidationService ??= ServiceHelper.GetService<IXmlSchemaValidationService>();
448 return xmlSchemaValidationService;
449 }
450 }
451
457 {
458
459 get
460 {
461 authenticationService ??= Provider.GetRequiredService<IAuthenticationService>();
462 return authenticationService;
463 }
464 }
465 }
466}
Represents an instance of the Neuro-Access app.
Definition: App.xaml.cs:125
static Task ServicesReady
Task that completes once all core services have finished loading.
Definition: App.xaml.cs:174
A strongly-typed resource class, for looking up localized strings, etc.
The IntentService class is responsible for handling and processing application intents in a cross‑pla...
Service providing KYC process loading, validation, snapshotting and persistence. Implements ordered,...
Definition: KycService.cs:41
Near-Field Communication (NFC) Service.
Definition: NfcService.cs:29
Android implementation of platform-specific features.
Base class that references services in the app.
Definition: ServiceRef.cs:43
static IServiceProvider Provider
The service provider for the app. This is set before the app is started, and will be used to resolve ...
Definition: ServiceRef.cs:48
static ILogService LogService
Log service.
Definition: ServiceRef.cs:214
static INetworkService NetworkService
Network service.
Definition: ServiceRef.cs:226
static IBarcodeReader BarcodeReader
Localization service
Definition: ServiceRef.cs:396
static IAttachmentCacheService AttachmentCacheService
AttachmentCache service.
Definition: ServiceRef.cs:274
static IStorageService StorageService
Storage service.
Definition: ServiceRef.cs:310
static void Initialize(IServiceProvider provider)
Initializes the service reference cache with a fresh provider instance. This method must be called wh...
Definition: ServiceRef.cs:86
static ICryptoService CryptoService
Crypto service.
Definition: ServiceRef.cs:286
static INeuroWalletOrchestratorService NeuroWalletOrchestratorService
Neuro Wallet orchestrator service.
Definition: ServiceRef.cs:262
static IContractOrchestratorService ContractOrchestratorService
Contract orchestrator service.
Definition: ServiceRef.cs:238
static IReportingStringLocalizer Localizer
Localization service
Definition: ServiceRef.cs:370
static Task ServicesReadyTask
Gets a task that completes when all core services are initialized.
Definition: ServiceRef.cs:124
static IThingRegistryOrchestratorService ThingRegistryOrchestratorService
Thing Registry orchestrator service.
Definition: ServiceRef.cs:250
static IXmppService XmppService
The XMPP service for XMPP communication.
Definition: ServiceRef.cs:190
static IPermissionService PermissionService
Permission Service
Definition: ServiceRef.cs:358
static ISettingsService SettingsService
Settings service.
Definition: ServiceRef.cs:298
The TAG Profile is the heart of the digital identity for a specific user/device. Use this instance to...
Definition: TagProfile.cs:28
Manages application theming. Applies bundled (local) light/dark themes and, when a provider domain is...
Definition: ThemeService.cs:24
Default implementation of IKeyboardInsetsService that normalizes platform keyboard measurements.
Navigation service managing a custom stack of BaseContentPage instances. Modal navigation is deprecat...
Default implementation of IXmlSchemaValidationService.
Handles checking and requesting permissions for the app.
Defines operations for caching attachment content (e.g., images) by URL.
Defines operations for caching arbitrary internet-fetchable content.
Orchestrates operations on contracts upon receiving certain events, like approving or rejecting other...
Cryptographic service that helps create passwords and other security related tasks.
A log implementation for logging warnings, exceptions and events.
Definition: ILogService.cs:12
Interface for platform-specific functions.
Defines the contract for a service that handles application intents.
Service for loading KYC processes, performing validation, building identity artifacts and managing pe...
Definition: IKycService.cs:17
The network service is a wafer-thin wrapper around the Connectivity object. It exposes an event handl...
Interface for the Near-Field Communication (NFC) Service.
Definition: INfcService.cs:11
Handles common runtime settings that need to be persisted during sessions.
Wraps the Database for easy access to persistent encrypted storage. Use this for any sensitive data.
The TAG Profile is the heart of the digital identity for a specific user/device. Use this instance to...
Definition: ITagProfile.cs:18
Service for loading, applying, and retrieving themes and branding in the application....
Provides normalized keyboard inset information for UI components.
Service for navigating between pages using route-based navigation.
Service serializing and managing UI-related tasks.
Definition: IUiService.cs:12
Service responsible for presenting and dismissing application popups.
Service for presenting transient toast notifications.
Contract for validating XML instances against pre-registered XML Schemas (XSD). Schemas are lazily lo...
Represents an abstraction of a connection to an XMPP Server.
Definition: IXmppService.cs:45