using System.Windows.Forms;
using Ebel.Hardware.Communications;

namespace HwComWrapperNETGui
{
    public partial class WifiDialog : Form
    {
        public WifiDialog()
        {
            InitializeComponent();
        }

        public WifiConfig GetWifiConfig()
        {
            return this.wifiConfigControl.GetWifiConfig();
        }

        private void WifiDialog_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.DialogResult != DialogResult.Cancel)
            {
                // on Ok, there must be a valid WifiConfig
                var wifiConfig = this.wifiConfigControl.GetWifiConfig();
                e.Cancel = wifiConfig == null;
            }
        }
    }
}
