Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
LocalizedState.cs
1using System.Globalization;
6
8{
12 [AcceptEmptyServiceProvider]
13 public class LocalizedState : IValueConverter, IMarkupExtension
14 {
16 public object? Convert(object? Value, Type TargetType, object? Parameter, CultureInfo Culture)
17 {
18 if (Value is IdentityState IdentityState)
19 {
20 switch (IdentityState)
21 {
22 case IdentityState.Created: return ServiceRef.Localizer[nameof(AppResources.Created)];
23 case IdentityState.Rejected: return ServiceRef.Localizer[nameof(AppResources.Rejected)];
24 case IdentityState.Approved: return ServiceRef.Localizer[nameof(AppResources.Approved)];
25 case IdentityState.Obsoleted: return ServiceRef.Localizer[nameof(AppResources.Obsoleted)];
26 case IdentityState.Compromised: return ServiceRef.Localizer[nameof(AppResources.Compromised)];
27 }
28 }
29 else if (Value is ContractState ContractState)
30 {
31 switch (ContractState)
32 {
33 case ContractState.Proposed: return ServiceRef.Localizer[nameof(AppResources.Proposed)];
34 case ContractState.Rejected: return ServiceRef.Localizer[nameof(AppResources.Rejected)];
35 case ContractState.Approved: return ServiceRef.Localizer[nameof(AppResources.Approved)];
36 case ContractState.BeingSigned: return ServiceRef.Localizer[nameof(AppResources.BeingSigned)];
37 case ContractState.Signed: return ServiceRef.Localizer[nameof(AppResources.Signed)];
38 case ContractState.Failed: return ServiceRef.Localizer[nameof(AppResources.Failed)];
39 case ContractState.Obsoleted: return ServiceRef.Localizer[nameof(AppResources.Obsoleted)];
40 case ContractState.Deleted: return ServiceRef.Localizer[nameof(AppResources.Deleted)];
41 }
42 }
43 else if (Value is ContractVisibility ContractVisibility)
44 {
45 switch (ContractVisibility)
46 {
51 }
52 }
53 else if (Value is XmppState XmppState)
54 {
55 switch (XmppState)
56 {
57 case XmppState.Offline: return ServiceRef.Localizer[nameof(AppResources.Offline)];
58 case XmppState.Connecting: return ServiceRef.Localizer[nameof(AppResources.Connecting)];
59 case XmppState.StreamNegotiation: return ServiceRef.Localizer[nameof(AppResources.StreamNegotiation)];
60 case XmppState.StreamOpened: return ServiceRef.Localizer[nameof(AppResources.StreamOpened)];
61 case XmppState.StartingEncryption: return ServiceRef.Localizer[nameof(AppResources.StartingEncryption)];
62 case XmppState.Authenticating: return ServiceRef.Localizer[nameof(AppResources.Authenticating)];
63 case XmppState.Registering: return ServiceRef.Localizer[nameof(AppResources.Registering)];
64 case XmppState.Binding: return ServiceRef.Localizer[nameof(AppResources.Binding)];
65 case XmppState.RequestingSession: return ServiceRef.Localizer[nameof(AppResources.RequestingSession)];
66 case XmppState.FetchingRoster: return ServiceRef.Localizer[nameof(AppResources.FetchingRoster)];
67 case XmppState.SettingPresence: return ServiceRef.Localizer[nameof(AppResources.SettingPresence)];
68 case XmppState.Connected: return ServiceRef.Localizer[nameof(AppResources.Connected)];
69 case XmppState.Error: return ServiceRef.Localizer[nameof(AppResources.Error)];
70 }
71 }
72
73 return Value?.ToString() ?? string.Empty;
74 }
75
77 public object? ConvertBack(object? Value, Type TargetType, object? Parameter, CultureInfo Culture)
78 {
79 return Value?.ToString() ?? string.Empty;
80 }
81
83 public object ProvideValue(System.IServiceProvider ServiceProvider)
84 {
85 return this;
86 }
87 }
88}
A strongly-typed resource class, for looking up localized strings, etc.
static string Approved
Looks up a localized string similar to Approved.
static string Signed
Looks up a localized string similar to Signed.
static string Deleted
Looks up a localized string similar to Deleted.
static string BeingSigned
Looks up a localized string similar to Being signed.
static string ContractVisibility_Public
Looks up a localized string similar to Public, not searchable.
static string Connected
Looks up a localized string similar to Connected.
static string Binding
Looks up a localized string similar to Binding.
static string Compromised
Looks up a localized string similar to Compromised.
static string Offline
Looks up a localized string similar to Offline.
static string ContractVisibility_PublicSearchable
Looks up a localized string similar to Public and searchable.
static string ContractVisibility_DomainAndParts
Looks up a localized string similar to Domain and parts.
static string StreamOpened
Looks up a localized string similar to Stream opened.
static string Proposed
Looks up a localized string similar to Proposed.
static string FetchingRoster
Looks up a localized string similar to Fetching roster.
static string ContractVisibility_CreatorAndParts
Looks up a localized string similar to Creator and parts.
static string Registering
Looks up a localized string similar to Registering.
static string Authenticating
Looks up a localized string similar to Authenticating.
static string RequestingSession
Looks up a localized string similar to Requesting session.
static string Failed
Looks up a localized string similar to Failed.
static string StartingEncryption
Looks up a localized string similar to Starting encryption.
static string Rejected
Looks up a localized string similar to Rejected.
static string SettingPresence
Looks up a localized string similar to Setting presence.
static string Connecting
Looks up a localized string similar to Connecting.
static string Created
Looks up a localized string similar to Created.
static string Obsoleted
Looks up a localized string similar to Obsoleted.
static string Error
Looks up a localized string similar to Error.
static string StreamNegotiation
Looks up a localized string similar to Stream negotiation.
Base class that references services in the app.
Definition: ServiceRef.cs:43
static IReportingStringLocalizer Localizer
Localization service
Definition: ServiceRef.cs:370
Converts an enumerated state into a localized string.
object? Convert(object? Value, Type TargetType, object? Parameter, CultureInfo Culture)
object? ConvertBack(object? Value, Type TargetType, object? Parameter, CultureInfo Culture)
object ProvideValue(System.IServiceProvider ServiceProvider)
Abstract base class for contractual parameters
Definition: Parameter.cs:17
Contains information about a service provider.
IdentityState
Lists recognized legal identity states.
ContractVisibility
Visibility types for contracts.
Definition: Enumerations.cs:56
ContractState
Recognized contract states
Definition: Enumerations.cs:7
XmppState
State of XMPP connection.
Definition: XmppState.cs:7