Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit d426d31

Browse files
committed
Added modal prompts.
1 parent 86868dd commit d426d31

8 files changed

+58
-9
lines changed
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="WorkingWithPopups.Android">
33
<uses-sdk android:minSdkVersion="19" />
4-
<application android:label="WorkingWithPopups.Android">
5-
</application>
4+
<application android:label="WorkingWithPopups.Android"></application>
65
</manifest>

Navigation/Pop-ups/Android/WorkingWithPopups.Android.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<ConsolePause>false</ConsolePause>
4040
</PropertyGroup>
4141
<ItemGroup>
42-
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
42+
<PackageReference Include="Xamarin.Forms" Version="4.3.0.819712-pre2" />
4343
</ItemGroup>
4444
<ItemGroup>
4545
<Reference Include="System" />
@@ -76,4 +76,4 @@
7676
<AndroidResource Include="Resources\values\colors.xml" />
7777
</ItemGroup>
7878
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
79-
</Project>
79+
</Project>

Navigation/Pop-ups/UWP/WorkingWithPopups.UWP.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
</PropertyGroup>
9090
<ItemGroup>
9191
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.0.12" />
92-
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
92+
<PackageReference Include="Xamarin.Forms" Version="4.3.0.819712-pre2" />
9393
</ItemGroup>
9494
<ItemGroup />
9595
<ItemGroup>
@@ -136,4 +136,4 @@
136136
<VisualStudioVersion>14.0</VisualStudioVersion>
137137
</PropertyGroup>
138138
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
139-
</Project>
139+
</Project>

Navigation/Pop-ups/WorkingWithPopups/MainPage.xaml

100755100644
+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
<TabbedPage.Children>
77
<local:AlertPage Title="Alerts" IconImageSource="csharp.png" />
88
<local:ActionSheetPage Title="ActionSheets" IconImageSource="csharp.png" />
9+
<local:PromptPage Title="Prompts" IconImageSource="csharp.png" />
910
</TabbedPage.Children>
1011
</TabbedPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
x:Class="WorkingWithPopups.PromptPage">
5+
<StackLayout Margin="20,35,20,20">
6+
<Label Text="Display Prompt"
7+
FontSize="Large"
8+
HorizontalOptions="Center" />
9+
<Button Text="Question 1"
10+
Clicked="OnQuestion1ButtonClicked" />
11+
<Label x:Name="question1ResultLabel" />
12+
<Button Text="Question 2"
13+
Clicked="OnQuestion2ButtonClicked" />
14+
<Label x:Name="question2ResultLabel" />
15+
</StackLayout>
16+
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using Xamarin.Forms;
3+
4+
namespace WorkingWithPopups
5+
{
6+
public partial class PromptPage : ContentPage
7+
{
8+
public PromptPage()
9+
{
10+
InitializeComponent();
11+
}
12+
13+
async void OnQuestion1ButtonClicked(object sender, EventArgs e)
14+
{
15+
string result = await DisplayPromptAsync("Question 1", "What's your name?");
16+
if (!string.IsNullOrWhiteSpace(result))
17+
{
18+
question1ResultLabel.Text = $"Hello {result}.";
19+
}
20+
}
21+
22+
async void OnQuestion2ButtonClicked(object sender, EventArgs e)
23+
{
24+
string result = await DisplayPromptAsync("Question 2", "What's 5 + 5?", maxLength: 2, keyboard: Keyboard.Numeric);
25+
if (!string.IsNullOrWhiteSpace(result))
26+
{
27+
int number = Convert.ToInt32(result);
28+
question2ResultLabel.Text = number == 10 ? "Correct." : "Incorrect.";
29+
}
30+
}
31+
}
32+
}
33+

Navigation/Pop-ups/WorkingWithPopups/WorkingWithPopups.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
12+
<PackageReference Include="Xamarin.Forms" Version="4.3.0.819712-pre2" />
1313
</ItemGroup>
1414

1515
<ItemGroup>
@@ -24,4 +24,4 @@
2424
</EmbeddedResource>
2525
</ItemGroup>
2626

27-
</Project>
27+
</Project>

Navigation/Pop-ups/iOS/WorkingWithPopups.iOS.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
9191
</PropertyGroup>
9292
<ItemGroup>
93-
<PackageReference Include="Xamarin.Forms" Version="4.2.0.709249" />
93+
<PackageReference Include="Xamarin.Forms" Version="4.3.0.819712-pre2" />
9494
</ItemGroup>
9595
<ItemGroup>
9696
<Reference Include="System" />

0 commit comments

Comments
 (0)