public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ImageCropViewController = new ImageCropViewController( );
            LoginViewController     = new LoginViewController(this);
            ContainerViewController = new ContainerViewController(this);
            FirstRunViewController  = new FirstRunViewController(this);

            // load any current cached config
            Config.Instance.LoadFromDevice( );

            // color it with whatever we currently have.
            if (Config.Instance.VisualSettings.TopHeaderBGColor != null && Config.Instance.VisualSettings.BackgroundColor != null)
            {
                ColorNavBar(Config.Instance.VisualSettings.TopHeaderBGColor);
                View.BackgroundColor = Theme.GetColor(Config.Instance.VisualSettings.BackgroundColor);
            }
            else
            {
                // if either of our colors are null, this is probably our first run, so just use black.

                ColorNavBar("#000000FF");
                View.BackgroundColor = Theme.GetColor("#000000FF");
            }

            // create a simple centered label (slightly above center, actually) that lets the user know we're trying to connect
            ConnectingLabel = new UILabel();
            ConnectingLabel.Layer.AnchorPoint = CGPoint.Empty;
            ConnectingLabel.Font      = ConnectingLabel.Font.WithSize(32);
            ConnectingLabel.Text      = "Connecting to Rock";
            ConnectingLabel.TextColor = Theme.GetColor("#6A6A6AFF");
            ConnectingLabel.SizeToFit( );
            ConnectingLabel.Layer.Position = new CGPoint((View.Bounds.Width - ConnectingLabel.Bounds.Width) / 2,
                                                         ((View.Bounds.Height - ConnectingLabel.Bounds.Height) / 2) - ConnectingLabel.Bounds.Height);
            View.AddSubview(ConnectingLabel);

            // show a spinner so the user feels like there's activity happening
            ProgressIndicator = new UIActivityIndicatorView();
            ProgressIndicator.Layer.AnchorPoint          = CGPoint.Empty;
            ProgressIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
            ProgressIndicator.Color = UIColor.Gray;
            ProgressIndicator.StartAnimating( );
            ProgressIndicator.Layer.Position = new CGPoint((View.Bounds.Width - ProgressIndicator.Bounds.Width) / 2, ConnectingLabel.Frame.Bottom + 30);
            View.AddSubview(ProgressIndicator);

            LockTimer = DateTime.Now;
        }
        void Start( )
        {
            RockApi.SetRockURL(Config.Instance.RockURL);
            RockApi.SetAuthorizationKey(Config.Instance.RockAuthorizationKey);

            // get the initial config (this is where we call the new Update)
            Config.Instance.UpdateCurrentConfigurationDefinedValue(
                delegate(bool result)
            {
                // failure or not, hide the connection UI
                ProgressIndicator.Hidden           = true;
                ProgressIndicator.HidesWhenStopped = true;
                ProgressIndicator.StopAnimating( );

                ConnectingLabel.Hidden = true;

                if (result)
                {
                    // we're good to move on.

                    // first hide the FirstRun (in case it was showing)
                    if (FirstRunViewController != null)
                    {
                        FirstRunViewController.DismissViewController(true, null);
                    }

                    ApplyCurrentConfigSettings( );

                    // add the container, so that when we're done with the login it will already be there.
                    PushViewController(ContainerViewController, false);

                    DisplayLoginScreen(false);
                }
                else
                {
                    // display an error and return them to the first run screen.
                    DisplayFirstRun( );
                }
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ImageCropViewController = new ImageCropViewController( );
            LoginViewController = new LoginViewController( this );
            ContainerViewController = new ContainerViewController( this );
            FirstRunViewController = new FirstRunViewController( this );

            // load any current cached config
            Config.Instance.LoadFromDevice( );

            // color it with whatever we currently have.
            if ( Config.Instance.VisualSettings.TopHeaderBGColor != null && Config.Instance.VisualSettings.BackgroundColor != null )
            {
                ColorNavBar( Config.Instance.VisualSettings.TopHeaderBGColor );
                View.BackgroundColor = Theme.GetColor( Config.Instance.VisualSettings.BackgroundColor );
            }
            else
            {
                // if either of our colors are null, this is probably our first run, so just use black.

                ColorNavBar( "#000000FF" );
                View.BackgroundColor = Theme.GetColor( "#000000FF" );
            }

            // create a simple centered label (slightly above center, actually) that lets the user know we're trying to connect
            ConnectingLabel = new UILabel();
            ConnectingLabel.Layer.AnchorPoint = CGPoint.Empty;
            ConnectingLabel.Font = ConnectingLabel.Font.WithSize( 32 );
            ConnectingLabel.Text = "Connecting to Rock";
            ConnectingLabel.TextColor = Theme.GetColor( "#6A6A6AFF" );
            ConnectingLabel.SizeToFit( );
            ConnectingLabel.Layer.Position = new CGPoint( ( View.Bounds.Width - ConnectingLabel.Bounds.Width ) / 2,
                                                         ( (View.Bounds.Height - ConnectingLabel.Bounds.Height ) / 2) - ConnectingLabel.Bounds.Height  );
            View.AddSubview( ConnectingLabel );

            // show a spinner so the user feels like there's activity happening
            ProgressIndicator = new UIActivityIndicatorView();
            ProgressIndicator.Layer.AnchorPoint = CGPoint.Empty;
            ProgressIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
            ProgressIndicator.Color = UIColor.Gray;
            ProgressIndicator.StartAnimating( );
            ProgressIndicator.Layer.Position = new CGPoint( ( View.Bounds.Width - ProgressIndicator.Bounds.Width ) / 2, ConnectingLabel.Frame.Bottom + 30 );
            View.AddSubview( ProgressIndicator );

            LockTimer = DateTime.Now;
        }