using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SmartAquaViewer.Model;

namespace SmartAquaViewer.Controls
{
    /// <summary>
    /// SegmentedControl.xaml에 대한 상호 작용 논리
    /// </summary>
    public partial class SegmentedControl : UserControl
    {
        public SegmentedControl()
        {
            InitializeComponent();
        }

        public string SelectedValue
        {
            get { return (string)GetValue(SelectedValueProperty); }
            set { SetValue(SelectedValueProperty, value); }
        }

        public static readonly DependencyProperty SelectedValueProperty =
            DependencyProperty.Register(nameof(SelectedValue), typeof(string), typeof(SegmentedControl),
                new PropertyMetadata(null));

        public MonitorTab SelectedTab
        {
            get { return (MonitorTab)GetValue(SelectedTabProperty); }
            set { SetValue(SelectedTabProperty, value); }
        }

        public static readonly DependencyProperty SelectedTabProperty =
            DependencyProperty.Register(nameof(SelectedTab), typeof(MonitorTab), typeof(SegmentedControl),
                new PropertyMetadata(null));

        private void RadioButton_Checked(object sender, RoutedEventArgs e)
        {
            if (sender is RadioButton rb && rb.Tag != null)
            {
                SelectedTab = (MonitorTab)Enum.Parse(typeof(MonitorTab), rb.Tag.ToString());
            }
        }
    }
}
