40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using System;
|
|
using Autodesk.Revit.DB;
|
|
using Autodesk.Revit.UI;
|
|
using Sai.Database.Shared;
|
|
using Sai.RvKits.IO;
|
|
using Sai.RvKits.Operation;
|
|
|
|
namespace Sai.Common.Shared.WBSCoder
|
|
{
|
|
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
|
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
|
public class CheckAndAddWbsCodeCmd : IExternalCommand
|
|
{
|
|
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
|
{
|
|
UIApplication uiapp = commandData.Application;
|
|
UIDocument uidoc = uiapp.ActiveUIDocument;
|
|
try
|
|
{
|
|
if (WinIntPtr.IsVisible("WBS编码") == false)
|
|
{
|
|
var sqLiteUtil = new SqliteUtil();
|
|
CheckCodeViewModel checkCodeViewModel = new CheckCodeViewModel(uidoc, sqLiteUtil);
|
|
CheckCoderWin checkCode = new CheckCoderWin(checkCodeViewModel);
|
|
checkCode.ShowWindow();
|
|
}
|
|
else
|
|
{
|
|
WinIntPtr.ShowAndActive("WBS编码");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteLog(ex.Message);
|
|
}
|
|
|
|
return Result.Succeeded;
|
|
}
|
|
}
|
|
} |