private DataGridViewComboBoxColumn GetGatewayComboBox(int conn_id) { DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn() { //CellTemplate = cell, Name = "IPGateway", HeaderText = "Шлюзы", DataPropertyName = "IPGateway", // Tell the column which property it should use DisplayMember = "IPGateway", ValueMember = "IPGateway", //Width = 120, AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill, }; WMIMethods methods = new WMIMethods(); List <Gateway> gtwlist = methods.GetGatewayArray(conn_id); if (gtwlist.Count > 0) { var bindsList = new BindingList <Gateway>(gtwlist); var source = new BindingSource(bindsList, null); cmb.DataSource = source; } return(cmb); }
protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); DbMethods DB = new DbMethods(); WMIMethods methods = new WMIMethods(); List <Connection> Connection_list = methods.GetNetworkDevices(); List <DNS> DNS_list = methods.GetDNSArray(Connection_list[0].Id); List <Gateway> Gateway_list = methods.GetGatewayArray(Connection_list[0].Id); if (Connection_list.Count > 0) { DB.SaveConnectionTable(Connection_list, DNS_list, Gateway_list); } //DB.ReadConnectionHistory(ref Connection_list); if (e.CloseReason == CloseReason.WindowsShutDown) { return; } }