Ejemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NameLabel.Text = _WeaponItem.Name.Capitalize();

            SpecialButton.SetText(_WeaponItem.SpecialAbilities);
            SpecialButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            _SpecialPopover                  = new ButtonStringPopover(SpecialButton);
            _SpecialPopover.ItemClicked     += HandleSpecialItemClicked;
            _SpecialPopover.WillShowPopover += HandleWillShowBonusPopover;

            BonusButton.SetText(BonusText);
            BonusButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            _BonusPopover = new ButtonStringPopover(BonusButton);
            _BonusPopover.WillShowPopover += HandleWillShowBonus;
            _BonusPopover.ItemClicked     += HandleBonusItemClicked;

            DeleteButton.Gradient = new GradientHelper(0x00000000.UIColor());
            DeleteButton.Border   = 0;
            DeleteButton.SetImage(UIImage.FromFile("Images/External/redx.png"), UIControlState.Normal);
            DeleteButton.TouchUpInside += DeleteButtonClicked;

            ((GradientView)View).StyleBasicPanel();

            NameView.BackgroundColor = 0x0.UIColor();
            NameView.Gradient        = new GradientHelper(CMUIColors.SecondaryColorBDarker);

            HandView.BackgroundColor = 0x0.UIColor();
            HandView.Gradient        = new GradientHelper(CMUIColors.SecondaryColorADarker);

            HandLabel.Text = _WeaponItem.Weapon.HandsUsed + " Hand" + (_WeaponItem.Weapon.HandsUsed != 1?"s":"");

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


            BackgroundView.StyleBasicPanel();

            TitleButton.SetText(ItemText);

            DeleteButton.SetImage(UIImage.FromFile("Images/External/redx.png"), UIControlState.Normal);

            TitleButton.TouchUpInside  += HandleTitleButtonClicked;
            DeleteButton.TouchUpInside += HandleDeleteButtonClicked;

            TitleButton.SetTitleColor(0xFFFFFFFF.UIColor(), UIControlState.Normal);
            TitleButton.AlignButtonLeft();
            DeleteButton.SetTitleColor(0xFFFFFFFF.UIColor(), UIControlState.Normal);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a <see cref="MenuView"/>
        /// </summary>
        public MenuView()
        {
            CloseButton  = CreateButton("CloseButton");
            DoneButton   = CreateButton("DoneButton");
            ExtraButton  = CreateButton("ExtraButton");
            DeleteButton = CreateButton("DeleteButton");

            MenuTitle = new UILabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                ContentMode            = UIViewContentMode.Left,
                TextAlignment          = UITextAlignment.Center,
                UserInteractionEnabled = false,
                Opaque                    = false,
                BaselineAdjustment        = UIBaselineAdjustment.AlignBaselines,
                AdjustsFontSizeToFitWidth = false,
                LineBreakMode             = UILineBreakMode.TailTruncation,
                Text               = Configuration.CameraRollTitle,
                TextColor          = UIColor.White,
                AccessibilityLabel = "MenuTitle"
            };

            Add(CloseButton);
            Add(DoneButton);
            Add(ExtraButton);
            Add(MenuTitle);
            Add(DeleteButton);

            var checkImage  = Configuration.CheckImage ?? UIImage.FromBundle("ic_check");
            var closeImage  = Configuration.CloseImage ?? UIImage.FromBundle("ic_close");
            var extraImage  = Configuration.ExtraImage ?? UIImage.FromBundle("ic_add");
            var deleteImage = Configuration.DeleteImage ?? UIImage.FromBundle("ic_delete");

            if (Configuration.TintIcons)
            {
                checkImage =
                    checkImage?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                closeImage =
                    closeImage?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                extraImage =
                    extraImage?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                deleteImage =
                    deleteImage?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                DoneButton.TintColor   = Configuration.TintColor;
                CloseButton.TintColor  = Configuration.TintColor;
                ExtraButton.TintColor  = Configuration.TintColor;
                DeleteButton.TintColor = Configuration.DeleteTintColor;
            }

            CloseButton.SetImage(closeImage, UIControlState.Normal);
            CloseButton.SetImage(closeImage, UIControlState.Highlighted);
            CloseButton.SetImage(closeImage, UIControlState.Selected);

            DoneButton.SetImage(checkImage, UIControlState.Normal);

            ExtraButton.SetImage(extraImage, UIControlState.Normal);

            DeleteButton.SetImage(deleteImage, UIControlState.Normal);

            MenuTitle.TextColor = Configuration.BaseTintColor;

            CloseButton.TouchUpInside  += OnClose;
            DoneButton.TouchUpInside   += OnDone;
            ExtraButton.TouchUpInside  += OnExtra;
            DeleteButton.TouchUpInside += OnDelete;

            CloseButtonHidden  = false;
            DoneButtonHidden   = false;
            ExtraButtonHidden  = true;
            DeleteButtonHidden = true;
        }