コード例 #1
0
ファイル: RadioButtonManager.cs プロジェクト: jakesays/Glide
        // Adds a radio button to it's group.
        internal static void AddButton(RadioButton radioButton)
        {
            string name = radioButton.GroupName;

            if (!_groups.Contains(name))
                _groups.Add(name, new ArrayList());

            radioButton.TapEvent += new OnTap(OnTapEvent);

            ((ArrayList)_groups[name]).Add(radioButton);
        }
コード例 #2
0
ファイル: GlideLoader.cs プロジェクト: jakesays/Glide
        /// <summary>
        /// Parses the RadioButton XML into a UI component.
        /// </summary>
        /// <param name="reader">XML reader object.</param>
        /// <returns>RadioButton object.</returns>
        private static RadioButton LoadRadioButton(XmlReader reader)
        {
            string name = reader.GetAttribute("Name");
            int x = Convert.ToInt32(reader.GetAttribute("X"));
            int y = Convert.ToInt32(reader.GetAttribute("Y"));
            int width = Convert.ToInt32(reader.GetAttribute("Width"));
            int height = Convert.ToInt32(reader.GetAttribute("Height"));
            ushort alpha = Convert.ToUInt16(reader.GetAttribute("Alpha"));

            string value = reader.GetAttribute("Value");
            bool _checked = (reader.GetAttribute("Checked") == bool.TrueString) ? true : false;
            string groupName = reader.GetAttribute("GroupName");
            bool showBackground = (reader.GetAttribute("ShowBackground") == bool.TrueString) ? true : false;
            Color color = GlideUtils.Convert.ToColor(reader.GetAttribute("Color"));
            Color outlineColor = GlideUtils.Convert.ToColor(reader.GetAttribute("OutlineColor"));
            Color selectedColor = GlideUtils.Convert.ToColor(reader.GetAttribute("SelectedColor"));
            Color selectedOutlineColor = GlideUtils.Convert.ToColor(reader.GetAttribute("SelectedOutlineColor"));

            RadioButton radioButton = new RadioButton(name, alpha, x, y, width, height);
            radioButton.Value = value;
            radioButton.Checked = _checked;
            radioButton.GroupName = groupName;
            radioButton.ShowBackground = showBackground;
            radioButton.Color = color;
            radioButton.OutlineColor = outlineColor;
            radioButton.SelectedColor = selectedColor;
            radioButton.SelectedOutlineColor = selectedOutlineColor;

            RadioButtonManager.AddButton(radioButton);

            return radioButton;
        }