private void drawButtons()
        {
            UIColor foregroundColorArray = UIColor.FromRGB(30, 30, 30);
            RoundedButtonStyle buttonStyleArray = RoundedButtonStyle.Default;

            CGRect backgroundRect = new CGRect (
                (_backgroundViewWidth / 2) - 130,
                _backgroundViewHeight - 400, //(_backgroundViewHeight / 2) + 100,
                400,
                400
            );

            backgroundViewConfirm = new HollowBackgroundView (backgroundRect);
            backgroundViewConfirm.ForegroundColor = foregroundColorArray;
            backgroundViewConfirm.Hidden = true;
            View.AddSubview (backgroundViewConfirm);

            CGRect tokenRect = new CGRect (
                0,
                0,
                100,
                100
            );

            RoundedButton confirmButton = new RoundedButton (
                tokenRect,
                RoundedButtonStyle.Default,
                "3"
            );
            confirmButton.BackgroundColor = UIColor.FromRGB(84, 164, 224);
            confirmButton.TextLabel.Text = "OK";
            confirmButton.TextLabel.Font = UIFont.FromName ("Arial", 35F);
            confirmButton.TouchUpInside += confirmClicked;

            confirmLabel = new UILabel {
                Text = "Confirm score",
                BackgroundColor = UIColor.Clear,
                TextColor = UIColor.White,
                Font = UIFont.FromName ("Arial", 30f),
                Frame = new CGRect(120, 25, 300, labelh),
            };

            backgroundViewConfirm.AddSubview (confirmButton);
            backgroundViewConfirm.AddSubview (confirmLabel);

            backgroundViewToken = new HollowBackgroundView (backgroundRect);
            backgroundViewToken.ForegroundColor = foregroundColorArray;
            backgroundViewToken.Hidden = true;
            View.AddSubview (backgroundViewToken);

            tokenRect = new CGRect (
                0,
                0,
                100,
                100
            );

            RoundedButton chipButton = new RoundedButton (
                tokenRect,
                RoundedButtonStyle.CentralImage,
                "4"
            );
            chipButton.BackgroundColor = UIColor.Clear;
            chipButton.ImageView.Image = UIImage.FromBundle ("chip.png");
            chipButton.TouchUpInside += chipClicked;

            tokenLabel = new UILabel {
                Text = "Token required!",
                BackgroundColor = UIColor.Clear,
                TextColor = UIColor.FromRGB(204, 0, 102),
                Font = UIFont.FromName ("Arial", 30f),
                Frame = new CGRect(120, 25, 300, labelh),
            };

            backgroundViewToken.AddSubview (chipButton);
            backgroundViewToken.AddSubview (tokenLabel);

            backgroundViewKeyPad = new HollowBackgroundView (backgroundRect);
            backgroundViewKeyPad.ForegroundColor = foregroundColorArray;
            View.AddSubview (backgroundViewKeyPad);

            nfloat buttonSize = 70F;
            CGRect buttonRect = new CGRect (
                0,
                0,
                buttonSize,
                buttonSize
            );

            for (var i = 0; i < 12; i++)
            {
                var style = (i == 9 ? "2" : (i == 11 ? "3" : "1"));
                var color = (i == 11 ? UIColor.FromRGB(30, 30, 30) : UIColor.FromRGB(84, 164, 224));
                RoundedButton button = new RoundedButton (
                    buttonRect,
                    buttonStyleArray,
                    style
                );
                button.TouchUpInside += buttonClicked;
                button.BackgroundColor = color;
                var label = string.Empty;
                switch (i)
                {
                case 9:
                    label = "X";
                    break;
                case 10:
                    label = "0";
                    break;
                case 11:
                    label = "↵";
                    break;
                default:
                    label = (i + 1).ToString ();
                    break;
                }
                button.TextLabel.Text = label;
                button.TextLabel.Font = UIFont.FromName ("Arial", 35F);

                backgroundViewKeyPad.AddSubview (button);

                if (i == 2 || i == 5 || i == 8) {
                    buttonRect.Y += 80;
                    buttonRect.X = 0;
                } else {
                    buttonRect.X += buttonSize + 25;
                }
            }
        }
Beispiel #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // TwilioVoice.SharedInstance.LogLevel = TVOLogLevel.Verbose; //todo: make configurable

            UIImageView imageView = new UIImageView(View.Bounds);

            imageView.ContentMode = UIViewContentMode.ScaleAspectFill;
            imageView.Image       = UIImage.FromBundle("pic");
            View.AddSubview(imageView);

            backgroundViewHeight = (float)Math.Ceiling(UIScreen.MainScreen.Bounds.Height);
            backgroundViewWidth  = UIScreen.MainScreen.Bounds.Width;

            int    i = 0;
            CGRect backgroundRect = new CGRect(
                0,
                backgroundViewHeight * i,
                backgroundViewWidth,
                backgroundViewHeight);
            HollowBackgroundView backgroundView = new HollowBackgroundView(backgroundRect);

            backgroundView.ForegroundColor = UIColor.White;
            View.AddSubview(backgroundView);


            RoundedButton but1 = SetButtonProperties2(4, 3, 1, "");

            backgroundView.AddSubview(but1);
            ButtonList.Add(but1);

            RoundedButton but2 = SetButtonProperties2(4, 2, 2, "A B C");

            backgroundView.AddSubview(but2);
            ButtonList.Add(but2);

            RoundedButton but3 = SetButtonProperties2(4, 1, 3, "D E F");

            backgroundView.AddSubview(but3);
            ButtonList.Add(but3);

            RoundedButton but4 = SetButtonProperties2(3, 3, 4, "G H I");

            backgroundView.AddSubview(but4);
            ButtonList.Add(but4);

            RoundedButton but5 = SetButtonProperties2(3, 2, 5, "J K L");

            backgroundView.AddSubview(but5);
            ButtonList.Add(but5);

            RoundedButton but6 = SetButtonProperties2(3, 1, 6, "M N O");

            backgroundView.AddSubview(but6);
            ButtonList.Add(but6);

            RoundedButton but7 = SetButtonProperties2(2, 3, 7, "P Q R S");

            backgroundView.AddSubview(but7);
            ButtonList.Add(but7);

            RoundedButton but8 = SetButtonProperties2(2, 2, 8, "T U V");

            backgroundView.AddSubview(but8);
            ButtonList.Add(but8);

            RoundedButton but9 = SetButtonProperties2(2, 1, 9, "W X Y Z");

            backgroundView.AddSubview(but9);
            ButtonList.Add(but9);

            RoundedButton but10 = SetButtonProperties2(1, 3, 0, "*");

            backgroundView.AddSubview(but10);
            ButtonList.Add(but10);

            RoundedButton but11 = SetButtonProperties2(1, 2, 0, "+");

            backgroundView.AddSubview(but11);
            ButtonList.Add(but11);

            RoundedButton but12 = SetButtonProperties2(1, 1, 0, "#");

            backgroundView.AddSubview(but12);
            ButtonList.Add(but12);
        }