Esempio n. 1
0
        private void abrirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                try
                {
                    ofd.Filter      = "All files (*.*)|*.*";
                    ofd.Title       = "Abrir arquivo existente";
                    ofd.Multiselect = false;

                    if (ofd.ShowDialog().Equals(DialogResult.OK))
                    {
                        _saved     = true;
                        fileCreate = true;
                        _pathFile  = ofd.FileName;

                        richTxtBText.Text = FileManipulator.Open(_pathFile);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ex.StackTrace);
                }
            }
        }
Esempio n. 2
0
 private void salvarToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!fileCreate)
     {
         SalvarComo();
     }
     else
     {
         FileManipulator.Save(_pathFile, richTxtBText.Text);
         _saved = true;
         statusStrip1.Items["toolStripStatusLabel1"].Text = "Salvo";
     }
 }
Esempio n. 3
0
 private void MessageSaveChanges()
 {
     if (MessageBox.Show("Existem mudanças não salvas ainda deseja salvar?", "Salvar alterações",
                         MessageBoxButtons.YesNo, MessageBoxIcon.Warning).Equals(DialogResult.Yes))
     {
         if (_pathFile.Equals(string.Empty))
         {
             SalvarComo();
         }
         else
         {
             FileManipulator.Save(_pathFile, richTxtBText.Text);
             _saved     = true;
             fileCreate = true;
             statusStrip1.Items["toolStripStatusLabel1"].Text = "Salvo";
         }
     }
 }
Esempio n. 4
0
        private void SalvarComo()
        {
            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                sfd.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";

                if (sfd.ShowDialog().Equals(DialogResult.OK))
                {
                    FileManipulator.Save(sfd.FileName, richTxtBText.Text);

                    _pathFile         = sfd.FileName;
                    richTxtBText.Text = string.Empty;
                    richTxtBText.Text = FileManipulator.Open(_pathFile);

                    _fileCreate = true;
                    _saved      = true;
                    statusStrip1.Items["toolStripStatusLabel1"].Text = "Salvo";
                }
            }
        }