using PdmSwPlugin.Common.Util;
|
using PdmSwPlugin.Main;
|
using PdmSwPlugin.Main.EventHandler;
|
using SolidWorks.Interop.sldworks;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace WpfUI
|
{
|
public class AsyncAttacher : BaseAttacher
|
{
|
public AsyncAttacher(ISldWorks swApp, MainControl mainControl) : base(swApp, mainControl)
|
{
|
}
|
|
public override bool AttachEventHandlers() {
|
AttachSwEvents();
|
ModelDoc2 modDoc = (ModelDoc2)SwApp.GetFirstDocument();
|
|
while (modDoc != null)
|
{
|
Task.Factory.StartNew(() => {
|
if (!OpenDocContext.IsOpenDoc(modDoc))
|
{
|
AttachModelDocEventHandler(modDoc);
|
}
|
|
});
|
modDoc = (ModelDoc2)modDoc.GetNext();
|
}
|
return true;
|
}
|
|
}
|
}
|