Cleaned up sample code using DisplayAlert

This commit is contained in:
Andrew Hoefling 2017-11-17 23:16:12 +00:00
parent 2b8ce39a5c
commit 0ccc89a325
2 changed files with 14 additions and 9 deletions

View File

@ -1,4 +1,5 @@
using System; using Ooui;
using System;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Xaml; using Xamarin.Forms.Xaml;
@ -18,5 +19,11 @@ namespace Samples
var result = await DisplayAlert("Alert Message", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa.", "YES", "NO"); var result = await DisplayAlert("Alert Message", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa.", "YES", "NO");
await DisplayAlert("Alert Response", $"You selected value: {result}", "OK"); await DisplayAlert("Alert Response", $"You selected value: {result}", "OK");
} }
public void Publish()
{
var sample = new XamlPageSample();
UI.Publish("/display-alert", sample.CreateElement(this));
}
} }
} }

View File

@ -25,15 +25,13 @@ namespace Samples
} }
} }
new ButtonSample().Publish(); new ButtonSample ().Publish ();
new TodoSample().Publish(); new TodoSample ().Publish ();
new DrawSample().Publish(); new DrawSample ().Publish ();
new FilesSample().Publish(); new FilesSample ().Publish ();
new DisplayAlertSample ().Publish ();
var sample = new XamlPageSample(); UI.Present ("/display-alert");
UI.Publish("/display-alert", sample.CreateElement(new DisplayAlertSample()));
UI.Present ("/display-alert", sample);
Console.ReadLine (); Console.ReadLine ();
} }