using System;
using System.Windows.Forms;

namespace HwComWrapperNETGui.UserControls
{
    public partial class MsgCat81 : UserControl
    {
        #region Constructors and Destructors

        public MsgCat81()
        {
            this.InitializeComponent();

            this.button01.Click += (sender, args) => this.HandleButtonClick(this.ButtonStreamStartClicked);
            this.button02.Click += (sender, args) => this.HandleButtonClick(this.ButtonStreamStopClicked);
            this.button03.Click += (sender, args) => this.HandleButtonClick(this.ButtonStreamReceiveClicked);
        }

        #endregion

        #region Public Events

        /// <summary>
        ///     Occurs when the get button for COM_Stream_[FR/CAN] was clicked. 
        /// </summary>
        public event EventHandler ButtonStreamReceiveClicked;

        /// <summary>
        ///     Occurs when the get button for COM_StreamStartReq was clicked. 
        /// </summary>
        public event EventHandler ButtonStreamStartClicked;

        /// <summary>
        ///     Occurs when the get button for COM_StreamStopReq was clicked. 
        /// </summary>
        public event EventHandler ButtonStreamStopClicked;

        #endregion

        #region Methods

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

        #endregion
    }
}