Esempio n. 1
0
        private void AddQueryButton_Click(object sender, EventArgs e)
        {
            using (QueryNameInputWindow queryDialog = new QueryNameInputWindow())
            {
                queryDialog.ShowDialog();
                if (queryDialog.IsDisposed || String.IsNullOrEmpty(queryDialog.queryName) || this.queryModel.FindQueryByTitle(queryDialog.queryName) != null)
                {
                    return;
                }

                this.queryModel.Queries.Add(new Tuple <string, string, int>(queryDialog.queryName, "", 1));
                this.QuerySelectionList.Items.Add(queryDialog.queryName);
                this.QuerySelectionList.SelectedItem = queryDialog.queryName;
            }
        }
Esempio n. 2
0
 private void RenameQueryButton_Click(object sender, EventArgs e)
 {
     using (QueryNameInputWindow queryDialog = new QueryNameInputWindow())
     {
         queryDialog.ShowDialog();
         if (queryDialog.IsDisposed || String.IsNullOrEmpty(queryDialog.queryName))
         {
             return;
         }
         else
         {
             var query = this.queryModel.FindQueryByTitle(this.QuerySelectionList.SelectedItem.ToString());
             this.queryModel.EditQueryByTitle(this.QuerySelectionList.SelectedItem.ToString(), queryDialog.queryName, query.Item2, query.Item3);
             int index = this.QuerySelectionList.Items.IndexOf(this.QuerySelectionList.SelectedItem);
             this.QuerySelectionList.Items.Insert(index, queryDialog.queryName);
             this.QuerySelectionList.SelectedItem = queryDialog.queryName;
             this.QuerySelectionList.Items.RemoveAt(index + 1);
         }
     }
 }