public class sicherung { [DeclareEventHandler("Eplan.EplApi.OnUserPreCloseProject")] public void Function() { string strFullProjectname = PathMap.SubstitutePath("$(P)"); string strProjectpath = PathMap.SubstitutePath("F:" + @"\"); string strProjectname = PathMap.SubstitutePath("$(PROJECTNAME)"); DialogResult Result = MessageBox.Show( "Soll eine Sicherung für das Projekt\n'" + strProjectname + "'\nerzeugt werden?", "Datensicherung", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); if (Result == DialogResult.Yes) { string myTime = System.DateTime.Now.ToString("yyyy.MM.dd"); string hour = System.DateTime.Now.Hour.ToString(); string minute = System.DateTime.Now.Minute.ToString(); string Project = string.Empty; Project = GetProject(); Progress progress = new Progress("SimpleProgress"); progress.BeginPart(100, ""); progress.SetAllowCancel(true); if (!progress.Canceled()) { progress.BeginPart(33, "Backup"); ActionCallingContext backupContext = new ActionCallingContext(); backupContext.AddParameter("BACKUPMEDIA", "DISK"); backupContext.AddParameter("BACKUPMETHOD", "BACKUP"); backupContext.AddParameter("COMPRESSPRJ", "0"); backupContext.AddParameter("INCLEXTDOCS", "1"); backupContext.AddParameter("BACKUPAMOUNT", "BACKUPAMOUNT_ALL"); backupContext.AddParameter("INCLIMAGES", "1"); backupContext.AddParameter("LogMsgActionDone", "true"); backupContext.AddParameter("DESTINATIONPATH", strProjectname); backupContext.AddParameter("PROJECTNAME", Project); backupContext.AddParameter("TYPE", "PROJECT"); backupContext.AddParameter("ARCHIVENAME", Project + "_" + myTime + "_" + hour + "." + minute + "."); new CommandLineInterpreter().Execute("backup", backupContext); progress.EndPart(); } progress.EndPart(true); } return; } }