Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
BasePopup.xaml.cs
3
5{
9 public partial class BasePopup
10 {
14 public virtual double ViewWidthRequest => (DeviceDisplay.MainDisplayInfo.Width / DeviceDisplay.MainDisplayInfo.Density) * (7.0 / 8.0);
15
19 public virtual double MaximumViewHeightRequest => (DeviceDisplay.MainDisplayInfo.Height / DeviceDisplay.MainDisplayInfo.Density) * (3.0 / 4.0);
20
25 protected bool useDefaultBackground;
26
32 {
33 get => this.BindingContext as BasePopupViewModel;
34 set => this.BindingContext = value;
35 }
36
37
38 protected BasePopup(bool useDefaultBackground = true)
39 {
40 this.useDefaultBackground = useDefaultBackground;
41 this.InitializeComponent();
42 this.BackgroundColor = AppColors.PrimaryBackground;
43 }
44
48 protected static async void PopAsync()
49 {
50 await ServiceRef.UiService.PopAsync();
51
52 }
53
54 protected override void OnAppearing()
55 {
56 //if (this.useDefaultBackground)
57 // this.LoadScreenshotAsync();
58 base.OnAppearing();
59 }
60
66 protected override bool OnBackButtonPressed()
67 {
68 ServiceRef.UiService.PopAsync();
69 return true;
70 }
71
77 protected override bool OnBackgroundClicked()
78 {
79 ServiceRef.UiService.PopAsync();
80 return true;
81 }
82
86 private async void LoadScreenshotAsync()
87 {
88 this.BackgroundImageSource = await ServiceRef.UiService.TakeBlurredScreenshotAsync();
89 }
90 }
91}
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
Static class that gives access to app-specific themed colors
Definition: AppColors.cs:7
static Color PrimaryBackground
Primary background color.
Definition: AppColors.cs:82
virtual double ViewWidthRequest
The requested width of the popup view
static async void PopAsync()
A shortcut for Services.UI.IUiService.PopAsync
override bool OnBackgroundClicked()
Called when the background is pressed.
BasePopupViewModel? ViewModel
Returns the current BindingContext as a BasePopupViewModel Returns null if failed
bool useDefaultBackground
If true, the background will be a blurred screenshot of the current page If false the background will...
virtual double MaximumViewHeightRequest
The maximum height of the popup view
override bool OnBackButtonPressed()
Called when the back button on the client is pressed