Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MyContractsPage.xaml.cs
1using System.Collections.ObjectModel;
2using CommunityToolkit.Mvvm.Input;
5
7{
11 [XamlCompilation(XamlCompilationOptions.Compile)]
12 public partial class MyContractsPage
13 {
18 {
20 this.ContentPageModel = ViewModel;
21
22 this.InitializeComponent();
23
24 ViewModel.TagSelected += this.OnTagSelected;
25 }
26
27 private void OnTagSelected(MyContractsViewModel.SelectableTag tag)
28 {
29 try
30 {
31 MainThread.BeginInvokeOnMainThread(async () =>
32 {
33 HorizontalStackLayout filterLayout = this.FindByName<HorizontalStackLayout>("FilterTagsLayout");
34 ScrollView filterScroll = this.FindByName<ScrollView>("FilterTagsScroll");
35 if (filterLayout is null || filterScroll is null)
36 return;
37
38 foreach (object child in filterLayout.Children)
39 {
40 if (child is VisualElement ve && ve.BindingContext == tag)
41 {
42 await filterScroll.ScrollToAsync(ve, ScrollToPosition.Center, true);
43 break;
44 }
45 }
46 });
47 }
48 catch (Exception Ex)
49 {
50 ServiceRef.LogService.LogException(Ex);
51 }
52 }
53
54 private void ContractsSearchChanged(object? Sender, TextChangedEventArgs e)
55 {
56 try
57 {
58 MainThread.BeginInvokeOnMainThread(() =>
59 {
60 if (this.ContentPageModel is MyContractsViewModel MyContractsViewModel)
61 {
62 MyContractsViewModel.UpdateSearch(e.NewTextValue);
63 }
64 });
65 }
66 catch (Exception Ex)
67 {
68 ServiceRef.LogService.LogException(Ex);
69 }
70 }
71 }
72}
Base class that references services in the app.
Definition: ServiceRef.cs:43
static ILogService LogService
Log service.
Definition: ServiceRef.cs:214
static INavigationService NavigationService
The navigation service for navigating between pages.
Definition: ServiceRef.cs:178
Holds navigation parameters specific to views displaying a list of contacts.
A page that displays a list of the current user's contracts.
MyContractsPage()
Creates a new instance of the MyContractsPage class.
View model responsible for presenting and filtering a list of contracts and templates....
void UpdateSearch(string? text)
Should be called by page on text change.