private void linkLabelRead_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { HydrometHost svr = HydrometInfoUtility.HydrometServerFromPreferences(); int yr; if (!int.TryParse(textBoxWaterYear.Text, out yr)) { MessageBox.Show("Error parsing water year '" + textBoxWaterYear.Text + "'"); return; } if (comboBoxSiteList.SelectedIndex < 0) { return; } DateTime t1 = new DateTime(yr - 1, 10, 1); DateTime t2 = new DateTime(yr, 9, 30); int idx = this.comboBoxSiteList.SelectedIndex; string siteId = comboBoxSiteList.SelectedValue.ToString(); string query = siteId + " " + siteListTable.Rows[idx]["parameters"].ToString(); hydrometDataTable = HydrometDataUtility.ArchiveTable(svr, query, t1, t2); hydrometDataTable.AcceptChanges(); bool ctrl = (Control.ModifierKeys & Keys.Control) != 0; timeSeriesSpreadsheet1.Clear(); timeSeriesSpreadsheet1.SetDataTable(hydrometDataTable, Reclamation.TimeSeries.TimeInterval.Daily, ctrl); ReadSeries(); hydrometDataTable.RowChanged += hydrometDataTable_RowChanged; }
private void RefreshClick(object sender, System.EventArgs e) { if (this.comboBoxInputs.Text.IndexOf(":") == 0) { return; } UserPreference.Save("Inputs" + m_db.ToString(), this.comboBoxInputs.Text); this.dragPoint1.Active = false; Cursor = Cursors.WaitCursor; timeSeriesSpreadsheet1.Clear(); Application.DoEvents(); try { dataTable = this.GetTimeSeries(); dataTable.AcceptChanges(); dataTable.RowChanged += new DataRowChangeEventHandler(dataTable_RowChanged); Logger.WriteLine(UserPreference.Lookup("HydrometServer"), "ui"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Logger.WriteLine("error reading data from " + UserPreference.Lookup("HydrometServer") + " " + ex.ToString(), "ui"); Logger.WriteLine(ex.ToString()); } finally { Cursor = Cursors.Default; } if (dataTable == null) { return; } Logger.WriteLine(dataTable.Rows.Count + " rows of data read", "ui"); if (dataTable.Rows.Count > 0) { dataTable.WriteXml(originalDataXmlFilename, XmlWriteMode.WriteSchema); } Graph(); SetupUsgsLink(); timeSeriesSpreadsheet1.SetDataTable(dataTable, m_db, true); timeSeriesSpreadsheet1.AutoFlagDayFiles = UserPreference.Lookup("AutoFlagDayFiles") == "True"; //this.comboBoxEditSeries.Items.Clear(); //this.comboBoxEditSeries.Items.Add("None"); //for(int i=0; i<tChart1.Series.Count; i++) //{ // string columnName = tChart1.Series[i].Title; // this.comboBoxEditSeries.Items.Add(columnName); //} //this.comboBoxEditSeries.SelectedIndex =0; }