protected void Page_Load(object sender, EventArgs e) { try { config = Application["Configuration"] as Configuration; string px = null, py = null; if (!IsPostBack) { Timeline tl = new Timeline(Server.MapPath("~"), config.datadir, config.timeline); string penultimate = tl.Lookup(tl.RowCount - 2, "ID").ToString(); string latest = tl.Lookup(tl.RowCount - 1, "ID").ToString(); lstTagX.Items.Add(new ListItem("Latest (" + latest + ")", latest)); lstTagX.Items.Add(new ListItem("Penultimate (" + penultimate + ")", penultimate)); //lstTagX.Items.Add(new ListItem("Records (best ever)", "RECORDS")); lstTagY.Items.Add(new ListItem("Latest (" + latest + ")", latest)); lstTagY.Items.Add(new ListItem("Penultimate (" + penultimate + ")", penultimate)); foreach (KeyValuePair <string, uint> kvp in config.tags) { lstTagX.Items.Add(new ListItem(kvp.Key + " (" + kvp.Value.ToString() + ")", kvp.Value.ToString())); lstTagY.Items.Add(new ListItem(kvp.Key + " (" + kvp.Value.ToString() + ")", kvp.Value.ToString())); } px = Request.Params.Get("jobX"); py = Request.Params.Get("jobY"); Prefix = Request.Params.Get("prefix"); if (px == null) { rbnTagX.Checked = true; } else { txtIDX.Text = px; rbnIDX.Checked = true; } if (py == null) { rbnTagY.Checked = true; } else { txtIDY.Text = py; rbnIDY.Checked = true; } if (px != null) { if (config.tags.HasID(px)) { rbnTagX.Checked = true; lstTagX.SelectedValue = px; } else { lstTagX.SelectedValue = penultimate; } } else { lstTagX.SelectedValue = penultimate; } if (py != null) { if (config.tags.HasID(py)) { rbnTagY.Checked = true; lstTagY.Items.FindByText(py.ToString()); lstTagY.SelectedValue = py.ToString(); } else { lstTagY.SelectedValue = latest; } } else { lstTagY.SelectedValue = latest; } } JX = px != null ? px : rbnTagX.Checked ? lstTagX.SelectedValue : txtIDX.Text; JY = py != null ? py : rbnTagY.Checked ? lstTagY.SelectedValue : txtIDY.Text; Job jX = null, jY = null; try { jX = new Job(config.datadir, (uint)Convert.ToInt32(JX), true); jY = new Job(config.datadir, (uint)Convert.ToInt32(JY), true); } catch (Exception) { } txtIDX.Text = JX; txtIDY.Text = JY; cmp = new Comparison(jX, jY, Prefix.Replace('|', '\\'), config.tags); phPre.Controls.Add(buildHeader("CHART_PRE", "")); phChart.Controls.Add(buildChart()); phHisto.Controls.Add(buildHistogramm()); phMain.Controls.Add(buildTabPanels()); //phMain.Controls.Add(buildFooter()); } catch (Exception ex) { Label l = new Label(); l.Text = "Error loading dataset: " + ex.Message; phMain.Controls.Add(l); l = new Label(); l.Text = "Stacktrace: " + ex.StackTrace; phMain.Controls.Add(l); } }
protected void BuildEntries() { uint last_job_id = timeline.LastJobId; uint last_tag_id = 0; string last_tag_name = ""; foreach (KeyValuePair <string, uint> kvp in config.tags) { if (kvp.Value > last_tag_id) { last_tag_name = kvp.Key; last_tag_id = kvp.Value; } } TableRow tr; TableCell tc; HyperLink h; for (int i = 0; i < timeline.RowCount; i++) { tr = new TableRow(); if (i % 2 == 0) { tr.BackColor = Color.LightGreen; } else { tr.BackColor = Color.LightGray; } string id = timeline.Lookup(i, "ID"); uint idi = Convert.ToUInt32(id); Job j = timeline.Job(idi); tc = new TableCell(); h = new HyperLink(); h.Text = id; h.NavigateUrl = "Default.aspx?job=" + id; tc.Controls.Add(h); tr.Cells.Add(tc); tc = new TableCell(); tc.Text = j.MetaData.SubmissionTime.ToString(); tc.HorizontalAlign = HorizontalAlign.Right; if (j.MetaData.isFinished) { tc.ForeColor = Color.Black; } else { tc.ForeColor = Color.Gray; } tr.Cells.Add(tc); tc = new TableCell(); h = new HyperLink(); h.NavigateUrl = "Compare.aspx?jobX=" + last_tag_id + "&jobY=" + id; h.Text = last_tag_name; tc.Controls.Add(h); tc.HorizontalAlign = HorizontalAlign.Center; tr.Cells.Add(tc); tc = new TableCell(); h = new HyperLink(); h.NavigateUrl = "Compare.aspx?jobX=" + last_job_id + "&jobY=" + id; h.Text = "latest"; tc.Controls.Add(h); tr.Cells.Add(tc); tblEntries.Rows.Add(tr); } }