forked from VladislavAntonyuk/MauiSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainPage.xaml.cs
38 lines (34 loc) · 843 Bytes
/
MainPage.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
namespace MauiWorkflowBuilder;
using Blazor;
using CommunityToolkit.Maui.Views;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.JSInterop;
public partial class MainPage : ContentPage, IDisposable
{
public MainPage()
{
InitializeComponent();
WeakReferenceMessenger.Default.Register<ResultWorkflowMessage>(this, (o, result) =>
{
var popup = new Popup()
{
Content = new Label()
{
Text = result.Result?.ToString(),
VerticalTextAlignment = TextAlignment.Center,
HorizontalTextAlignment = TextAlignment.Center,
FontSize = 20
}
};
this.ShowPopup(popup);
});
}
private void Run(object sender, EventArgs e)
{
WeakReferenceMessenger.Default.Send(new RunWorkflowMessage());
}
public void Dispose()
{
WeakReferenceMessenger.Default.Unregister<ResultWorkflowMessage>(this);
}
}