You also want to show your login window when the app goes inactive.

On Thu, Feb 9, 2012 at 10:06 AM, trip <[email protected]> wrote:

> Hi
>
> I'm not sure 100% sure I solved this nicely, I've ended up using two
> Windows, something like this:
>
>        [Register ("AppDelegate")]
>        public class AppDelegate : UIApplicationDelegate
>        {
>                UIWindow _loginWindow, _mainWindow;
>
>                private UIViewController _loginViewController,
> _mainNavigationController;
>
>                bool _signedIn;
>                public override bool FinishedLaunching (UIApplication app,
> NSDictionary
> options)
>                {
>                        if (_signedIn) {
>                                ShowMainWindow ();
>                        } else
>                                ShowLoginWindow ();
>                        return true;
>                }
>
>                public void ShowLoginWindow ()
>                {
>                        if (_mainWindow != null) {
>                                _mainWindow.Hidden = true;
>                                _mainWindow.RemoveFromSuperview ();
>                                _mainWindow.Dispose ();
>                                _mainWindow = null;
>                        }
>                        _loginWindow = new UIWindow
> (UIScreen.MainScreen.Bounds);
>                        _loginViewController = new LoginViewController ();
>                        _loginWindow.RootViewController =
> _loginViewController;
>                        _loginWindow.MakeKeyAndVisible ();
>                }
>
>                public void ShowMainWindow ()
>                {
>                        if (_loginWindow != null) {
>                                _loginWindow.Hidden = true;
>                                _loginWindow.RemoveFromSuperview ();
>                                _loginWindow.Dispose ();
>                                _loginWindow = null;
>                        }
>                        _mainWindow = new UIWindow
> (UIScreen.MainScreen.Bounds);
>                        _mainNavigationController = new
> MainNavigationViewController ();
>                        _mainWindow.RootViewController =
> _mainNavigationController;
>                        _mainWindow.MakeKeyAndVisible ();
>                }
>        }
>
>
> When My LoginWindow has done its jobs it just calls ShowMainWindow smth
> like
> this:
>
> ((AppDelegate)UIApplication.SharedApplication.Delegate).ShowMainWindow ();
>
> Hope this helps.
>
> Andy
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Getting-my-head-round-MVC-Login-type-app-tp3515200p4373150.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to