如何摆脱Winform的插件安全性>>

问题描述 投票:0回答:1

Security addin window

嗨,我创建了多个外部命令,并将其停靠在自己的Revit选项卡中。但是,当我向其中一个命令添加Winform时,现在在Revit启动时要求我提供另一个安全插件弹出窗口。正如您在GiF中看到的那样。有办法摆脱它吗?

这是我的外部命令界面代码:

`[Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]公共类DeleteUnusedFilter:IExternalCommand{

    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {
        UIDocument uidoc = commandData.Application.ActiveUIDocument;
        Document doc = uidoc.Document;

             var Form = new DeleteFilter(commandData);
            try
            {
                var fltr = new FilterData(doc).GetUnusedFilter();
                if (fltr.Count == 0)
                {
                    MessageInfo.Display("No unused View Filters in Document");
                    Form.Close();
                return Result.Cancelled;
                }

                Form.ShowDialog();
                return Autodesk.Revit.UI.Result.Succeeded;
            }
            catch (Exception ex)
            {

                message = ex.Message;
                return Autodesk.Revit.UI.Result.Failed;
            }

    }
}`

这里是winform代码:

 public partial class DeleteFilter : System.Windows.Forms.Form
{
    Document doc;
    List<Element> FiltersToDelete;
    public DeleteFilter(ExternalCommandData commandData)
    {
        InitializeComponent();
        doc = commandData.Application.ActiveUIDocument.Document;
    }



    private void DeleteFilter_Load(object sender, EventArgs e)
    {
        callonload();

    }
}

这里是用于注册插件的UiApplication:

 //ribbon for delete unused filter
        string path3 = Assembly.GetExecutingAssembly().Location;
        var button3 = new PushButtonData("Button2", "Delete\n Unused Filter", path2, "RevitCode.DeleteUnusedFilter");
        var panel3 = application.CreateRibbonPanel("Angelo Tools", "Delete");

        Uri imagePath3 = new Uri(@"C:\ProgramData\Autodesk\Revit\Addins\2019\icon\DeleteFtr.png");
        BitmapImage image3 = new BitmapImage(imagePath3);
        button3.ToolTip = "Delete Unused View Filters";
        PushButton Push_button3 = panel3.AddItem(button3) as PushButton;
        Push_button3.LargeImage = image3;

        return Result.Succeeded;

提前感谢!

安全插件窗口嗨,我创建了多个外部命令,并将其停靠在它自己的Revit选项卡中。但是,当我在其中一个命令中添加Winform时,它正在询问我另一种安全性...

c# revit-api revit
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.