private static void OnDeleteFileFailed(object sender, PathCreationEngineEventArgs e)
 {
     try
     {
         if (PathCreationEngine.DeleteFileFailed != null)
         {
             PathCreationEngine.DeleteFileFailed(sender, e);
         }
     }
     catch (System.Exception systemException)
     {
         System.Diagnostics.Trace.WriteLine(systemException);
     }
 }
        /// <summary>
        /// Delete's the specified path if it exists. Raises the DeleteFileFailed event upon failure to allow user intervention.
        /// </summary>
        /// <param name="path">The path to delete, can be a file or directory</param>
        /// <param name="userData">User specified data to be raised during event notification</param>
        /// <returns></returns>
        public static bool DeleteFile(string path, object sender, object userData)
        {
            try
            {
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                return(true);
            }
            catch (System.Exception systemException)
            {
                PathCreationEngineEventArgs e = new PathCreationEngineEventArgs(path);
                e.Exception = systemException;
                e.UserData  = userData;
                PathCreationEngine.OnDeleteFileFailed(sender, e);

                switch (e.Result)
                {
                case DialogResult.OK:
                    return(true);

                case DialogResult.Cancel:
                    return(false);

                case DialogResult.Abort:
                    return(false);

                case DialogResult.Retry:
                    return(PathCreationEngine.DeleteFile(path, sender, userData));

                case DialogResult.Ignore:
                    return(true);
                }
                ;
            }
            return(false);
        }