//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using DslModeling = global::Microsoft.VisualStudio.Modeling;
using DslDesign = global::Microsoft.VisualStudio.Modeling.Design;
using System;
using System.Diagnostics;
using System.Drawing.Design;
using System.Windows.Forms;
using DslDiagrams = global::Microsoft.VisualStudio.Modeling.Diagrams;

namespace MDC.ProductionSystem
{
	/// <summary>
	/// Helper class used to create and initialize toolbox items for this DSL.
	/// </summary>
	/// <remarks>
	/// Double-derived class to allow easier code customization.
	/// </remarks>
	public partial class ProductionSystemToolboxHelper : ProductionSystemToolboxHelperBase 
	{
		/// <summary>
		/// Constructs a new ProductionSystemToolboxHelper.
		/// </summary>
		public ProductionSystemToolboxHelper(global::System.IServiceProvider serviceProvider)
			: base(serviceProvider) { }
	}
	
	/// <summary>
	/// Helper class used to create and initialize toolbox items for this DSL.
	/// </summary>
	
	[global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "The store is disposed on domain shut down")]
	public abstract class ProductionSystemToolboxHelperBase
	{
		/// <summary>
		/// Toolbox item filter string used to identify ProductionSystem toolbox items.  
		/// </summary>
		/// <remarks>
		/// See the MSDN documentation for the ToolboxItemFilterAttribute class for more information on toolbox
		/// item filters.
		/// </remarks>
		public const string ToolboxFilterString = "ProductionSystem.1.0";
		/// <summary>
		/// Toolbox item filter string used to identify ComponentToConveyor connector tool.
		/// </summary>
		public const string ComponentToConveyorFilterString = "ComponentToConveyor.1.0";
		/// <summary>
		/// Toolbox item filter string used to identify ConveyorToConveyor connector tool.
		/// </summary>
		public const string ConveyorToConveyorFilterString = "ConveyorToConveyor.1.0";
		/// <summary>
		/// Toolbox item filter string used to identify ConveyorToMachine connector tool.
		/// </summary>
		public const string ConveyorToMachineFilterString = "ConveyorToMachine.1.0";
		/// <summary>
		/// Toolbox item filter string used to identify MachineToConveyor connector tool.
		/// </summary>
		public const string MachineToConveyorFilterString = "MachineToConveyor.1.0";
		/// <summary>
		/// Toolbox item filter string used to identify OperatorToMachine connector tool.
		/// </summary>
		public const string OperatorToMachineFilterString = "OperatorToMachine.1.0";

	
		private global::System.Collections.Generic.Dictionary<string, DslDesign::ModelingToolboxItem> toolboxItemCache = new global::System.Collections.Generic.Dictionary<string, DslDesign::ModelingToolboxItem>();
		private DslModeling::Store toolboxStore;
		
		private global::System.IServiceProvider sp;
		
		/// <summary>
		/// Constructs a new ProductionSystemToolboxHelperBase.
		/// </summary>
		protected ProductionSystemToolboxHelperBase(global::System.IServiceProvider serviceProvider)
		{
			if(serviceProvider == null) throw new global::System.ArgumentNullException("serviceProvider");
			
			this.sp = serviceProvider;
		}
		
		/// <summary>
		/// Serivce provider used to access services from the hosting environment.
		/// </summary>
		protected global::System.IServiceProvider ServiceProvider
		{
			get
			{
				return this.sp;
			}
		}

		/// <summary>
		/// Returns the display name of the tab that should be opened by default when the editor is opened.
		/// </summary>
		public static string DefaultToolboxTabName
		{
			get
			{
				return global::MDC.ProductionSystem.ProductionSystemDomainModel.SingletonResourceManager.GetString("ProductionSystemToolboxTab", global::System.Globalization.CultureInfo.CurrentUICulture);
			}
		}
		
		
		/// <summary>
		/// Returns the toolbox items count in the default tool box tab.
		/// </summary>
		public static int DefaultToolboxTabToolboxItemsCount
		{
			get
			{
				return 21;
			}
		}
		

		/// <summary>
		/// Returns a list of custom toolbox items to be added dynamically
		/// </summary>
		public virtual global::System.Collections.Generic.IList<DslDesign::ModelingToolboxItem> CreateToolboxItems()
		{
			global::System.Collections.Generic.List<DslDesign::ModelingToolboxItem> toolboxItems = new global::System.Collections.Generic.List<DslDesign::ModelingToolboxItem>();
			return toolboxItems;
		}
		
		/// <summary>
		/// Creates an ElementGroupPrototype for the element tool corresponding to the given domain class id.
		/// Default behavior is to create a prototype containing an instance of the domain class.
		/// Derived classes may override this to add additional information to the prototype.
		/// </summary>
		protected virtual DslModeling::ElementGroupPrototype CreateElementToolPrototype(DslModeling::Store store, global::System.Guid domainClassId)
		{
			DslModeling::ModelElement element = store.ElementFactory.CreateElement(domainClassId);
			DslModeling::ElementGroup elementGroup = new DslModeling::ElementGroup(store.DefaultPartition);
			elementGroup.AddGraph(element, true);
			return elementGroup.CreatePrototype();
		}

		/// <summary>
		/// Returns instance of ModelingToolboxItem based on specified name.
		/// This method must be called from within a Transaction. Failure to do so will result in an exception
		/// </summary>
		/// <param name="itemId">unique name of desired ToolboxItem</param>
		/// <param name="store">Store to perform the operation against</param>
		/// <returns>An instance of ModelingToolboxItem if the itemId can be resolved, null otherwise</returns>
		public virtual DslDesign::ModelingToolboxItem GetToolboxItem(string itemId, DslModeling::Store store)
		{
			DslDesign::ModelingToolboxItem result = null;
			if (string.IsNullOrEmpty(itemId))
			{
				return null;
			}
			if (store == null)
			{
				return null;
			}
			global::System.Resources.ResourceManager resourceManager = global::MDC.ProductionSystem.ProductionSystemDomainModel.SingletonResourceManager;
			global::System.Globalization.CultureInfo resourceCulture = global::System.Globalization.CultureInfo.CurrentUICulture;
			switch(itemId)
			{
				case "MDC.ProductionSystem.ConveyorBeltToolboxItem":
					// Add ConveyorBelt shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.ConveyorBeltToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						1, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("ConveyorBeltToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("ConveyorBeltToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"ConveyorBelt", // F1 help keyword for the toolbox item.
						resourceManager.GetString("ConveyorBeltToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.ConveyorBelt.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.WheelGeneratorToolboxItem":
					// Add WheelGenerator shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.WheelGeneratorToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						2, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("WheelGeneratorToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("WheelGeneratorToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"WheelGenerator", // F1 help keyword for the toolbox item.
						resourceManager.GetString("WheelGeneratorToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.WheelGenerator.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.TrackGeneratorToolboxItem":
					// Add TrackGenerator shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.TrackGeneratorToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						3, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("TrackGeneratorToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("TrackGeneratorToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"TrackGenerator", // F1 help keyword for the toolbox item.
						resourceManager.GetString("TrackGeneratorToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.TrackGenerator.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.BodyGeneratorToolboxItem":
					// Add BodyGenerator shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.BodyGeneratorToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						4, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("BodyGeneratorToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("BodyGeneratorToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"BodyGenerator", // F1 help keyword for the toolbox item.
						resourceManager.GetString("BodyGeneratorToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.BodyGenerator.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.GunGeneratorToolboxItem":
					// Add GunGenerator shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.GunGeneratorToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						5, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("GunGeneratorToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("GunGeneratorToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"GunGenerator", // F1 help keyword for the toolbox item.
						resourceManager.GetString("GunGeneratorToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.GunGenerator.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.WaterGeneratorToolboxItem":
					// Add WaterGenerator shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.WaterGeneratorToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						6, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("WaterGeneratorToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("WaterGeneratorToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"WaterGenerator", // F1 help keyword for the toolbox item.
						resourceManager.GetString("WaterGeneratorToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.WaterGenerator.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.OperatorToolboxItem":
					// Add Operator shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.OperatorToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						7, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("OperatorToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("OperatorToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"Operator", // F1 help keyword for the toolbox item.
						resourceManager.GetString("OperatorToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.Operator.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.WheelToolboxItem":
					// Add Wheel shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.WheelToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						8, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("WheelToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("WheelToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"Wheel", // F1 help keyword for the toolbox item.
						resourceManager.GetString("WheelToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.Wheel.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.TrackToolboxItem":
					// Add Track shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.TrackToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						9, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("TrackToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("TrackToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"Track", // F1 help keyword for the toolbox item.
						resourceManager.GetString("TrackToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.Track.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.BodyToolboxItem":
					// Add Body shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.BodyToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						10, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("BodyToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("BodyToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"Body", // F1 help keyword for the toolbox item.
						resourceManager.GetString("BodyToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.Body.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.GunToolboxItem":
					// Add Gun shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.GunToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						11, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("GunToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("GunToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"Gun", // F1 help keyword for the toolbox item.
						resourceManager.GetString("GunToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.Gun.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.WaterToolboxItem":
					// Add Water shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.WaterToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						12, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("WaterToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("WaterToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"Water", // F1 help keyword for the toolbox item.
						resourceManager.GetString("WaterToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.Water.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.ComponentToConveyorToolboxItem":

					// Add ComponentToConveyor connector tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.ComponentToConveyorToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						13, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("ComponentToConveyorToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("ComponentToConveyorToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.				
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"ComponentToConveyor", // F1 help keyword for the toolbox item.
						resourceManager.GetString("ComponentToConveyorToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						null, // Connector toolbox items do not have an underlying data object.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
							new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require), 
							new global::System.ComponentModel.ToolboxItemFilterAttribute(ComponentToConveyorFilterString)
						});
					break;
				case "MDC.ProductionSystem.ConveyorToConveyorToolboxItem":

					// Add ConveyorToConveyor connector tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.ConveyorToConveyorToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						14, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("ConveyorToConveyorToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("ConveyorToConveyorToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.				
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"ConveyorToConveyor", // F1 help keyword for the toolbox item.
						resourceManager.GetString("ConveyorToConveyorToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						null, // Connector toolbox items do not have an underlying data object.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
							new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require), 
							new global::System.ComponentModel.ToolboxItemFilterAttribute(ConveyorToConveyorFilterString)
						});
					break;
				case "MDC.ProductionSystem.ConveyorToMachineToolboxItem":

					// Add ConveyorToMachine connector tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.ConveyorToMachineToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						15, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("ConveyorToMachineToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("ConveyorToMachineToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.				
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"ConveyorToMachine", // F1 help keyword for the toolbox item.
						resourceManager.GetString("ConveyorToMachineToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						null, // Connector toolbox items do not have an underlying data object.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
							new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require), 
							new global::System.ComponentModel.ToolboxItemFilterAttribute(ConveyorToMachineFilterString)
						});
					break;
				case "MDC.ProductionSystem.MachineToConveyorToolboxItem":

					// Add MachineToConveyor connector tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.MachineToConveyorToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						16, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("MachineToConveyorToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("MachineToConveyorToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.				
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"MachineToConveyor", // F1 help keyword for the toolbox item.
						resourceManager.GetString("MachineToConveyorToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						null, // Connector toolbox items do not have an underlying data object.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
							new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require), 
							new global::System.ComponentModel.ToolboxItemFilterAttribute(MachineToConveyorFilterString)
						});
					break;
				case "MDC.ProductionSystem.OperatorToMachineToolboxItem":

					// Add OperatorToMachine connector tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.OperatorToMachineToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						17, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("OperatorToMachineToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("OperatorToMachineToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.				
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"OperatorToMachine", // F1 help keyword for the toolbox item.
						resourceManager.GetString("OperatorToMachineToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						null, // Connector toolbox items do not have an underlying data object.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
							new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require), 
							new global::System.ComponentModel.ToolboxItemFilterAttribute(OperatorToMachineFilterString)
						});
					break;
				case "MDC.ProductionSystem.AssemblerToolboxItem":
					// Add Assembler shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.AssemblerToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						18, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("AssemblerToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("AssemblerToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"Assembler", // F1 help keyword for the toolbox item.
						resourceManager.GetString("AssemblerToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.Assembler.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.RepairBayToolboxItem":
					// Add RepairBay shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.RepairBayToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						19, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("RepairBayToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("RepairBayToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"RepairBay", // F1 help keyword for the toolbox item.
						resourceManager.GetString("RepairBayToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.RepairBay.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.QualityControlToolboxItem":
					// Add QualityControl shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.QualityControlToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						20, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("QualityControlToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("QualityControlToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"QualityControl", // F1 help keyword for the toolbox item.
						resourceManager.GetString("QualityControlToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.QualityControl.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				case "MDC.ProductionSystem.GarageToolboxItem":
					// Add Garage shape tool.
					result = new DslDesign::ModelingToolboxItem(
						"MDC.ProductionSystem.GarageToolboxItem", // Unique identifier (non-localized) for the toolbox item.
						21, // Position relative to other items in the same toolbox tab.
						resourceManager.GetString("GarageToolboxItem", resourceCulture), // Localized display name for the item.
						(global::System.Drawing.Bitmap)DslDiagrams::ImageHelper.GetImage(resourceManager.GetObject("GarageToolboxBitmap", resourceCulture)), // Image displayed next to the toolbox item.
						"MDC.ProductionSystem.ProductionSystemToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
						resourceManager.GetString("ProductionSystemToolboxTab", resourceCulture), // Localized display name for the toolbox tab.
						"Garage", // F1 help keyword for the toolbox item.
						resourceManager.GetString("GarageToolboxTooltip", resourceCulture), // Localized tooltip text for the toolbox item.
						CreateElementToolPrototype(store, global::MDC.ProductionSystem.Garage.DomainClassId), // ElementGroupPrototype (data object) representing model element on the toolbox.
						new global::System.ComponentModel.ToolboxItemFilterAttribute[] { // Collection of ToolboxItemFilterAttribute objects that determine visibility of the toolbox item.
						new global::System.ComponentModel.ToolboxItemFilterAttribute(ToolboxFilterString, global::System.ComponentModel.ToolboxItemFilterType.Require) 
						});
					break;
				default:
					break;
			} // end switch
			
			return result;
		}
		

		/// <summary>
		/// The store toe be used for all the toolbox item creation
		/// </summary>
		protected DslModeling::Store ToolboxStore
		{
			get
			{ 
				if (toolboxStore==null)
				{
					toolboxStore = new DslModeling::Store(this.ServiceProvider);
					EventHandler StoreCleanUp = (o, e) =>
					{
						//Since Store implements IDisposable, we need to dispose it when we're finished
						if (this.toolboxStore != null)
						{
							this.toolboxStore.Dispose();
						}
						this.toolboxStore = null;
					};
					//There is no DomainUnload event for the default AppDomain, so we listen for both ProcessExit and DomainUnload
					AppDomain.CurrentDomain.ProcessExit += new EventHandler(StoreCleanUp);
					AppDomain.CurrentDomain.DomainUnload += new EventHandler(StoreCleanUp);
					
					//load the domain model
					toolboxStore.LoadDomainModels(typeof(global::MDC.ProductionSystem.ProductionSystemDomainModel));
					
				}
				return toolboxStore;
			}
		}
		
		/// <summary>
		/// Given a toolbox item "unique ID" returns the the toolbox item using cached dictionary
		/// </summary>
		/// <param name="itemId">The unique ToolboxItem to retrieve</param>
		private DslDesign::ModelingToolboxItem GetToolboxItem(string itemId)
		{
			DslDesign::ModelingToolboxItem item = null;

			if (!this.toolboxItemCache.TryGetValue(itemId, out item))
			{
				DslModeling::Store store = this.ToolboxStore;
				
				// Open transaction so we can create model elements corresponding to toolbox items.
				using (DslModeling::Transaction t = store.TransactionManager.BeginTransaction("CreateToolboxItems"))
				{
					// Retrieve the specified ToolboxItem from the DSL
					this.toolboxItemCache[itemId] = item = this.GetToolboxItem(itemId, store);
				}
			}

			return item;
		}
		
		/// <summary>
		/// Given a toolbox item "unique ID" and a data format identifier, returns the content of
		/// the data format. 
		/// </summary>
		/// <param name="itemId">The unique ToolboxItem to retrieve data for</param>
		/// <param name="format">The desired format of the resulting data</param>
		public virtual object GetToolboxItemData(string itemId, DataFormats.Format format)
		{
			DslDesign::ModelingToolboxItem item = null;

			global::System.Resources.ResourceManager resourceManager = global::MDC.ProductionSystem.ProductionSystemDomainModel.SingletonResourceManager;
			global::System.Globalization.CultureInfo resourceCulture = global::System.Globalization.CultureInfo.CurrentUICulture;

			System.Windows.Forms.IDataObject tbxDataObj;

			//get the toolbox item
			item = GetToolboxItem(itemId);

			if (item != null)
			{
				ToolboxItemContainer container = new ToolboxItemContainer(item);
				tbxDataObj = container.ToolboxData;

				if (tbxDataObj.GetDataPresent(format.Name))
				{
					return tbxDataObj.GetData(format.Name);
				}
				else 
				{
					string invalidFormatString = resourceManager.GetString("UnsupportedToolboxFormat", resourceCulture);
					throw new InvalidOperationException(string.Format(resourceCulture, invalidFormatString, format.Name));
				}
			}

			string errorFormatString = resourceManager.GetString("UnresolvedToolboxItem", resourceCulture);
			throw new InvalidOperationException(string.Format(resourceCulture, errorFormatString, itemId));
		}		
	}
}
