Пример #1
0
        public static void SaveFileAs(TextDocument doc)
        {
            SaveFileDialog sfd = new SaveFileDialog()
            {
                CheckPathExists = true,
                ValidateNames   = true,
                AddExtension    = true,
                Title           = "Save File - MDI Sample",
                Filter          = "Text files (*.txt)|*.txt"
            };

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                doc.Location = sfd.FileName;
                TextDocumentSaver.Save(doc);
            }
        }
Пример #2
0
        private void ContentForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!document.IsSaved)
            {
                DialogResult dr = MessageBox.Show("Сохранить файл?", "Файл не сохранен!", MessageBoxButtons.YesNoCancel,
                                                  MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

                switch (dr)
                {
                case DialogResult.Yes: TextDocumentSaver.SaveFile(document); break;

                case DialogResult.No: break;

                case DialogResult.Cancel: e.Cancel = true; break;
                }
            }
        }
Пример #3
0
 override public void SaveFileAs()
 {
     TextDocumentSaver.SaveFileAs(document);
 }
Пример #4
0
 private void tsmiSaveAsUTF8_Click(object sender, EventArgs e)
 {
     TextDocumentSaver.SaveFileInEncoding(document, Encoding.UTF8);
 }
Пример #5
0
 private void tsmiSaveAsBigEndian_Click(object sender, EventArgs e)
 {
     TextDocumentSaver.SaveFileInEncoding(document, Encoding.BigEndianUnicode);
 }
Пример #6
0
 private void tsmiSaveAsКОИ8U_Click(object sender, EventArgs e)
 {
     TextDocumentSaver.SaveFileInEncoding(document, Encoding.GetEncoding("KOI8-U"));
 }
Пример #7
0
 private void tsmiSaveAsDOS866_Click(object sender, EventArgs e)
 {
     TextDocumentSaver.SaveFileInEncoding(document, Encoding.GetEncoding(866));
 }
Пример #8
0
 private void tsmiSaveAsWindows1251_Click(object sender, EventArgs e)
 {
     TextDocumentSaver.SaveFileInEncoding(document, Encoding.GetEncoding(1251));
 }