Пример #1
0
        private void buttonNewDoc_Click(object sender, EventArgs e)
        {
            if (CurrentDocSet == null)
            {
                return;
            }
            InputDialog new_name_dlg = new InputDialog();

            new_name_dlg.SetInstr("Name of new document ..."); // in this example we're assuming that "name" will be required for nodes
            new_name_dlg.ShowDialog();
            if (new_name_dlg.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                DocWrapper.CreateDocument(CurrentDocSet, new_name_dlg.TextValue.Trim());
                RebuildDocList();
            }
        }
Пример #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            switch (ChosenPropStr())
            {
            case "Children":
                frmDocChooser doc_chooser = new frmDocChooser();
                doc_chooser.InitForDocSet(CurrentDoc.DocSet);
                doc_chooser.ShowDialog();
                if (doc_chooser.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    GlDoc doc_choice = doc_chooser.ChosenDoc();
                    if (doc_choice != null)
                    {
                        CurrentDoc.AppendDoc(ChosenPropStr(), doc_choice);
                        DisplayValues();
                    }
                }
                break;

            case "Favorite foods":
                InputDialog new_name_dlg = new InputDialog();

                new_name_dlg.SetInstr("Value ...");
                new_name_dlg.ShowDialog();
                if (new_name_dlg.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    string new_val = new_name_dlg.TextValue.Trim();
                    if (new_val != "")
                    {
                        CurrentDoc.AppendString(ChosenPropStr(), new_val);
                        DisplayValues();
                    }
                }
                break;
            }
        }