Exemplo n.º 1
0
        public MainForm()
        {
            InitializeComponent();
            InitializeSerialPorts();

            //Default values
            tabs.Enabled = false;
            cmbSecurity.SelectedIndex = 2; //WPA/WPA2 by default

            dgEvents.RowHeadersWidth = 10;
            dgEvents.Columns.Add("wind", "WIND");
            dgEvents.Columns.Add("message", "Message");
            dgEvents.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            //ToolTips and hints
            new ToolTip().SetToolTip(txtFirmware, "Enter URL to firmware image.");
            new ToolTip().SetToolTip(txtFileSystem, "Enter URL to file system image.");
            new ToolTip().SetToolTip(txtPingHost, "Enter host or IP address to ping.");

            //Handle thread exceptions
            Application.ThreadException += (sender, e) =>
            {
                MessageBox.Show(e.Exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            };

            //Redirect standard console output to a textbox
            writer = new TextBoxWriter(txtLog);
            Console.SetOut(writer);

            //Initialize SPWF01Sx object
            wifi = new SPWF01Sx();
            wifi.Debug = true;
            wifi.AsyncResponse += new EventHandler<AsyncResponseEventArgs>(wifi_AsyncResponse);
        }