protected override void LoadDocument(string filename) { var xmlDocument = new XmlDocument(); xmlDocument.Load(filename); _queries = new QueryCollection(this); foreach (XmlNode node in xmlDocument.SelectNodes(@"xinq/queries/query")) { var query = new Query(this, node); _queries.Add(query); } }
private void tsAddQuery_Click(object sender, EventArgs e) { if (!_editorPane.CanEdit()) return; var newQuery = new Query(Document); var nameSuffix = 1; while (true) { var name = string.Format("MyQuery{0}", nameSuffix++); if (Document.Queries[name] == null) { newQuery.Name = name; break; } } Document.Queries.Add(newQuery); var newRow = new DataGridViewQueryRow(dgQueries, newQuery); dgQueries.Rows.Add(newRow); newRow.Selected = true; dgQueries.CurrentCell = newRow.Cells[0]; dgQueries.BeginEdit(true); }
public DataGridViewQueryRow(DataGridView dataGridView, Query query) { CreateCells(dataGridView, query.Name, query.Comment); _query = query; }