添加项目文件。
This commit is contained in:
52
RevitKits/ParameterManager/ArchiParamsManagerCmd.cs
Normal file
52
RevitKits/ParameterManager/ArchiParamsManagerCmd.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Windows.Interop;
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Sai.Database.Shared;
|
||||
using Sai.RvKits.IO;
|
||||
using Sai.RvKits.Operation;
|
||||
using SZBIM.StandardTools;
|
||||
|
||||
namespace Sai.Common.Shared.ParameterManager
|
||||
{
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
[Regeneration(RegenerationOption.Manual)]
|
||||
public class ArchiParamsManagerCmd : IExternalCommand
|
||||
{
|
||||
private static readonly string DbString = $"Data Source={RelativePaths.DirAssembly}\\Database\\SZBIM.DeliveryStandard.db";
|
||||
private readonly DapperUtil dapperUtil = new(DbString);
|
||||
|
||||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||
{
|
||||
if (WinIntPtr.IsVisible("建筑参数管理"))
|
||||
{
|
||||
WinIntPtr.ShowAndActive("建筑参数管理");
|
||||
}
|
||||
else
|
||||
{
|
||||
dapperUtil.CreateConnect();
|
||||
ArchiParamManagerViewModel viewModel = new ArchiParamManagerViewModel(dapperUtil);
|
||||
try
|
||||
{
|
||||
var win = new ArchiParamsManagerWin(viewModel);
|
||||
_ = new WindowInteropHelper(win)
|
||||
{
|
||||
Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle
|
||||
};
|
||||
win.Show();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogUtil.WriteLog(ex.Message, RelativePaths.LogFolder);
|
||||
}
|
||||
finally
|
||||
{
|
||||
dapperUtil.CloseConnect();
|
||||
}
|
||||
}
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user