using System.Reflection.Metadata.Ecma335;

namespace HistoryView.Controls;

public partial class StatusPlot : UserControl
{
    public StatusPlot()
    {
        InitializeComponent();
    }

    public UserInformation User
    {
        get { return (UserInformation)GetValue(UserProperty); }
        set { SetValue(UserProperty, value); }
    }

    // Using a DependencyProperty as the backing store for User.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty UserProperty =
        DependencyProperty.Register("User", typeof(UserInformation), typeof(StatusPlot), new PropertyMetadata(default));

    public Mini8Info DataSource
    {
        get { return (Mini8Info)GetValue(DataSourceProperty); }
        set { SetValue(DataSourceProperty, value); }
    }

    public static readonly DependencyProperty DataSourceProperty =
        DependencyProperty.Register("DataSource", typeof(Mini8Info), typeof(StatusPlot), new PropertyMetadata(default));


    public IEnumerable<Channel> Channels
    {
        get { return (IEnumerable<Channel>)GetValue(ChannelsProperty); }
        set { SetValue(ChannelsProperty, value); }
    }

    public static readonly DependencyProperty ChannelsProperty =
        DependencyProperty.Register("Channels", typeof(IEnumerable<Channel>), typeof(StatusPlot), new PropertyMetadata(default));


    public ICommand EditChannel
    {
        get { return (ICommand)GetValue(EditChannelProperty); }
        set { SetValue(EditChannelProperty, value); }
    }

    public static readonly DependencyProperty EditChannelProperty =
        DependencyProperty.Register("EditChannel", typeof(ICommand), typeof(StatusPlot), new PropertyMetadata(default));



    public ICommand Reconnect
    {
        get { return (ICommand)GetValue(ReconnectProperty); }
        set { SetValue(ReconnectProperty, value); }
    }

    public static readonly DependencyProperty ReconnectProperty =
        DependencyProperty.Register("Reconnect", typeof(ICommand), typeof(StatusPlot), new PropertyMetadata(default));

    public ICommand MultiSelectCommand
    {
        get { return (ICommand)GetValue(MultiSelectCommandProperty); }
        set { SetValue(MultiSelectCommandProperty, value); }
    }

    // Using a DependencyProperty as the backing store for MultiSelectCommand.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty MultiSelectCommandProperty =
        DependencyProperty.Register("MultiSelectCommand", typeof(ICommand), typeof(StatusPlot), new PropertyMetadata(default));



    public ICommand TraceLogCommand
    {
        get { return (ICommand)GetValue(TraceLogCommandProperty); }
        set { SetValue(TraceLogCommandProperty, value); }
    }

    // Using a DependencyProperty as the backing store for TraceLogCommand.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty TraceLogCommandProperty =
        DependencyProperty.Register("TraceLogCommand", typeof(ICommand), typeof(StatusPlot), new PropertyMetadata(default));



    public ICommand MultiTraceCommand
    {
        get { return (ICommand)GetValue(MultiTraceCommandProperty); }
        set { SetValue(MultiTraceCommandProperty, value); }
    }

    // Using a DependencyProperty as the backing store for MultiTraceCommand.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty MultiTraceCommandProperty =
        DependencyProperty.Register("MultiTraceCommand", typeof(ICommand), typeof(StatusPlot), new PropertyMetadata(default));



    public object ReconnectParameter
    {
        get { return (object)GetValue(ReconnectParameterProperty); }
        set { SetValue(ReconnectParameterProperty, value); }
    }

    public static readonly DependencyProperty ReconnectParameterProperty =
        DependencyProperty.Register("ReconnectParameter", typeof(object), typeof(StatusPlot), new PropertyMetadata(default));


    public object EditParameter
    {
        get { return (object)GetValue(EditParameterProperty); }
        set { SetValue(EditParameterProperty, value); }
    }

    public static readonly DependencyProperty EditParameterProperty =
        DependencyProperty.Register("EditParameter", typeof(object), typeof(StatusPlot), new PropertyMetadata(default));

    public int Rows
    {
        get { return (int)GetValue(RowsProperty); }
        set { SetValue(RowsProperty, value); }
    }

    public static readonly DependencyProperty RowsProperty =
        DependencyProperty.Register("Rows", typeof(int), typeof(StatusPlot), new PropertyMetadata(1));

    private void FunctionButton_Click(object sender, RoutedEventArgs e)
    {
        this.FunctionPop.IsOpen = !this.FunctionPop.IsOpen;
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        this.FunctionPop.IsOpen = false;
    }

    private void Button_Click_1(object sender, RoutedEventArgs e)
    {
        DataSource.Enable = true;
    }

    private void Button_Click_2(object sender, RoutedEventArgs e)
    {
        DataSource.Enable = false;
    }
}
