using System.Windows.Input;
using Microsoft.Phone.Controls;

namespace WP7Touch
{
	public partial class MainPage : PhoneApplicationPage
	{
		public MainPage()
		{
			InitializeComponent();

			SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;
		}

		private void Rectangle_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
		{
			touchStatus.Text = "Manipulation Started";
		}

		private void Rectangle_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
		{
			touchStatus.Text = "Manipulation Delta";

			if(e.DeltaManipulation.Scale.X != 0)
				transform.ScaleX *= e.DeltaManipulation.Scale.X;

			if(e.DeltaManipulation.Scale.Y != 0)
				transform.ScaleY *= e.DeltaManipulation.Scale.Y;

			transform.TranslateX += e.DeltaManipulation.Translation.X;
			transform.TranslateY += e.DeltaManipulation.Translation.Y;

			e.Handled = true;
		}

		private void Rectangle_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
		{
			touchStatus.Text = "Manipulation Completed";
		}

	}
}
