private void loadIngredientsOnFormLoad(object sender, EventArgs e) { APIHandler handler = new APIHandler(); string jsonurl = ""; switch (versionName) { case "Hops": jsonurl = dataurl + "/hop"; hopList = handler.getHops(); break; case "Malts": jsonurl = dataurl + "/fermentables"; fermentableList = handler.getFermentables(); break; case "Yeasts": jsonurl = dataurl + "/yeast"; yeastList = handler.getYeasts(); break; case "Adjuncts": jsonurl = dataurl + "/adjunct"; adjunctList = handler.getAdjuncts(); break; case "Style": styleList = handler.getStyles(); break; } populateGrid(); }
private void refreshHopGrid() { hopGrid.Rows.Clear(); hopGrid.Columns.Clear(); APIHandler data = new APIHandler(); List <hop2> hopList = data.getHops(); DataGridViewCell cell = new DataGridViewTextBoxCell(); DataGridViewTextBoxColumn colHopName = new DataGridViewTextBoxColumn() { CellTemplate = cell, Name = "name", HeaderText = "Name", DataPropertyName = "name" }; DataGridViewTextBoxColumn colHopAAU = new DataGridViewTextBoxColumn() { CellTemplate = cell, Name = "aau", HeaderText = "AAU", DataPropertyName = "aau", Width = 50 }; DataGridViewTextBoxColumn colHopID = new DataGridViewTextBoxColumn() { CellTemplate = cell, Name = "id", HeaderText = "ID", DataPropertyName = "id", Visible = false }; hopGrid.Columns.Add(colHopName); hopGrid.Columns.Add(colHopAAU); hopGrid.Columns.Add(colHopID); var bindingList = new BindingList <hop2>(hopList); hopGrid.DataSource = bindingList; }