Autodesk.Revit.Exceptions.WrongUserException 是Revit API中的一个异常类。当尝试更改文档但当前用户无权进行此操作时,将抛出此异常。
该异常类继承自 Autodesk.Revit.Exceptions.InvalidOperationException。该类的命名空间为 Autodesk.Revit.Exceptions。
Autodesk.Revit.Exceptions.WrongUserException 具有以下构造函数:
public WrongUserException()
public WrongUserException(string message)
public WrongUserException(string message, Exception innerException)
message:异常信息(可选)innerException:内部异常(可选)当 Autodesk.Revit.Exceptions.WrongUserException 发生时,可能会出现以下异常信息:
This change cannot be made by the current user.(当前用户无法进行此更改。)下面的示例代码演示了如何使用 Autodesk.Revit.Exceptions.WrongUserException:
try
{
// 尝试更改Revit文档
}
catch (Autodesk.Revit.Exceptions.WrongUserException ex)
{
TaskDialog.Show("错误", "当前用户无权进行此操作。");
}