using System;
using System.Windows.Forms;

namespace HwComWrapperNETGui.UserControls
{
    /// <summary>
    /// UI for msssage category 0x85
    /// </summary>
    public partial class MsgCat85 : UserControl
    {
        #region construction

        public MsgCat85()
        {
            this.InitializeComponent();
        }

        #endregion

        #region public events

        /// <summary>
        /// Occurs when button get logging version clicked.
        /// </summary>
        public event EventHandler ButtonGetLoggingVersionClicked;
        /// <summary>
        /// Occurs when button start all logger clicked.
        /// </summary>
        public event EventHandler ButtonStartAllLoggerClicked;
        /// <summary>
        /// Occurs when button stop all logger clicked.
        /// </summary>
        public event EventHandler ButtonStopAllLoggerClicked;
        /// <summary>
        /// Occurs when button get logging activen clicked.
        /// </summary>
        public event EventHandler ButtonGetLoggingActivenClicked;

        #endregion

        #region private methods

        private void BtnGetVersionClick(object sender, EventArgs e)
        {
            this.HandleButtonClick(this.ButtonGetLoggingVersionClicked);
        }

        private void BtnStartAllClick(object sender, EventArgs e)
        {
            this.HandleButtonClick(this.ButtonStartAllLoggerClicked);
        }

        private void BtnStopAllClick(object sender, EventArgs e)
        {
            this.HandleButtonClick(this.ButtonStopAllLoggerClicked);
        }

        private void BtnGetLoggerActiveClick(object sender, EventArgs e)
        {
            this.HandleButtonClick(this.ButtonGetLoggingActivenClicked);
        }

        private void HandleButtonClick(EventHandler handler)
        {
            if (handler != null)
            {
                handler(this, EventArgs.Empty);
            }
        }

        #endregion
    }
}
