No prob's, I had five min's, not tested, just explaining what I meant:
using System;
using System.Diagnostics;
using System.Timers;
using System.Windows.Forms;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
[assembly: CommandClass(typeof(Test.TimeLimitOpen))]
namespace Test
{
/// <summary>
/// Description of TimeLimitOpen.
/// </summary>
public class TimeLimitOpen
{
public string[] DwgList;
System.Timers.Timer CountDownTimer;
DocumentCollection DocMan = AcadApp.DocumentManager;
int cnt = 1;
//- Constructor: sets up var's etc for this class before use.
public TimeLimitOpen()
{
CountDownTimer = new System.Timers.Timer();
CountDownTimer.Elapsed += new ElapsedEventHandler(OpenNext);
CountDownTimer.Interval = 10000;
CountDownTimer.Enabled = true;
MessageBox.Show(CountDownTimer.Enabled.ToString());
}
~TimeLimitOpen() // <-- Destructor, do clean up here.
{
CountDownTimer.Elapsed -= new ElapsedEventHandler(OpenNext);
}
public void OpenNext(object sender, ElapsedEventArgs e)
{
DocMan.MdiActiveDocument.CloseAndDiscard();
Document NewDoc = DocMan.Open(DwgList[cnt], true);
DocMan.MdiActiveDocument = NewDoc;
++cnt;
if (cnt > DwgList.Length)
{
CountDownTimer.Enabled = false;
CountDownTimer.Dispose();
}
}
[CommandMethod("TestTimer", CommandFlags.Session)]
public void Main()
{
Autodesk.AutoCAD.Windows.OpenFileDialog Dia =
new Autodesk.AutoCAD.Windows.OpenFileDialog(
"Select drawings to update Cloud layer", "", "dwg", "",
Autodesk.AutoCAD.Windows.OpenFileDialog.OpenFileDialogFlags.AllowMultiple);
Dia.ShowDialog();
string[] DwgList = Dia.GetFilenames();
if (DwgList.Length > 1)
{
Document NewDoc = DocMan.Open(DwgList[0], true);
if (NewDoc != DocMan.MdiActiveDocument)
{
DocMan.MdiActiveDocument = NewDoc;
}
}
}
}
}