gene
2 years ago
7 changed files with 130 additions and 17 deletions
-
9CircleViewerMaui/App.xaml.cs
-
14CircleViewerMaui/AppShell.xaml
-
12CircleViewerMaui/CircleViewerMaui.csproj
-
5CircleViewerMaui/MainPage.xaml
-
10CircleViewerMaui/MainPage.xaml.cs
-
56CircleViewerMaui/UserGroups.xaml
-
41CircleViewerMaui/UserGroups.xaml.cs
@ -0,0 +1,56 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<ContentPage |
|||
x:Class="CircleViewerMaui.UserGroups" |
|||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:CircleViewerMaui" |
|||
mc:Ignorable="d"> |
|||
<ContentPage.Content> |
|||
<Grid Margin="20,20,20,20"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="*" /> |
|||
<RowDefinition Height="*" /> |
|||
</Grid.RowDefinitions> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="*" /> |
|||
<ColumnDefinition Width="*" /> |
|||
</Grid.ColumnDefinitions> |
|||
|
|||
<VerticalStackLayout Grid.Row="0" Grid.Column="0" Padding="10" Margin="10" BackgroundColor="Cornsilk"> |
|||
<Label |
|||
Text="Join User Group" |
|||
BackgroundColor="Purple" |
|||
TextColor="White" |
|||
VerticalOptions="Center" |
|||
HorizontalOptions="Fill" |
|||
HorizontalTextAlignment="Center"/> |
|||
<Label |
|||
Text="Request code:" |
|||
TextColor="Purple" |
|||
VerticalOptions="Center"/> |
|||
<Entry x:Name="RequestCode" Placeholder="1234"></Entry> |
|||
<Label |
|||
Text="Verification code:" |
|||
TextColor="Purple" |
|||
VerticalOptions="Center"/> |
|||
<Entry x:Name="VerificationCode" Placeholder="ABCD"></Entry> |
|||
<Button x:Name="bnRequestVerfication" Text="Request Verification" Clicked="BnRequestVerfication_OnClicked"/> |
|||
</VerticalStackLayout> |
|||
|
|||
<VerticalStackLayout Grid.Row="0" Grid.Column="1" Padding="10" Margin="10" BackgroundColor="Cornsilk"> |
|||
<Label |
|||
Text="User Groups" |
|||
BackgroundColor="Purple" |
|||
TextColor="White" |
|||
VerticalOptions="Center" |
|||
HorizontalOptions="Fill" |
|||
HorizontalTextAlignment="Center"/> |
|||
<Picker x:Name="circlePicker" Title="Default User Group"> |
|||
</Picker> |
|||
</VerticalStackLayout> |
|||
|
|||
</Grid> |
|||
</ContentPage.Content> |
|||
</ContentPage> |
@ -0,0 +1,41 @@ |
|||
using CircleSDK.Model; |
|||
using CommunityToolkit.Maui.Alerts; |
|||
using CommunityToolkit.Maui.Core; |
|||
|
|||
namespace CircleViewerMaui |
|||
{ |
|||
public partial class UserGroups : ContentPage |
|||
{ |
|||
public List<CircleInfo> Circles; |
|||
public UserGroups() |
|||
{ |
|||
InitializeComponent(); |
|||
Circles = new List<CircleInfo>(App.CDP.Circles); |
|||
// Circles = App.CDP.Circles;
|
|||
// lvCircles.ItemsSource = App.CDP.Circles;
|
|||
circlePicker.ItemsSource = App.CDP.Circles; |
|||
circlePicker.ItemDisplayBinding = new Binding("CircleName"); |
|||
} |
|||
|
|||
private async void BnRequestVerfication_OnClicked(object sender, EventArgs e) |
|||
{ |
|||
var reply = await App.CDP.ProcessInvite(RequestCode.Text, VerificationCode.Text); |
|||
if (reply.Status.Result.GetValueOrDefault(false)) |
|||
{ |
|||
ShowToast("Failed to process request."); |
|||
} |
|||
else |
|||
{ |
|||
ShowToast("Request has be submitted."); |
|||
} |
|||
} |
|||
async void ShowToast(string text) |
|||
{ |
|||
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); |
|||
ToastDuration duration = ToastDuration.Short; |
|||
double fontSize = 14; |
|||
var toast = Toast.Make(text, duration, fontSize); |
|||
await toast.Show(cancellationTokenSource.Token); |
|||
} |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue