Application: UIAPI
Revit Platform: All
Revit Version: 2013.0
First Released For: 2013.0
Programming Language: C#
Skill Level: Medium
Category: Basics
Type: External Application

Subject: API UI Usage.
Summary: 
This sample demonstrates how to use API UI abilities.

Classes:
Autodesk.Revit.UI.UIApplication
Autodesk.Revit.UI.ContextualHelp
Autodesk.Revit.UI.TabbedDialogExtension
Autodesk.Revit.ApplicationServices.Application

Project Files: 
•	ExternalApplication.cs - contains the class ExternalApp which inherits from interface IExternalApplication and implements the OnStartup and OnShutdown methods, which creates the Add-in integration Ribbon Tab with 5 Ribbon buttons; and the class CalcCommand which inherits from interface IExternalCommand and implements the Execute method, which provides the function of the first 3 Ribbon buttons.
•	ApplicationOptions.cs – contains the class ApplicationOptions and enum ApplicationAvailablity to cached the buttons visibility settings in the “Options demo” page of the options dialog.
•	ApplicationAvailability.cs –contains the class ApplicationAvailabilityClass which implement the interface IExternalCommandAvailability to handle the buttons visibility with the cached value.
•	PreviewCommand.cs – contains the class PreviewCommand which inherits from interface IExternalCommand and implements the Execute method. This command class provides the function of the 4th Ribbon button – “Preview all Views” which will pop up a windows form – “Preview Model” - after been clicked.
•	PreviewModel.cs – The implementation of the “Preview Model” form which demonstrates how to use the PreviewControl API.
•	PreviewModel.Designer.cs and PreviewModel.resx – The UI files of the “Preview Model” form.
•	DragAndDropCommand.cs – contains the class DragAndDropCommand which implement the interface IExternalCommand and provides the function of the 5th Ribbon button – “Drag and Drop” – which will pop up a modeless windows form – “Drag And Drop” – after been clicked.
•	DragAndDrop.cs – The implementation of the “Drag And Drop” form which demonstrates how to use the DragAndDrop API.
•	DragAndDrop.Designer.cs and DradAndDrop.resx – The UI files of the “DragAndDrop” form.
•	AddTabCommands.cs – contains the class AddTabCommand which demonstrates how to use the Options Dialog API to insert the pages to the options dialog.
•	UserControl1.xaml, UserControl2.xmal, UserControl3.xaml – The UI files of the pages which will be inserted to options dialog.
•	UserControl1.xaml.cs, UserControl2.xmal.cs, UserControl3.xaml.cs – The simple implementation of the options pages which will be inserted to options dialog.
•	RevitAddInUtility.chm – The chm file will be open and bring to user after the 3rd Ribbon button been clicked to demonstrate how to use the contextual help API.

Description: This sample demonstrates the following functionalities:
-	Drag and drop abilities of UIApplication.
-	Users could add customized options tabs in Options dialog.
-	Preview function via API.

Instructions: 
1.	Register this application command and Start the Revit, you will get an AddIn Integration tab with 5 Ribbon buttons as the picture below.

	Holds the cursor on the first button “Goto WikiHelp for wall creation” a while, the tooltip will show up and press the “F1” button, Revit will launch the internet browser and go to the Revit wiki help of Wall creation topic.

	Holds the cursor on the second button “Go to Google” a while, the tooltip will show up and press the “F1” button, Revit will launch the internet browser and go to the www.google.com .

    Holds the cursor on the second button “Go to Revit Add-In Utility” a while, the tooltip will show up and then press the “F1” button, Revit will open the “Revit Add-In Utility 2012” chm file and go to the RevitVersion Enumeration page.

2.	In Revit menu, open the options dialog.The customized option tabs will be displayed.
The first customized option page is “Demo Options”, it demonstrates how to control the buttons status – disable/enable – with discipline in options dialog.

The second customized option page is “Product Information”, it copies the UI from the Revit about dialog and show as a options page.

The thrid customized page is “SteeringWheels(Copy)”, it just copies the UI from the SteeringWheels.

The forth page is “WPF components”, it demonstrates how to use the complicated WPF controls in the customized options page.

3.	Invoke Previewcontrol command and a model form will pop up as below.

Drop down the Views list on the right bottom and change the item can inspect the different view in the preview control.

Drop down the Documents list on the left bottom and change the item can switch to different document or open a new project document.

4.	Invoke DragAndDrop command and a modeless form will pop up as below.

You can drag the image item from the left panel to the Revit view to place a component, or drag the family file name item from the right panel to the Revit view to load a family file into current project and place it to model.