Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
TokenDetailsPage.xaml.cs
1using System.Globalization;
3
5{
9 [XamlCompilation(XamlCompilationOptions.Compile)]
10 public partial class TokenDetailsPage
11 {
16 {
17 this.ContentPageModel = new TokenDetailsViewModel(this, ServiceRef.UiService.PopLatestArgs<TokenDetailsNavigationArgs>());
18 this.InitializeComponent();
19 }
20
30 internal void AddLegalId(TokenDetailsViewModel Model, string Label, string FriendlyName, string LegalId)
31 {
32 int Row = this.PartsGrid.RowDefinitions.Count;
33 Label Lbl;
34
35 this.PartsGrid.RowDefinitions.Add(new RowDefinition()
36 {
37 Height = GridLength.Auto
38 });
39
40 this.PartsGrid.Add(new Label()
41 {
42 Text = Label,
43 Style = AppStyles.KeyLabel
44 }, 0, Row);
45
46 this.PartsGrid.Add(Lbl = new Label()
47 {
48 Text = FriendlyName,
49 Style = AppStyles.ClickableValueLabel
50 }, 1, Row);
51
52 TapGestureRecognizer Tap = new();
53 Lbl.GestureRecognizers.Add(Tap);
54 Tap.Command = Model.ViewIdCommand;
55 Tap.CommandParameter = LegalId;
56 }
57
68 internal void AddJid(TokenDetailsViewModel Model, string Label, string Jid, string LegalId, string FriendlyName)
69 {
70 int Row = this.PartsGrid.RowDefinitions.Count;
71 Label Lbl;
72
73 this.PartsGrid.RowDefinitions.Add(new RowDefinition()
74 {
75 Height = GridLength.Auto
76 });
77
78 this.PartsGrid.Add(new Label()
79 {
80 Text = Label,
81 Style = AppStyles.KeyLabel
82 }, 0, Row);
83
84 this.PartsGrid.Add(Lbl = new Label()
85 {
86 Text = Jid,
87 Style = AppStyles.ClickableValueLabel
88 }, 1, Row);
89
90 TapGestureRecognizer Tap = new();
91 Lbl.GestureRecognizers.Add(Tap);
92 Tap.Command = Model.OpenChatCommand;
93 Tap.CommandParameter = Jid + " | " + LegalId + " | " + FriendlyName;
94 }
95
104 internal void AddLink(TokenDetailsViewModel Model, string Label, string LinkUri)
105 {
106 int Row = this.GeneralInfoGrid.RowDefinitions.Count;
107 Label Lbl;
108
109 this.GeneralInfoGrid.RowDefinitions.Add(new RowDefinition()
110 {
111 Height = GridLength.Auto
112 });
113
114 this.GeneralInfoGrid.Add(new Label()
115 {
116 Text = Label,
117 Style = AppStyles.KeyLabel
118 }, 0, Row);
119
120 this.GeneralInfoGrid.Add(Lbl = new Label()
121 {
122 Text = LinkUri,
123 Style = AppStyles.ClickableValueLabel
124 }, 1, Row);
125
126 TapGestureRecognizer Tap = new();
127 Lbl.GestureRecognizers.Add(Tap);
128 Tap.Command = Model.OpenLinkCommand;
129 Tap.CommandParameter = LinkUri;
130 }
131
140 internal void AddTag(TokenDetailsViewModel Model, string Label, string Value)
141 {
142 int Row = this.GeneralInfoGrid.RowDefinitions.Count;
143 Label Lbl;
144
145 this.GeneralInfoGrid.RowDefinitions.Add(new RowDefinition()
146 {
147 Height = GridLength.Auto
148 });
149
150 this.GeneralInfoGrid.Add(new Label()
151 {
152 Text = Label,
153 Style = AppStyles.KeyLabel
154 }, 0, Row);
155
156 this.GeneralInfoGrid.Add(Lbl = new Label()
157 {
158 Text = Value,
159 Style = AppStyles.ValueLabel
160 }, 1, Row);
161
162 if (Uri.TryCreate(Value, UriKind.Absolute, out Uri? RefUri) &&
163 RefUri.Scheme.ToLower(CultureInfo.InvariantCulture) is string s &&
164 (s == "http" || s == "https"))
165 {
166 Lbl.Style = AppStyles.ClickableValueLabel;
167
168 TapGestureRecognizer Tap = new();
169 Lbl.GestureRecognizers.Add(Tap);
170 Tap.Command = Model.OpenLinkCommand;
171 Tap.CommandParameter = Value;
172 }
173 }
174
175 }
176}
Base class that references services in the app.
Definition: ServiceRef.cs:31
static IUiService UiService
Service serializing and managing UI-related tasks.
Definition: ServiceRef.cs:55
A page that allows the user to view information about a token.
TokenDetailsPage()
Creates a new instance of the TokenDetailsPage class.
partial class TokenDetailsViewModel(TokenDetailsPage Page, TokenDetailsNavigationArgs? Args)
The view model to bind to for when displaying the contents of a token.