Пример #1
0
        private void btnAddDocument_Click(object sender, EventArgs e)
        {
            InputMessageBox inputMessageBox = new InputMessageBox();
            Document        doc;
            string?         name;

            name = inputMessageBox.ShowMessage("Enter new document name.", "New Document", "New File");

            if (name != null)
            {
                doc = new Document(Guid.NewGuid(), name, "");
                oDocumentList.Items.Add(doc);

                oDocumentList.SelectedIndex = oDocumentList.Items.Count - 1;

                Program.Modified = true;
            }
        }
Пример #2
0
        private void renameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Document?       document        = oDocumentList.Items[DeleteIndex] as Document;
            InputMessageBox inputMessageBox = new InputMessageBox();
            string?         name;
            string          defaultText;

            if (document != null)
            {
                defaultText = document.Name;
                name        = inputMessageBox.ShowMessage("Enter new name.", "Rename Document", defaultText);

                if (name != null)
                {
                    document.Name = name;

                    oDocumentList.Invalidate();
                    Program.Modified = true;
                }
            }
        }