Example #1
0
        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);
        }
Example #2
0
        public void LoadDocument()
        {
            _updateLevel++;

            dgQueries.Rows.Clear();

            foreach (var query in Document.Queries)
            {
                var row = new DataGridViewQueryRow(dgQueries, query);
                dgQueries.Rows.Add(row);
            }

            _updateLevel--;
        }