/Hnefatafl/Controllers/MenuController.cs
https://bitbucket.org/trisi/hnefatafl-monotouch · C# · 74 lines · 64 code · 10 blank · 0 comment · 3 complexity · 19b153894019b6b82afece324b6de055 MD5 · raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using MonoTouch.Foundation;
- using MonoTouch.UIKit;
- using MonoTouch.GameKit;
- using MonoTouch.MessageUI;
- using Core;
- namespace Hnefatafl {
- public class MenuController : UIViewController {
- MenuView view;
- SelectVariationController variationController;
- UIViewController gameController;
-
- public MenuController ()
- {
- }
- public void btnPassNPlay_Pushed ()
- {
- variationController = new SelectVariationController (GameType.PassNPlay);
- NavigationController.PushViewController (variationController, true);
- }
- public void btnAsynchronous_Pushed ()
- {
- gameController = new OnlineMenuController ();
- NavigationController.PushViewController (gameController, true);
- }
- public void btnRules_Pushed ()
- {
- UIViewController rulesView = new RulesController ();
- NavigationController.PushViewController (rulesView, true);
- }
- public void btnFeedback_Pushed ()
- {
- MFMailComposeViewController mail = new MFMailComposeViewController ();
- mail.Finished += (object sender, MFComposeResultEventArgs e) => {
- DismissViewController (true, null);
- if (e.Result == MFMailComposeResult.Failed)
- new UIAlertView ("Message Failed!",
- "Your email failed to send",
- null, "Okay", null).Show ();
- };
- if (MFMailComposeViewController.CanSendMail) {
- mail.SetToRecipients ( new string [] { "risiapps@gmail.com" });
- mail.SetSubject ("Hnefatafl Feedback");
- mail.SetMessageBody ("", false);
- PresentViewController (mail, true, null);
- }
- }
-
- public override void LoadView ()
- {
- view = new MenuView ();
-
- view.btnPassNPlay_Pushed = btnPassNPlay_Pushed;
- view.btnAsynchronous_Pushed = btnAsynchronous_Pushed;
- view.btnRules_Pushed = btnRules_Pushed;
- view.btnFeedback_Pushed = btnFeedback_Pushed;
-
- View = view;
- }
-
- public override void ViewWillAppear (bool animated)
- {
- NavigationController.NavigationBar.Hidden = true;
- base.ViewDidLoad ();
- }
- }
- }