- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello there,
If anyone has any idea why is my code failing even though after successful build i Visual Studio itself. While implementing in Revit i Get the following error. It works fine with TaskDialog (commented) but not TestWindow.
Thanks for helping.
the code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using System.Xml.Linq;
using System.Windows.Media.Imaging;
using Autodesk.Revit.DB;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.UI;
using Autodesk.Revit.ApplicationServices;
namespace ClassLibrary1
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class Class2 : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
//var components = uidoc.Selection.GetElementIds();
ICollection<ElementId> components = uidoc.Selection.GetElementIds();
TestWindow testWindow = new TestWindow(components);
testWindow.ShowDialog("Message",components.Count.ToString());
//TaskDialog.Show("Message", components.Count.ToString());
testWindow.Show();
//TaskDialog.Show("Revit", "Hello World");
return Result.Succeeded;
}
}
}
Solved! Go to Solution.