-
Notifications
You must be signed in to change notification settings - Fork 27
/
AddIn.cs
54 lines (47 loc) · 1.67 KB
/
AddIn.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Xarial.XCad.Base.Attributes;
using Xarial.XCad.SolidWorks;
using Xarial.XCad.SolidWorks.UI.PropertyPage;
using Xarial.XCad.UI.Commands;
namespace PMPageToggleBitmapButtons
{
[ComVisible(true)]
public class AddIn : SwAddInEx
{
[Title("PMPageToggleBitmapButtons")]
private enum Commands_e
{
ShowPMPage
}
private ISwPropertyManagerPage<PMPage> m_Page;
private PMPage m_Model;
public override void OnConnect()
{
m_Model = new PMPage();
this.CommandManager.AddCommandGroup<Commands_e>().CommandClick += OnButtonClick; ;
m_Page = this.CreatePage<PMPage>();
m_Page.Closed += OnPageClosed;
}
private void OnButtonClick(Commands_e spec)
{
switch (spec)
{
case Commands_e.ShowPMPage:
m_Page.Show(m_Model);
break;
}
}
private void OnPageClosed(Xarial.XCad.UI.PropertyPage.Enums.PageCloseReasons_e reason)
{
if (reason == Xarial.XCad.UI.PropertyPage.Enums.PageCloseReasons_e.Okay)
{
Application.ShowMessageBox($"CheckBoxA: {m_Model.ToggleOptions.CheckBoxA}\r\nCheckBoxB: {m_Model.ToggleOptions.CheckBoxB}\r\nCheckBoxC: {m_Model.ToggleOptions.CheckBoxC}\r\nCheckBoxD: {m_Model.ToggleOptions.CheckBoxD}\r\nCheckBoxE: {m_Model.ToggleOptions.CheckBoxE}\r\nCheckBoxF: {m_Model.ToggleOptions.CheckBoxF}\r\n");
}
}
}
}