Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ public AlertsPage()

var resultLabel = new Label
{
AutomationId = "WpfDialogResultLabel",
Text = "Result: (none yet)",
FontSize = 14,
TextColor = Colors.DodgerBlue,
};

// Simple alert (OK only)
var simpleAlertBtn = new Button { Text = "Simple Alert (OK)" };
var simpleAlertBtn = new Button { Text = "Simple Alert (OK)", AutomationId = "WpfSimpleAlertBtn" };
simpleAlertBtn.Clicked += async (s, e) =>
{
resultLabel.Text = "Result: Alert requested...";
Expand All @@ -31,15 +32,15 @@ public AlertsPage()
};

// Confirm alert (Accept / Cancel)
var confirmAlertBtn = new Button { Text = "Confirm Alert (Yes / No)" };
var confirmAlertBtn = new Button { Text = "Confirm Alert (Yes / No)", AutomationId = "WpfConfirmAlertBtn" };
confirmAlertBtn.Clicked += async (s, e) =>
{
bool answer = await ConnectedPage.DisplayAlertAsync("Confirm", "Do you want to proceed?", "Yes", "No");
resultLabel.Text = $"Result: Confirmed = {answer}";
};

// Action sheet
var actionSheetBtn = new Button { Text = "Action Sheet" };
var actionSheetBtn = new Button { Text = "Action Sheet", AutomationId = "WpfActionSheetBtn" };
actionSheetBtn.Clicked += async (s, e) =>
{
string action = await ConnectedPage.DisplayActionSheetAsync(
Expand All @@ -51,7 +52,7 @@ public AlertsPage()
};

// Action sheet without destruction
var actionSheet2Btn = new Button { Text = "Action Sheet (no destructive)" };
var actionSheet2Btn = new Button { Text = "Action Sheet (no destructive)", AutomationId = "WpfActionSheetNoDestructiveBtn" };
actionSheet2Btn.Clicked += async (s, e) =>
{
string action = await ConnectedPage.DisplayActionSheetAsync(
Expand All @@ -63,15 +64,15 @@ public AlertsPage()
};

// Prompt
var promptBtn = new Button { Text = "Text Prompt" };
var promptBtn = new Button { Text = "Text Prompt", AutomationId = "WpfPromptBtn" };
promptBtn.Clicked += async (s, e) =>
{
string name = await ConnectedPage.DisplayPromptAsync("Your Name", "What should we call you?", placeholder: "Enter name...");
resultLabel.Text = name != null ? $"Result: Name = {name}" : "Result: Prompt cancelled";
};

// Prompt with initial value
var promptInitBtn = new Button { Text = "Prompt (with initial value)" };
var promptInitBtn = new Button { Text = "Prompt (with initial value)", AutomationId = "WpfPromptInitialValueBtn" };
promptInitBtn.Clicked += async (s, e) =>
{
string value = await ConnectedPage.DisplayPromptAsync("Edit Value", "Modify the text below:", initialValue: "Hello World");
Expand Down
Loading
Loading