Beispiel #1
0
 private void создатьToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (isNeedSave == true)
     {
         DialogResult message = MessageBox.Show("Сохранить изменения?", "Создание документа", MessageBoxButtons.YesNoCancel);
         if (message == DialogResult.Yes)
         {
             if (string.IsNullOrEmpty(path))
             {
                 FileLogic.Save(ref text, ref isNeedSave, ref path);
             }
             else
             {
                 FileLogic.SaveAs(ref text, ref isNeedSave, ref path);
             }
             FileLogic.Create(ref text, ref isNeedSave, ref path);
         }
         else if (message == DialogResult.No)
         {
             FileLogic.Create(ref text, ref isNeedSave, ref path);
         }
     }
     else
     {
         FileLogic.Create(ref text, ref isNeedSave, ref path);
     }
 }
Beispiel #2
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (isNeedSave == true)
     {
         DialogResult result = MessageBox.Show("Сохранить изменения?", "Сохранить?", MessageBoxButtons.YesNoCancel);
         if (result == DialogResult.Yes)
         {
             if (!string.IsNullOrEmpty(path))
             {
                 FileLogic.Save(ref text, ref isNeedSave, ref path);
             }
             else
             {
                 FileLogic.SaveAs(ref text, ref isNeedSave, ref path);
             }
             Application.Exit();
         }
         else if (result == DialogResult.No)
         {
             isNeedSave = false;
             Application.Exit();
         }
         else if (result == DialogResult.Cancel)
         {
             e.Cancel = true;
         }
     }
 }
Beispiel #3
0
 private void сохранитьToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(path))
     {
         FileLogic.Save(ref text, ref isNeedSave, ref path);
     }
     else
     {
         FileLogic.SaveAs(ref text, ref isNeedSave, ref path);
     }
 }
Beispiel #4
0
 private void сохранитьКакToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FileLogic.SaveAs(ref text, ref isNeedSave, ref path);
 }