using System;
using System.Windows.Forms;

namespace HwComWrapperNETGui.UserControls
{
    public partial class MsgCat04 : UserControl
    {
        #region construction

        /// <summary>
        /// Initializes a new instance of the <see cref="MsgCat04"/> class.
        /// </summary>
        public MsgCat04()
        {
            this.InitializeComponent();
            this.button01.Click += (sender, args) => this.HandleButtonClick(this.ButtonCpuRunClicked);
            this.button02.Click += (sender, args) => this.HandleButtonClick(this.ButtonCpuStopClicked);
            this.button03.Click += (sender, args) => this.HandleButtonClick(this.ButtonCpuResetClicked);
        }

        #endregion

        #region Public Events

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

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

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

        #endregion

        #region Methods

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

        #endregion
    }
}
