Can anyone help out with this? I can't distinguish which button is pressed. I've been trying to see if ExternalCommandData has the information I need but I can't seem to get a dialogbox that says "Button 1" or "Button 2"
using System; using System.Reflection; using Autodesk.Revit.DB; using Autodesk.Revit.UI; using System.Diagnostics; using System.IO; using System.Windows.Media.Imaging; using Autodesk.Revit; using System.Xml; namespace Lab1PlaceGroup { class Lab1PlaceGroup : IExternalApplication { public Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application) { string tabName = "Crystal"; string path = Assembly.GetExecutingAssembly().Location; application.CreateRibbonTab(tabName); RibbonPanel panel = application.CreateRibbonPanel(tabName, "New Ribbon Panel"); panel.AddSeparator(); AddPushButton(panel); //AddSplitButton(panel); //AddStackedButtons(panel); AddSlideOut(panel); return Result.Succeeded; } public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication application) { return Result.Succeeded; } private void AddPushButton(RibbonPanel panel) { PushButton pushButton = panel.AddItem(new PushButtonData("HelloWorld", "HelloWorld", Assembly.GetExecutingAssembly().Location, "Lab1PlaceGroup.HelloWorld")) as PushButton; // Set ToolTip and contextual help pushButton.ToolTip = "Say Hello World"; ContextualHelp contextHelp = new ContextualHelp(ContextualHelpType.Url, "http://www.autodesk.com"); pushButton.SetContextualHelp(contextHelp); // Set the large image shown on button pushButton.LargeImage = new BitmapImage(new Uri(@"D:\Images\globe.jpg")); } private static void AddSlideOut(RibbonPanel panel) { string assembly = Assembly.GetExecutingAssembly().Location; panel.AddSlideOut(); // create some controls for the slide out PushButtonData b1 = new PushButtonData("ButtonName1", "Button 1", assembly, "Lab1PlaceGroup.HelloWorld"); b1.LargeImage = new BitmapImage(new Uri(@"D:\Images\globe.jpg")); PushButtonData b2 = new PushButtonData("ButtonName2", "Button 2", assembly, "Lab1PlaceGroup.HelloWorld"); b2.LargeImage = new BitmapImage(new Uri(@"D:\Images\globe.jpg")); // items added after call to AddSlideOut() are added to slide-out automatically panel.AddItem(b1); panel.AddItem(b2); } } [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)] public class HelloWorld : IExternalCommand { // The main Execute method (inherited from IExternalCommand) must be public public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit, ref string message, ElementSet elements) { TaskDialog.Show("Revit", revit.Application.ToString()); return Autodesk.Revit.UI.Result.Succeeded; } } }