protected void ButtonModel_Click(object sender, EventArgs e) { string authToken = HttpContext.Current.Session["authToken"] as string; string project_id = HttpContext.Current.Session["projectId"] as string; List <ModelInfo> model_list = Glue.ModelList(authToken, project_id); // Show the request and response in the form. // This is for learning purpose. IRestResponse response = Glue.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. int model_index = Convert.ToInt32(HttpContext.Current.Session["modelIndex"]); model_index %= model_list.Count; ModelInfo model = model_list[model_index++]; string model_id = model.model_id; string model_name = model.model_name; Session["modelIndex"] = model_index; Session["modelId"] = model_id; TextBoxModelName.Text = model_name + " (" + model_index.ToString() + "/" + model_list.Count.ToString() + ")"; // No model in a viewer, yet. iframeGlue.Src = ""; }
//========================================================= // Models //========================================================= protected void ButtonModel_Click(object sender, EventArgs e) { string authToken = Session["authToken"] as string; string project_id = DropDownListProjects.SelectedValue; List <ModelInfo> model_list = Glue.ModelList(authToken, project_id); ShowRequestResponse(); if (model_list == null) { return; } // Set up a model list model_list = model_list.OrderBy(x => x.model_name).ToList(); DropDownListModels.DataSource = model_list; DropDownListModels.DataTextField = "model_name"; DropDownListModels.DataValueField = "model_id"; DropDownListModels.DataBind(); DropDownListModels.SelectedIndex = 0; }