public ProfileSelectionScreen(StorageDevice device)
            : base("Choose your active profile:")
        {
            IsPopup = true;
            mDevice = device;

            this.Buttons.Clear();

            var temp = Profile.LoadAll(mDevice);
            mDefault = mSelectedButton = temp.Key;

            if (temp.Key < 0)
            {
                mSelectedButton = 0;
            }

            mProfiles = temp.Value;

            for(int i = 0; i < mProfiles.Length; i++)
            {
                Button btn = new Button(mProfiles[i] != null ? mProfiles[i].Name : "-Empty-");
                btn.Pressed += ProfileSelectedButton;

                Buttons.Add(btn);
            }
        }
Example #2
0
        /// <summary>
        /// Constructs a new menu entry with the specified text.
        /// </summary>
        public ButtonGroup(string text, string[] choices)
        {
            ChangesValue = true;

            this.text = text;
            mainLabel = new MenuEntry(text);

            buttons = new Button[choices.Length];
            for(int i = 0; i < choices.Length; i++)
                buttons[i] = new Button(choices[i]);

            mPaddingY = 5;
        }
        /// <summary>
        /// Constructor lets the caller specify what prompts they
        /// want and which is selected by default.
        /// </summary>
        public MessageBoxScreen(string message, string[] prompts, int defaultSelection)
        {
            this.mMessage = message;
            IsPopup = true;
            mSelectedButton = defaultSelection;

            foreach (string str in prompts)
            {
                Button btn = new Button(str);
                btn.Pressed += Exit;
                Buttons.Add(btn);
            }

            TransitionOnTime = TimeSpan.FromSeconds(0.2);
            TransitionOffTime = TimeSpan.FromSeconds(0.2);
        }
        private void Resize(Button newButton)
        {
            int width = (MenuEntries[0] as ButtonGroup).ButtonWidth;

            if (width < newButton.Size.X)
            {
                foreach (UIElement btnGrp in MenuEntries)
                    if (btnGrp is ButtonGroup)
                        (btnGrp as ButtonGroup).ButtonWidth = (int)newButton.Size.X;
            }
            else
                newButton.Widen(width - newButton.Size.X);
        }