Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Am I able to implement both of these interfaces in the same class?
The provided sample does not seem to work, and I can't quite figure out why. I haven't set the PushButton property to a reference to itself, could that be the problem? Why isn't availability implemented in this way?
The full implementation for availability seems to be very cumbersome, so I have resorted to returning Result.Canceled with a taskdialog within the Execute method of the normal class (but allowing the button to always be available)
Any info would be much appreciated. Thanks!
public class ExampleClass : IExternalCommand, IExternalCommandAvailability
{
public override Result Execute(ExternalCommand commandData)
{
TaskDialog.Show("AvailableCommand","This is a floorplan!");
return Result.Succeeded;
}
public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
{
if(applicationData.ActiveUIDocument.ActiveView.ViewType == ViewType.FloorPlan) return true;
else return false;
}
}
}
Solved! Go to Solution.