Inheritance: UIView
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			UIInterfaceOrientation orientation = UIApplication.SharedApplication.StatusBarOrientation;
			float width = View.Frame.Width;

			float height = View.Frame.Height;
			if (orientation == UIInterfaceOrientation.LandscapeLeft || orientation == UIInterfaceOrientation.LandscapeRight) 
			{
				width = View.Frame.Height;
				height = View.Frame.Width;
			}

			recognizedTextLabel = new UILabel (new RectangleF(button_gap, 30, width, 20));
			recognizedTextLabel.Text = "Recognized Text:";
			View.Add (recognizedTextLabel);
			recognizedText = new UITextView (new RectangleF (button_gap, header_height, width - button_gap * 2, height/4));
			recognizedText.Editable = false;
			recognizedText.Font = UIFont.FromName ("Courier", 18);
			recognizedText.Text = "";
			recognizedText.BackgroundColor = UIColor.Gray;
			recognizedText.TextColor = UIColor.White;
			View.Add (recognizedText);
			inkView = new InkView ();
			inkView.Frame = new RectangleF (button_gap, header_height + height/4 + button_gap, width - button_gap * 2, height - bottom_gap - (height/4) - header_height - button_gap);
			inkView.ContentMode = UIViewContentMode.Redraw;
			View.Add (inkView);

			inkView.OnReturnGesture += () => recognizedText.Text = inkView.Recognize( true );
			inkView.OnReturnGesture += () => inkView.cleanView(true);
			inkView.OnCutGesture += () => inkView.cleanView(true);

			float x = (width - (button_width * 4 + button_gap * 3))/2;
			recognizeAllButton = new UIButton (UIButtonType.Custom);
			recognizeAllButton.Frame = new RectangleF (x, height - bottom_gap, button_width, button_height);
			recognizeAllButton.SetTitle("Recognize", UIControlState.Normal);
			recognizeAllButton.Font = UIFont.SystemFontOfSize( button_font_size );
			recognizeAllButton.SetTitleColor (UIColor.Blue, UIControlState.Normal);
			recognizeAllButton.SetTitleColor (UIColor.White, UIControlState.Highlighted);
			recognizeAllButton.TouchUpInside += (object sender, EventArgs e) => 
			{
				recognizedText.Text = inkView.Recognize( false );
			};
			View.Add (recognizeAllButton);
			x += (button_gap + button_width);
			clearButton = new UIButton (UIButtonType.Custom);
			clearButton.Frame = new RectangleF (x, height - bottom_gap, button_width, button_height);
			clearButton.SetTitle("Clear", UIControlState.Normal);
			clearButton.Font = UIFont.SystemFontOfSize( button_font_size );
			clearButton.SetTitleColor (UIColor.Blue, UIControlState.Normal);
			clearButton.SetTitleColor (UIColor.White, UIControlState.Highlighted);
			clearButton.TouchUpInside += (object sender, EventArgs e) => 
			{
				inkView.cleanView(true);
			};
			View.Add (clearButton);

			x += (button_gap + button_width);
			languageButton = new UIButton (UIButtonType.Custom);
			languageButton.Frame = new RectangleF (x , height - bottom_gap, button_width, button_height);
			languageButton.SetTitle("Language", UIControlState.Normal);
			languageButton.Font = UIFont.SystemFontOfSize( button_font_size );
			languageButton.SetTitleColor (UIColor.Blue, UIControlState.Normal);
			languageButton.SetTitleColor (UIColor.White, UIControlState.Highlighted);
			languageButton.TouchUpInside += (object sender, EventArgs e) => 
			{
				var actionSheet = new UIActionSheet ("Select Language:", null, "Cancel", null, 
					new []{"English", "English UK", "German", "French", "Spanish", "Portuguese", "Brazilian", "Dutch", "Italian", "Finnish", "Swedish", "Norwegian", "Danish", "Indonesian"});
				actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) {
					switch (b.ButtonIndex)
					{
					case 0:
						WritePadAPI.language = WritePadAPI.LanguageType.en;                                                       
						break;
					case 1:
                        WritePadAPI.language = WritePadAPI.LanguageType.en_uk;
						break;
					case 2:
                        WritePadAPI.language = WritePadAPI.LanguageType.de;
						break;
					case 3:
                        WritePadAPI.language = WritePadAPI.LanguageType.fr;
						break;
					case 4:
                        WritePadAPI.language = WritePadAPI.LanguageType.es;
						break;
					case 5:
                        WritePadAPI.language = WritePadAPI.LanguageType.pt_PT;
						break;
					case 6:
						WritePadAPI.language = WritePadAPI.LanguageType.pt_BR;
						break;
					case 7:
						WritePadAPI.language = WritePadAPI.LanguageType.nl;
						break;
					case 8:
						WritePadAPI.language = WritePadAPI.LanguageType.it;
						break;
					case 9:
						WritePadAPI.language = WritePadAPI.LanguageType.fi;
						break;
					case 10:
						WritePadAPI.language = WritePadAPI.LanguageType.sv;
						break;
					case 11:
						WritePadAPI.language = WritePadAPI.LanguageType.nb;
						break;
					case 12:
						WritePadAPI.language = WritePadAPI.LanguageType.da;
						break;                       
					case 13:
						WritePadAPI.language = WritePadAPI.LanguageType.id;
						break;                       
					}
					WritePadAPI.recoFree();
					WritePadAPI.recoInit();
                    WritePadAPI.initializeFlags();
					inkView.cleanView(true);
					recognizedTextLabel.Text = "Language: "+ " (" + WritePadAPI.getLanguageName() + ")";           
				};
				actionSheet.ShowInView (View);
			};
			View.Add (languageButton);

			x += (button_gap + button_width);
			optionsButton = new UIButton (UIButtonType.Custom);
			optionsButton.Frame = new RectangleF (x, height - bottom_gap, button_width, button_height);
			optionsButton.SetTitle("Options", UIControlState.Normal);
			optionsButton.Font = UIFont.SystemFontOfSize( button_font_size );
			optionsButton.SetTitleColor (UIColor.Blue, UIControlState.Normal);
			optionsButton.SetTitleColor (UIColor.White, UIControlState.Highlighted);
			optionsButton.TouchUpInside += (object sender, EventArgs e) => 
			{
				OptionsViewControllerController optionsController = new OptionsViewControllerController();
				UINavigationController navController = new UINavigationController(optionsController);
				navController.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
				PresentViewController(navController, true, null);

			};
			View.Add (optionsButton);

			recognizedTextLabel.Text = "Language: "+ " (" + WritePadAPI.getLanguageName() + ")";           
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            UIInterfaceOrientation orientation = UIApplication.SharedApplication.StatusBarOrientation;
            float width = View.Frame.Width;

            float height = View.Frame.Height;

            if (orientation == UIInterfaceOrientation.LandscapeLeft || orientation == UIInterfaceOrientation.LandscapeRight)
            {
                width  = View.Frame.Height;
                height = View.Frame.Width;
            }

            recognizedTextLabel      = new UILabel(new RectangleF(button_gap, 30, width, 20));
            recognizedTextLabel.Text = "Recognized Text:";
            View.Add(recognizedTextLabel);
            recognizedText                 = new UITextView(new RectangleF(button_gap, header_height, width - button_gap * 2, height / 4));
            recognizedText.Editable        = false;
            recognizedText.Font            = UIFont.FromName("Courier", 18);
            recognizedText.Text            = "";
            recognizedText.BackgroundColor = UIColor.Gray;
            recognizedText.TextColor       = UIColor.White;
            View.Add(recognizedText);
            inkView             = new InkView();
            inkView.Frame       = new RectangleF(button_gap, header_height + height / 4 + button_gap, width - button_gap * 2, height - bottom_gap - (height / 4) - header_height - button_gap);
            inkView.ContentMode = UIViewContentMode.Redraw;
            View.Add(inkView);

            inkView.OnReturnGesture += () => recognizedText.Text = inkView.Recognize(true);
            inkView.OnReturnGesture += () => inkView.cleanView(true);
            inkView.OnCutGesture    += () => inkView.cleanView(true);

            float x = (width - (button_width * 4 + button_gap * 3)) / 2;

            recognizeAllButton       = new UIButton(UIButtonType.Custom);
            recognizeAllButton.Frame = new RectangleF(x, height - bottom_gap, button_width, button_height);
            recognizeAllButton.SetTitle("Recognize", UIControlState.Normal);
            recognizeAllButton.Font = UIFont.SystemFontOfSize(button_font_size);
            recognizeAllButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            recognizeAllButton.SetTitleColor(UIColor.White, UIControlState.Highlighted);
            recognizeAllButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                recognizedText.Text = inkView.Recognize(false);
            };
            View.Add(recognizeAllButton);
            x                += (button_gap + button_width);
            clearButton       = new UIButton(UIButtonType.Custom);
            clearButton.Frame = new RectangleF(x, height - bottom_gap, button_width, button_height);
            clearButton.SetTitle("Clear", UIControlState.Normal);
            clearButton.Font = UIFont.SystemFontOfSize(button_font_size);
            clearButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            clearButton.SetTitleColor(UIColor.White, UIControlState.Highlighted);
            clearButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                inkView.cleanView(true);
            };
            View.Add(clearButton);

            x += (button_gap + button_width);
            languageButton       = new UIButton(UIButtonType.Custom);
            languageButton.Frame = new RectangleF(x, height - bottom_gap, button_width, button_height);
            languageButton.SetTitle("Language", UIControlState.Normal);
            languageButton.Font = UIFont.SystemFontOfSize(button_font_size);
            languageButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            languageButton.SetTitleColor(UIColor.White, UIControlState.Highlighted);
            languageButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                var actionSheet = new UIActionSheet("Select Language:", null, "Cancel", null,
                                                    new [] { "English", "English UK", "German", "French", "Spanish", "Portuguese", "Brazilian", "Dutch", "Italian", "Finnish", "Swedish", "Norwegian", "Danish", "Indonesian" });
                actionSheet.Clicked += delegate(object a, UIButtonEventArgs b) {
                    switch (b.ButtonIndex)
                    {
                    case 0:
                        WritePadAPI.language = WritePadAPI.LanguageType.en;
                        break;

                    case 1:
                        WritePadAPI.language = WritePadAPI.LanguageType.en_uk;
                        break;

                    case 2:
                        WritePadAPI.language = WritePadAPI.LanguageType.de;
                        break;

                    case 3:
                        WritePadAPI.language = WritePadAPI.LanguageType.fr;
                        break;

                    case 4:
                        WritePadAPI.language = WritePadAPI.LanguageType.es;
                        break;

                    case 5:
                        WritePadAPI.language = WritePadAPI.LanguageType.pt_PT;
                        break;

                    case 6:
                        WritePadAPI.language = WritePadAPI.LanguageType.pt_BR;
                        break;

                    case 7:
                        WritePadAPI.language = WritePadAPI.LanguageType.nl;
                        break;

                    case 8:
                        WritePadAPI.language = WritePadAPI.LanguageType.it;
                        break;

                    case 9:
                        WritePadAPI.language = WritePadAPI.LanguageType.fi;
                        break;

                    case 10:
                        WritePadAPI.language = WritePadAPI.LanguageType.sv;
                        break;

                    case 11:
                        WritePadAPI.language = WritePadAPI.LanguageType.nb;
                        break;

                    case 12:
                        WritePadAPI.language = WritePadAPI.LanguageType.da;
                        break;

                    case 13:
                        WritePadAPI.language = WritePadAPI.LanguageType.id;
                        break;
                    }
                    WritePadAPI.recoFree();
                    WritePadAPI.recoInit();
                    WritePadAPI.initializeFlags();
                    inkView.cleanView(true);
                    recognizedTextLabel.Text = "Language: " + " (" + WritePadAPI.getLanguageName() + ")";
                };
                actionSheet.ShowInView(View);
            };
            View.Add(languageButton);

            x                  += (button_gap + button_width);
            optionsButton       = new UIButton(UIButtonType.Custom);
            optionsButton.Frame = new RectangleF(x, height - bottom_gap, button_width, button_height);
            optionsButton.SetTitle("Options", UIControlState.Normal);
            optionsButton.Font = UIFont.SystemFontOfSize(button_font_size);
            optionsButton.SetTitleColor(UIColor.Blue, UIControlState.Normal);
            optionsButton.SetTitleColor(UIColor.White, UIControlState.Highlighted);
            optionsButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                OptionsViewControllerController optionsController = new OptionsViewControllerController();
                UINavigationController          navController     = new UINavigationController(optionsController);
                navController.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
                PresentViewController(navController, true, null);
            };
            View.Add(optionsButton);

            recognizedTextLabel.Text = "Language: " + " (" + WritePadAPI.getLanguageName() + ")";
        }