Exemplo n.º 1
0
        private UIButton GetPositiveButton(string title, Action action)
        {
            var button = new FlatButton
            {
                Font = UIFont.SystemFontOfSize(16),
                TranslatesAutoresizingMaskIntoConstraints = false,
            };

            button.SetTitle(title, UIControlState.Normal);
            FlatButtonStyle.Default.ApplyTo(button);
            button.SetTitleColor(Theme.GetContrastBasedColor(Theme.LoginColor), UIControlState.Normal);
            button.SetStrokeColor(Theme.GetContrastBasedColor(Theme.LoginColor));
            button.Layer.CornerRadius = 5;

            var imageColor = UIColor.White.ColorWithAlpha(0.35f);

            button.SetBackgroundImage(GetImage(imageColor), UIControlState.Normal);
            button.SetBackgroundImage(GetImage(imageColor), UIControlState.Selected);
            button.SetBackgroundImage(GetImage(imageColor), UIControlState.Highlighted);

            button.TouchUpInside += (sender, e) =>
            {
                if (action != null)
                {
                    action();
                }
                ClickedEvent();
            };

            return(button);
        }
Exemplo n.º 2
0
        private UIButton GetNormalButton(string title, Action action, bool isCancellation = false)
        {
            var button = new FlatButton
            {
                Font = UIFont.SystemFontOfSize(16),
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = _dialogView.BackgroundColor,
            };

            button.SetTitle(title, UIControlState.Normal);
            FlatButtonStyle.Default.ApplyTo(button);
            button.SetTitleColor(Theme.GetContrastBasedColor(Theme.LoginColor), UIControlState.Normal);
            button.SetStrokeColor(Theme.GetContrastBasedColor(Theme.LoginColor));
            button.Layer.CornerRadius = 5;

            button.TouchUpInside += (sender, e) =>
            {
                if (action != null)
                {
                    action();
                }
                if (isCancellation)
                {
                    DismissEvent();
                }
                else
                {
                    ClickedEvent();
                }
            };

            return(button);
        }
Exemplo n.º 3
0
            public override void ApplyTo(FlatButton button)
            {
                base.ApplyTo(button);

                if (button == null)
                {
                    return;
                }

                button.SetFillColor(GetColor(x => x.ColorBackgroundNormal, Theme.CompanyColor), UIControlState.Normal);
                button.SetFillColor(GetColor(x => x.ColorBackgroundSelected, Theme.CompanyColor), UIControlState.Selected);
                button.SetFillColor(GetColor(x => x.ColorBackgroundSelected, Theme.CompanyColor), UIControlState.Highlighted);

                button.SetTitleColor(GetColor(x => x.ColorTextNormal, Theme.LabelTextColor), UIControlState.Normal);
                button.SetTitleColor(GetColor(x => x.ColorTextSelected, Theme.LabelTextColor.ColorWithAlpha(0.5f)), UIControlState.Selected);
                button.SetTitleColor(GetColor(x => x.ColorTextSelected, Theme.LabelTextColor.ColorWithAlpha(0.5f)), UIControlState.Highlighted);

                button.SetStrokeColor(GetColor(x => x.ColorBorder, Theme.LabelTextColor));
            }
Exemplo n.º 4
0
            public override void ApplyTo(FlatButton button)
            {
                base.ApplyTo(button);

                if (button == null)
                {
                    return;
                }

                button.SetFillColor(GetColor(x => x.ColorBackgroundNormal, UIColor.Clear), UIControlState.Normal);
                button.SetFillColor(GetColor(x => x.ColorBackgroundSelected, UIColor.Blue), UIControlState.Selected);
                button.SetFillColor(GetColor(x => x.ColorBackgroundSelected, UIColor.Blue), UIControlState.Highlighted);

                button.SetTitleColor(GetColor(x => x.ColorTextNormal, UIColor.Blue), UIControlState.Normal);
                button.SetTitleColor(GetColor(x => x.ColorTextSelected, UIColor.White), UIControlState.Selected);
                button.SetTitleColor(GetColor(x => x.ColorTextSelected, UIColor.White), UIControlState.Highlighted);

                button.SetStrokeColor(GetColor(x => x.ColorBorder, UIColor.Blue));
            }