Organize samples

This commit is contained in:
Frank A. Krueger 2017-11-19 12:49:17 -06:00
parent ecd9683a26
commit 010d1f75d0
6 changed files with 49 additions and 28 deletions

View File

@ -0,0 +1,16 @@
using Ooui;
using Xamarin.Forms;
namespace Samples
{
public class ButtonXamlSample : ISample
{
public string Title => "Xamarin.Forms Button XAML";
public Ooui.Element CreateElement ()
{
var page = new ButtonXaml.ButtonXamlPage ();
return page.GetOouiElement ();
}
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Samples.DisplayAlertSample"> x:Class="Samples.DisplayAlertPage">
<ContentPage.Content> <ContentPage.Content>
<StackLayout> <StackLayout>
<Label Text="Welcome to DisplayAlert Sample!" /> <Label Text="Welcome to DisplayAlert Sample!" />

View File

@ -7,9 +7,9 @@ using Xamarin.Forms.Xaml;
namespace Samples namespace Samples
{ {
[XamlCompilation(XamlCompilationOptions.Compile)] [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class DisplayAlertSample : ContentPage public partial class DisplayAlertPage : ContentPage
{ {
public DisplayAlertSample () public DisplayAlertPage ()
{ {
InitializeComponent (); InitializeComponent ();
} }
@ -19,11 +19,5 @@ 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

@ -0,0 +1,22 @@
using System;
using Ooui;
using Xamarin.Forms;
namespace Samples
{
public class DisplayAlertSample : ISample
{
public string Title => "Xamarin.Forms DisplayAlert";
public Ooui.Element CreateElement ()
{
var page = new DisplayAlertPage ();
return page.GetOouiElement ();
}
public void Publish ()
{
UI.Publish ("/display-alert", CreateElement);
}
}
}

View File

@ -18,8 +18,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="DisplayAlertSample.xaml.cs"> <Compile Condition=" '$(EnableDefaultCompileItems)' == 'true' " Update="ButtonXamlPage.xaml.cs">
<SubType>Code</SubType> <DependentUpon>*.xaml</DependentUpon>
</Compile>
<Compile Condition=" '$(EnableDefaultCompileItems)' == 'true' " Update="DisplayAlertPage.xaml.cs">
<DependentUpon>*.xaml</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
@ -27,7 +30,7 @@
<EmbeddedResource Update="ButtonXamlPage.xaml"> <EmbeddedResource Update="ButtonXamlPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="DisplayAlertSample.xaml"> <EmbeddedResource Update="DisplayAlertPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>

View File

@ -1,14 +0,0 @@
using Xamarin.Forms;
namespace Samples
{
public class XamlPageSample
{
public string Title => "Xamarin.Forms Button XAML";
public Ooui.Element CreateElement (Page page)
{
return page.GetOouiElement ();
}
}
}