Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 protected virtual bool OnSave(DataFileEventArgs e)
 {
     try
     {
         SaveFile?.Invoke(this, e);
         FileName   = e.FileName;
         IsModified = false;
         FileChanged?.Invoke(this, e);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Error saving '{FileName}' : {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return(false);
     }
 }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 protected virtual bool OnNew(DataFileEventArgs e)
 {
     try
     {
         NewFile?.Invoke(this, e);
         FileName   = null;
         IsModified = false;
         FileChanged?.Invoke(this, e);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Error creating new file : {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return(false);
     }
 }