using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using hukpiWinApp;

namespace OwnControls
{
    public partial class RadioFieldAllVsNothing : UserControl
    {
        public RadioFieldAllVsNothing()
        {
            InitializeComponent();
        }

        public Control OperatedControl
        {
            get;
            set;
            //set { operatedControl = value; }
        }

        public string RadioButtonAllText
        {
            get { return radioButtonAll.Text; }

            set { radioButtonAll.Text = value; }
        }

        public string RadioButtonSelectedText
        {
            get { return radioButtonSelected.Text; }

            set { radioButtonSelected.Text = value; }
        }

        public bool RadioButtonAllChecked
        {
            get { return radioButtonAll.Checked; }

            set { radioButtonAll.Checked = value; }
        }

        public bool RadioButtonSelectedChecked
        {
            get { return radioButtonSelected.Checked; }

            set { radioButtonSelected.Checked = value; }
        }


        private void radioButtonAll_CheckedChanged(object sender, EventArgs e)
        {
            if (OperatedControl == null)
            {
                return;
            }
            if (((RadioButton)sender).Checked)
            {
                OperatedControl.Enabled = false;
            }
            
        }

        private void radioButtonSelected_CheckedChanged(object sender, EventArgs e)
        {
            if (OperatedControl == null)
            {
                return;
            }
            if (((RadioButton)sender).Checked)
            {
                OperatedControl.Enabled = true;
            }
        }

    }

    
}
