//========================================================= // Models //========================================================= private void buttonModels_Click(object sender, EventArgs e) { InitRequestResponse(); this.Update(); Project proj = (Project)comboBoxProjects.SelectedItem; string project_id = proj.project_id; m_model_list = Glue.ModelList(m_authToken, project_id); // Show the request and response in the form. // This is for learning purpose. ShowRequestResponse(); if (m_model_list == null) { return; } // Set up a model list m_model_list = m_model_list.OrderBy(x => x.model_name).ToList(); comboBoxModels.DataSource = new BindingSource(m_model_list, null); comboBoxModels.DisplayMember = "model_name"; comboBoxModels.ValueMember = "model_id"; comboBoxModels.SelectedIndex = 0; }
private void buttonModels_Click(object sender, EventArgs e) { textBoxRequest.Text = "Request comes here"; textBoxResponse.Text = "Response comes here"; List <ModelInfo> model_list = glueCall.ModelList(m_authToken, m_project_id); // Show the request and response in the form. // This is for learning purpose. IRestResponse response = glueCall.m_lastResponse; textBoxRequest.Text = response.ResponseUri.AbsoluteUri; textBoxResponse.Text = response.Content; // We want to get hold of one model. // For simplicity, just pick up arbitrary one. m_model_index %= model_list.Count; ModelInfo model = model_list[m_model_index++]; m_model_id = model.model_id; string model_name = model.model_name; labelCurModel.Text = model_name + " (" + m_model_index.ToString() + "/" + model_list.Count.ToString() + ")"; }