using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace XamarinStudy.Views
{
	[XamlCompilation(XamlCompilationOptions.Compile)]
	public partial class SampleDisplayAlertActionSheetPage : ContentPage
	{
		public SampleDisplayAlertActionSheetPage()
		{
			InitializeComponent();
		}

		private void button1_Clicked(object sender, EventArgs e)
		{
			DisplayAlert("Title", "This is alert.", "OK");
		}

		private async void button2_Clicked(object sender, EventArgs e)
		{
			var result = await DisplayAlert("Question", "Select result.", "YES", "NO");
			if (result)
				label1.Text = "YES";
			else
				label1.Text = "NO";
		}

		private async void button3_Clicked(object sender, EventArgs e)
		{
			var result = await DisplayActionSheet("Change font style.", "Cancel", null, "Bold", "Italic", "None");
			switch (result)
			{
				case "Bold":
					label1.FontAttributes = FontAttributes.Bold;
					break;
				case "Italic":
					label1.FontAttributes = FontAttributes.Italic;
					break;
				case "None":
					label1.FontAttributes = FontAttributes.None;
					break;
				default:
					break;
			}
		}

		private async void button4_Clicked(object sender, EventArgs e)
		{
			var result = await DisplayActionSheet("Change font style.", "Cancel", null, "10", "20", "30", "40", "50");
			if (result == null)
				return;

			label1.FontSize = double.Parse(result);
		}
	}
}