Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ContractStateToString.cs
1using System;
3using System.Globalization;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
9
11{
12 internal class ContractStateToString : IValueConverter
13 {
14 public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
15 {
16 if (value is ContractState contractState)
17 {
18 // Get localized string from resources
19 return contractState switch
20 {
21 ContractState.Proposed => AppResources.Proposed,
22 ContractState.Rejected => AppResources.Rejected,
23 ContractState.Approved => AppResources.BeingSigned,
24 ContractState.BeingSigned => AppResources.BeingSigned,
25 ContractState.Signed => AppResources.Signed,
26 ContractState.Failed => AppResources.Failed,
27 ContractState.Obsoleted => AppResources.Obsoleted,
28 ContractState.Deleted => AppResources.Deleted,
29 _ => string.Empty
30 };
31 }
32 return string.Empty;
33 }
34
35 public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
36 {
37 // Converting back is not typically necessary in this case
38 return Binding.DoNothing;
39 }
40 }
41}
A strongly-typed resource class, for looking up localized strings, etc.
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 Proposed
Looks up a localized string similar to Proposed.
static string Failed
Looks up a localized string similar to Failed.
static string Rejected
Looks up a localized string similar to Rejected.
static string Obsoleted
Looks up a localized string similar to Obsoleted.
Definition: ImplTypes.g.cs:58
ContractState
Recognized contract states
Definition: Enumerations.cs:7