Example #1
0
        public void Create(object masterView, string bgLayerImageName, string logoImageName, RectangleF frame, OnButtonClick onClick)
        {
            // take the handler
            OnClick = onClick;

            View = PlatformView.Create( );
            View.BackgroundColor = ControlStylingConfig.OOBE_Splash_BG_Color;
            View.AddAsSubview(masterView);

            ImageBG = PlatformImageView.Create( );
            ImageBG.AddAsSubview(View.PlatformNativeObject);
            MemoryStream stream = Rock.Mobile.IO.AssetConvert.AssetToStream(bgLayerImageName);

            if (stream != null)
            {
                stream.Position        = 0;
                ImageBG.Opacity        = 0;
                ImageBG.Image          = stream;
                ImageBG.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFill;
                stream.Dispose( );
            }

            NetworkErrorLabel = PlatformLabel.Create( );
            NetworkErrorLabel.SetFont(ControlStylingConfig.Font_Light, 18);
            NetworkErrorLabel.TextColor     = 0xCCCCCCFF;
            NetworkErrorLabel.Text          = OOBEStrings.NetworkError;
            NetworkErrorLabel.TextAlignment = TextAlignment.Center;
            NetworkErrorLabel.Opacity       = 0;
            NetworkErrorLabel.SizeToFit( );
            NetworkErrorLabel.AddAsSubview(View.PlatformNativeObject);


            NetworkRetryButton = PlatformButton.Create( );
            NetworkRetryButton.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Medium_FontSize);
            NetworkRetryButton.TextColor = 0xCCCCCCFF;
            NetworkRetryButton.Text      = OOBEStrings.NetworRetry;
            NetworkRetryButton.Opacity   = 0;
            NetworkRetryButton.SizeToFit( );
            NetworkRetryButton.ClickEvent = (PlatformButton button ) =>
            {
                OnClick(-1, false);
            };
            NetworkRetryButton.AddAsSubview(View.PlatformNativeObject);


            WelcomeLabel = PlatformLabel.Create( );
            WelcomeLabel.SetFont(ControlStylingConfig.Font_Bold, 85);
            WelcomeLabel.TextColor = 0xCCCCCCFF;
            WelcomeLabel.Text      = OOBEStrings.Welcome;
            WelcomeLabel.Opacity   = 0;
            WelcomeLabel.SizeToFit( );
            WelcomeLabel.AddAsSubview(View.PlatformNativeObject);

            CampusHeader = PlatformLabel.Create( );
            CampusHeader.SetFont(ControlStylingConfig.Font_Light, 18);
            CampusHeader.TextColor     = 0xCCCCCCFF;
            CampusHeader.Text          = OOBEStrings.CampusIntro;
            CampusHeader.TextAlignment = TextAlignment.Center;
            CampusHeader.Opacity       = 0;
            CampusHeader.SizeToFit( );
            CampusHeader.AddAsSubview(View.PlatformNativeObject);

            // we'll wait to setup campuses until after a successful download
            CampusButtons = new List <PlatformButton>( );

            RegisterButton = PlatformButton.Create( );
            RegisterButton.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize);
            RegisterButton.TextColor = 0xCCCCCCFF;
            RegisterButton.Text      = string.Format(OOBEStrings.WantAccount, GeneralConfig.OrganizationShortName);
            RegisterButton.Opacity   = 0;
            RegisterButton.SizeToFit( );
            RegisterButton.ClickEvent = (PlatformButton button ) =>
            {
                // do not allow multiple register taps
                if (State == OOBE_State.WaitForAccountChoice)
                {
                    OnClick(0, false);

                    EnterNextState(OOBE_State.Done);
                }
            };
            RegisterButton.AddAsSubview(View.PlatformNativeObject);


            RegisterSeperator = PlatformView.Create( );
            RegisterSeperator.BackgroundColor = ControlStylingConfig.BG_Layer_BorderColor;
            RegisterSeperator.Bounds          = new RectangleF(0, 0, 0, 1);
            RegisterSeperator.AddAsSubview(View.PlatformNativeObject);


            LoginButton = PlatformButton.Create( );
            LoginButton.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize);
            LoginButton.TextColor = 0xCCCCCCFF;
            LoginButton.Text      = string.Format(OOBEStrings.HaveAccount, GeneralConfig.OrganizationShortName);
            LoginButton.Opacity   = 0;
            LoginButton.SizeToFit( );
            LoginButton.ClickEvent = (PlatformButton button ) =>
            {
                // do not allow multiple register taps
                if (State == OOBE_State.WaitForAccountChoice)
                {
                    OnClick(1, false);

                    EnterNextState(OOBE_State.Done);
                }
            };
            LoginButton.AddAsSubview(View.PlatformNativeObject);

            LoginSeperator = PlatformView.Create( );
            LoginSeperator.BackgroundColor = ControlStylingConfig.BG_Layer_BorderColor;
            LoginSeperator.Bounds          = new RectangleF(0, 0, 0, 1);
            LoginSeperator.AddAsSubview(View.PlatformNativeObject);


            SkipButton = PlatformButton.Create( );
            SkipButton.SetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Large_FontSize);
            SkipButton.TextColor = 0xCCCCCCFF;
            SkipButton.Text      = OOBEStrings.SkipAccount;
            SkipButton.Opacity   = 0;
            SkipButton.SizeToFit( );
            SkipButton.ClickEvent = (PlatformButton button ) =>
            {
                // do not allow multiple register taps
                if (State == OOBE_State.WaitForAccountChoice)
                {
                    OnClick(2, false);

                    EnterNextState(OOBE_State.Done);
                }
            };
            SkipButton.AddAsSubview(View.PlatformNativeObject);

            stream          = Rock.Mobile.IO.AssetConvert.AssetToStream(logoImageName);
            stream.Position = 0;
            ImageLogo       = PlatformImageView.Create( );
            ImageLogo.AddAsSubview(View.PlatformNativeObject);
            ImageLogo.Image          = stream;
            ImageLogo.ImageScaleType = PlatformImageView.ScaleType.ScaleAspectFit;
            stream.Dispose( );

            State = OOBE_State.Startup;
        }