You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
3.3 KiB
87 lines
3.3 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Eplan.EplApi.Gui;
|
|
using KPlan.Util;
|
|
|
|
namespace KPlan
|
|
{
|
|
public class KPlanModule:Eplan.EplApi.ApplicationFramework.IEplAddIn
|
|
{
|
|
public static Menu kMenu = new Menu();
|
|
public static uint menuId;
|
|
public const int PART_SYNC_MENU_INDEX = 0;
|
|
public static uint PART_SYNC_MENU_ID;
|
|
public static uint SETTING_MENU_ID;
|
|
|
|
public bool OnRegister(ref System.Boolean bLoadOnStart) {
|
|
bLoadOnStart = true;
|
|
return true;
|
|
}
|
|
public bool OnUnregister() {
|
|
return true;
|
|
}
|
|
public bool OnInit() {
|
|
return true;
|
|
}
|
|
|
|
public static void AddSpMenu() {
|
|
PART_SYNC_MENU_ID = kMenu.AddMenuItem("部件库同步", "KPartSyncAction", "", menuId, PART_SYNC_MENU_INDEX, false, false);
|
|
SETTING_MENU_ID = kMenu.AddMenuItem("设置", "ConfigureAction", "", menuId, 0, false, false);
|
|
KUtil.Log("添加菜单:"+PART_SYNC_MENU_ID);
|
|
}
|
|
|
|
public static void RemoveSpMenu() {
|
|
KUtil.Log("移除菜单:"+PART_SYNC_MENU_ID);
|
|
kMenu.RemoveMenuItem(PART_SYNC_MENU_ID);
|
|
kMenu.RemoveMenuItem(SETTING_MENU_ID);
|
|
}
|
|
|
|
|
|
|
|
public bool OnInitGui() {
|
|
//Eplan.EplApi.Gui.Menu oMenu = new Eplan.EplApi.Gui.Menu();
|
|
menuId = kMenu.AddMainMenu("Teamcenter集成", Menu.MainMenuName.eMainMenuUtilities, "检查并保存", "KCheckProjectAction_Ex", "", 0);
|
|
kMenu.AddMenuItem("登录", "LoginAction", "", menuId, 0, false, false);
|
|
//kMenu.AddMenuItem("设置", "ConfigureAction", "", menuId, 0, false, false);
|
|
kMenu.AddMenuItem("新建", "CreateProjectAction", "", menuId, 0, false, false);
|
|
kMenu.AddMenuItem("打开", "OpenFromTCAction", "", menuId, 0, false, true);
|
|
//kMenu.AddMenuItem("检查并保存", "KCheckProjectAction_Ex", "", menuId, 0, false, false);
|
|
//kMenu.AddMenuItem("检查", "CheckProjectAction", "", menuId, 5, false, false);
|
|
//kMenu.AddMenuItem("保存", "SaveProjectAction", "", menuId, 6, false, false);
|
|
// kMenu.AddMenuItem("设置", "ConfigureAction", "", menuId, 0, false, true);
|
|
// kMenu.AddMenuItem("下载 EPLAN 主数据", "KDownloadTCDataAction", "", menuId, 0, true, false);
|
|
//kMenu.AddMenuItem("部件库同步 (new)", "KPartSyncAction", "", menuId, 8, false, false);
|
|
//kMenu.AddMenuItem("部件库同步", "PartSyncAction", "", menuId, 7, false, false);
|
|
//TCUtil.PreLogin(); KTestAction
|
|
//kMenu.AddMenuItem("测试", "KTestAction", "", menuId, 11, false, false);
|
|
|
|
//kMenu.AddMenuItem("检查并保存", "KCheckProjectAction", "", menuId, 12, true, false);
|
|
//kMenu.AddMenuItem("下载TC数据至EPLAN", "KDownloadTCDataAction", "", menuId, 14, false, false);
|
|
return true;
|
|
}
|
|
|
|
|
|
public bool OnExit() {
|
|
KUtil.Log("系统退出");
|
|
//退出soa登录
|
|
try {
|
|
TCUtil.Logout();
|
|
}
|
|
catch (System.Exception ex) {
|
|
KUtil.LogErr(ex);
|
|
}
|
|
//try {
|
|
// EplanUtil.mdPartsDatabase.Close();
|
|
// KUtil.Log("PartsDatabase已关闭");
|
|
//}
|
|
//catch (System.Exception ex) {
|
|
// KUtil.LogErr(ex);
|
|
//}
|
|
return true;
|
|
}
|
|
}
|
|
}
|