80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
|
|
using Laservall.Solidworks.Extension;
|
|
using Laservall.Solidworks.Pane;
|
|
using Laservall.Solidworks.Pane.WPF;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Resources;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Xarial.XCad.Base.Attributes;
|
|
using Xarial.XCad.Documents;
|
|
using Xarial.XCad.SolidWorks.UI.PropertyPage;
|
|
using Xarial.XCad.UI;
|
|
using Xarial.XCad.UI.Commands;
|
|
using Xarial.XCad.UI.PropertyPage.Enums;
|
|
using Xarial.XCad.UI.TaskPane;
|
|
using Xarial.XCad.UI.TaskPane.Attributes;
|
|
using Xarial.XCad.UI.TaskPane.Enums;
|
|
|
|
namespace Laservall.Solidworks
|
|
{
|
|
[System.Runtime.InteropServices.ComVisible(true)]
|
|
public class AddinEntry : Xarial.XCad.SolidWorks.SwAddInEx
|
|
{
|
|
private IXTaskPane<PartPropPaneUserControl> m_TaskPane;
|
|
public override void OnConnect()
|
|
{
|
|
// 初始化DLL加载器
|
|
AppDomainDllLoader.SetLaoder();
|
|
// 初始化WPF应用程序
|
|
WPFApplicationExt.InitApplication();
|
|
//var taskPane = this.CreateTaskPane<TestUserControl>();
|
|
var cmdTaskPane = this.CreateTaskPane<PartPropPaneUserControl>(new TaskPaneSpec
|
|
{
|
|
Title = "Laservall 自定义属性卡",
|
|
Tooltip = "Laservall 自定义属性卡"
|
|
});
|
|
//cmdTaskPane.
|
|
cmdTaskPane.Control.pane = cmdTaskPane;
|
|
|
|
m_TaskPane = cmdTaskPane;
|
|
|
|
this.Application.Documents.DocumentActivated += OnDocumentActivated;
|
|
|
|
if (this.Application.Documents.Active != null)
|
|
{
|
|
SubscribeToSelectionEvents(this.Application.Documents.Active);
|
|
}
|
|
}
|
|
private void OnDocumentActivated(IXDocument doc)
|
|
{
|
|
SubscribeToSelectionEvents(doc);
|
|
}
|
|
|
|
private void SubscribeToSelectionEvents(IXDocument doc)
|
|
{
|
|
doc.Selections.NewSelection += Selections_NewSelection;
|
|
}
|
|
|
|
private void Selections_NewSelection(IXDocument doc, Xarial.XCad.IXSelObject selObject)
|
|
{
|
|
m_TaskPane.Control.OnSelectChange(doc, selObject);
|
|
}
|
|
|
|
|
|
public override void OnDisconnect()
|
|
{
|
|
base.OnDisconnect();
|
|
|
|
//AppDomainDllLoader.
|
|
}
|
|
private void OnTaskPaneButtonClick(TaskPaneButtonSpec spec)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|