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

namespace GaugeXF_1171097.Portable
{
    public partial class StartPage : ContentPage
    {
        public StartPage()
        {
            InitializeComponent();
        }
    }

    public class SemiCircleGauge : Layout<View>
    {
        protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
        {
            foreach (View child in this.Children)
            {
                SizeRequest sr = child.Measure(widthConstraint, 2 * heightConstraint);
                return new SizeRequest(new Size(sr.Request.Width, sr.Request.Height / 2), sr.Minimum);
            }

            return new SizeRequest(new Size(10, 10));
        }

        protected override void LayoutChildren(double x, double y, double width, double height)
        {
            foreach (View child in this.Children)
            {
                child.Layout(new Rectangle(x, y, width, 2 * height));
            }
        }
    }
}