The article provides some examples of how to use the Open Items of Type dialog in the Extensions API.


Example 1

Using the Open Items of type dialog in the same way as Add Part in the swExplorer.


// Get the Part Type in question in some way, in this case from a given Part SID
IswPartType partType = _broker.FindPartTypeWithSID(partSid);

/* Open the SelectItem dialog:
 * -selectedItem = the item returned from the dialog,
 * -_currentItem = the owner of the partType. For example an item where 
 *the selectedItem shall be added as a Part. 
 * It is used for Add Part grids.
 * -partType = The Part Type intended to be used for adding the 
 *selectedItem to _currentItem. 
 * This limits the options in the dialog to the Item types valid for that 
 *Part Type.
*/
if (!_host.GetDialogs().SelectItem(out IswItem selectedItem, null, _currentItem, null, partType))
    return;

// Perform an action, for example adding the selected Item as a part to the _currentItem.
_currentItem.AddPart(partSid, selectedItem);


Example 2

Using the Open Items of type dialog in the same way as Open Item>Other Item Type.

string itemSid = "AR4P";

/* Open the SelectItem dialog:
 * -selectedItem = the item returned from the dialog
 * -itemSid= The Item Type SID to look for
*/

if (!_host.GetDialogs().SelectItem(out IswItem selectedItem, itemSid))
    return;