private void InitControls() { view.CellClick += GridCellClick; (controls["refresh"] as Button).Click += (object sender, EventArgs e) => { if (serial.IsOpen()) { serial.WriteData(settings.GetPollCommand()); } }; (controls["save"] as Button).Click += (object sender, EventArgs e) => { if (serial.IsOpen()) { serial.WriteData(settings.GetSaveCommand()); } }; }