
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.Foundation;
using System;

namespace WebServices
{
	public partial class MainViewController : UIViewController
	{

		public MainViewController(string nibName, NSBundle bundle) : base(nibName, bundle)
		{
			// Custom initialization
		}

		// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();
			//Deal with image
			var image = new UIImage("Fire.jpg");
			var imageView = new UIDraggableImageView(image);
			var appF = UIScreen.MainScreen.ApplicationFrame;
			var imgS = image.Size;
			imageView.Frame = new RectangleF((appF.Width - imgS.Width) / 2, 
				(appF.Height - imgS.Height) / 2, imgS.Width, imgS.Height);
			View.AddSubview(imageView);
		}

		partial void showInfo(UIButton sender)
		{
			var controller = new FlipsideViewController("FlipsideView", null);
			controller.Done += delegate { this.DismissModalViewControllerAnimated(true); };
			controller.ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal;
			this.PresentModalViewController(controller, true);
		}


		/*
		// Override to allow orientations other than the default portrait orientation.
		public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
		{
			// Return true for supported orientations
			return (InterfaceOrientation == UIInterfaceOrientation.Portrait);
		}
		*/

		public override void DidReceiveMemoryWarning()
		{
			// Releases the view if it doesn't have a superview.
			base.DidReceiveMemoryWarning();
			
			// Release any cached data, images, etc that aren't in use.
		}

		public override void ViewDidUnload()
		{
			// Release any retained subviews of the main view.
			// e.g. this.myOutlet = null;
		}
	}
}

