summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/ControlGalleryPages/LayoutAddPerformance.xaml.cs
blob: 1c25c63353b50c85f6c0ec571949a2eb94632be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;

namespace Xamarin.Forms.Controls
{
	public partial class LayoutAddPerformance : ContentPage
	{
		public LayoutAddPerformance ()
		{
			InitializeComponent ();
		}

		protected override async void OnAppearing ()
		{
			base.OnAppearing ();

			layout.Children.Clear ();

			await Task.Delay (2000);

			Stopwatch sw = new Stopwatch();
			sw.Start ();
			for (int i = 0; i < 500; i++) {
				layout.Children.Add (new Label { Text = i.ToString () });
			}
			sw.Stop ();
			this.timingLabel.Text = sw.ElapsedMilliseconds.ToString ();
		}
	}
}