private void apriToolStripMenuItem_Click(object sender, EventArgs e) { if (openFD.ShowDialog() == DialogResult.OK) { try { FormFunctions.ControlloInChiusura(ref flag_modified, RTBText, ref FileName, ref flag_saved); RTBText.Lines = File.ReadAllLines(openFD.FileName); FileName = openFD.FileName; FormFunctions.PopulateTreeView(TWfiles, FileName); } #region Catches catch (OperationCanceledException) { return; } catch (IOException) { if (MessageBox.Show("Errore in Lettura\n\nRiprovare?", "Errore", MessageBoxButtons.YesNo) == DialogResult.Yes) { apriToolStripMenuItem_Click(sender, e); } else { return; } } catch (UnauthorizedAccessException) { MessageBox.Show("Accesso al file negato"); return; } catch (System.Security.SecurityException) { MessageBox.Show("accesso al file negato"); return; } #endregion } flag_saved = true; flag_modified = false; undoList.Clear(); redoList.Clear(); }
private void FormBase_FormClosing(object sender, FormClosingEventArgs e) { try { FormFunctions.ControlloInChiusura(ref flag_modified, RTBText, ref FileName, ref flag_saved); } catch (OperationCanceledException) { e.Cancel = true; } }//chiusura form
private void nuovoToolStripMenuItem_Click(object sender, EventArgs e) { try { FormFunctions.ControlloInChiusura(ref flag_modified, RTBText, ref FileName, ref flag_saved); } catch (OperationCanceledException) { return; }; flag_modified = false; flag_saved = false; undoList.Clear(); redoList.Clear(); //RTBText.Text = "|Scrivi il tuo codice qui|"; }