private EditingDatabase GetEditingDatabase(Entity entity)
        {
            Connection      c  = (Connection)entity.Root;
            EditingDatabase ed = (EditingDatabase)editingDatabases[c];

            if (ed == null)
            {
                ed = new EditingDatabase(c);
                editingDatabases.Add(c, ed);
            }
            return(ed);
        }
        private void EditPassageQuestion(PassageQuestion question)
        {
            Connection      c  = question.connection;
            EditingDatabase ed = (EditingDatabase)editingDatabases[c];

            if (ed == null)
            {
                ed = new EditingDatabase(c);
                editingDatabases.Add(c, ed);
            }

            ed.EditPassageQuestion(question);
        }
        public void Refresh(Connection connection)
        {
            EditingDatabase ed = (EditingDatabase)editingDatabases[connection];

            if (ed != null)
            {
                if (!ed.Closing())
                {
                    return;
                }
                ed.Close();
                editingDatabases.Remove(connection);
            }
            connection.Refresh();
        }
        private void mainForm_Closing(object sender, CancelEventArgs e)
        {
            foreach (EditingDatabase edb in editingDatabases.Values)
            {
                if (!edb.Closing())
                {
                    e.Cancel = true;
                    return;
                }
            }

            EditingDatabase[] ed = new EditingDatabase[editingDatabases.Values.Count];
            editingDatabases.Values.CopyTo(ed, 0);
            foreach (EditingDatabase edb in ed)
            {
                edb.Close();
            }
        }
        private void EditTest(Test test)
        {
            EditingDatabase ed = GetEditingDatabase(test);

            ed.EditTest(test);
        }
        private void EditQuestionSet(QuestionSet questionSet)
        {
            EditingDatabase ed = GetEditingDatabase(questionSet);

            ed.EditQuestionSet(questionSet);
        }