using System.Windows.Forms;
using Eplan.EplApi.ApplicationFramework;
using Eplan.EplApi.Base;
using Eplan.EplApi.Scripting;
using System;
using System.Timers;
public class BACKUP
{
private static System.Timers.Timer aTimer;
public void Timer()
{
aTimer = new System.Timers.Timer(10000);
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
aTimer.Interval = 2000;
aTimer.Enabled = true;
}
public void OnTimedEvent(object source, ElapsedEventArgs e)
{
string strTime = DateTime.Now.ToString("hh-mm-ss");
if (strTime == "08-12-00")
{
backup();
}
}
[DeclareEventHandler("Eplan.EplApi.OnUserPreCloseProject")]
public void project_user_close()
{
backup();
}
[DeclareEventHandler("Eplan.EplApi.OnMainEnd")]
public void project_Main_close()
{
backup();
}
public void backup()
{
string strFullProjectname = PathMap.SubstitutePath("$(P)");
string strProjectpath = PathMap.SubstitutePath(@"\\LEUAND7\ELDaten\EPLAN_P8\Daten\Safe\");
string strProjectname = PathMap.SubstitutePath("$(PROJECTNAME)");
string strDate = DateTime.Now.ToString("yyyy-MM-dd");
string strTime = DateTime.Now.ToString("hh-mm-ss");
Progress oProgress = new Progress("SimpleProgress");
oProgress.SetAllowCancel(true);
oProgress.SetAskOnCancel(true);
oProgress.BeginPart(100, "");
oProgress.ShowImmediately();
CommandLineInterpreter oCLI = new CommandLineInterpreter();
ActionCallingContext acc = new ActionCallingContext();
acc.AddParameter("TYPE", "PROJECT");
acc.AddParameter("PROJECTNAME", strFullProjectname);
acc.AddParameter("ARCHIVENAME", strDate + "_" + strTime + ".zw1");
acc.AddParameter("DESTINATIONPATH", strProjectpath + strProjectname);
acc.AddParameter("BACKUPMEDIA", "DISK");
acc.AddParameter("BACKUPMETHOD", "BACKUP");
acc.AddParameter("LogMsgActionDone", "true");
oCLI.Execute("backup", acc);
oProgress.EndPart(true);
return;
}
}
------------------
SCK
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP