internal void SetStaticData(DalConfig config)
		{
			// this is called after all components of this control are initialized, so it is safe to populate all data
			_dalConfig = config;

			PopulateFormFields();
		}
		public ModelDesigner(Dictionary<string, string> connectionStrings, DalConfig config)
		{
			_connectionStrings = connectionStrings;
			_config = config;

			InitializeComponent();

			CustomizeComponent();

			WireUpEventHandlers();
		}
		private void Edit_Click(object sender, EventArgs e)
		{
			var modelDesignerDialog = new ModelDesigner(_connectionStrings, Config);
			var dialogResult = modelDesignerDialog.ShowDialog();
			if (dialogResult == DialogResult.OK)
			{
				Config = modelDesignerDialog.Config;
				var connectionStringName = modelDesignerDialog.ConnectionStringName;
				if (!_connectionStrings.ContainsKey(connectionStringName))
				{
					_connectionStrings.Add(connectionStringName, modelDesignerDialog.ConnectionString);
					//AddConnectionStringToProject(_connectionStringName, _modelDesignerDialog.ConnectionString);
				}
			}

			InitControls();
		}
		public void Init(DalConfig config, string fileName, SimpleDataAccessLayer_vs2013Package package)
		{
			_connectionStrings = InitializeConectionStringsCollection(package, fileName);
			_package = package;
			Config = config;
			_fileName = fileName;

			if (config == null)
			{
				HandleInvalidFileFormat();
			}
			else
			{
				InitControls();
			}
		}
		/// <summary>
		/// Loads the file content into the textbox
		/// </summary>
		/// <param name="pszFilename">Pointer to the full path name of the file to load</param>
		/// <param name="grfMode">file format mode</param>
		/// <param name="fReadOnly">determines if the file should be opened as read only</param>
		/// <returns>S_OK if the method succeeds</returns>
		int IPersistFileFormat.Load(string pszFilename, uint grfMode, int fReadOnly)
		{
			if (pszFilename == null)
			{
				return VSConstants.E_INVALIDARG;
			}

			_loading = true;
		    try
			{
				// Show the wait cursor while loading the file
				var vsUiShell = (IVsUIShell)GetService(typeof(SVsUIShell));
			    int hr;
			    if (vsUiShell != null)
				{
					// Note: we don't want to throw or exit if this call fails, so
					// don't check the return code.
					hr = vsUiShell.SetWaitCursor();
				}

				DalConfig config = null;
				try
				{
					var ser = new DataContractSerializer(typeof(DalConfig));
					config = (DalConfig)ser.ReadObject(XmlReader.Create(pszFilename));
				}
				catch
				{
					config = new DalConfig()
					{
						ApplicationConnectionString = "",
						DesignerConnection = new DesignerConnection() { Authentication = new WindowsAuthentication() },
						Enums = new List<Enum>(),
						Namespace = "",
						Procedures = new List<Procedure>()
					};
				}
				finally
				{
					_editorControl.Init(config, pszFilename, _myPackage);
				}

				_isDirty = false;

				//Determine if the file is read only on the file system
				var fileAttrs = File.GetAttributes(pszFilename);

				var isReadOnly = (int)fileAttrs & (int)FileAttributes.ReadOnly;

				//Set readonly if either the file is readonly for the user or on the file system
				if (0 == isReadOnly && 0 == fReadOnly)
					SetReadOnly(false);
				else
					SetReadOnly(true);


				// Notify to the property window that some of the selected objects are changed
				var track = TrackSelection;
				if (null != track)
				{
					hr = track.OnSelectChange(_selContainer);
					if (ErrorHandler.Failed(hr))
						return hr;
				}

				// Hook up to file change notifications
				if (String.IsNullOrEmpty(_fileName) || 0 != String.Compare(_fileName, pszFilename, true, CultureInfo.CurrentCulture))
				{
					_fileName = pszFilename;
					SetFileChangeNotification(pszFilename, true);

					// Notify the load or reload
					NotifyDocChanged();
				}
			}
			finally
			{
				_loading = false;
			}
			return VSConstants.S_OK;
		}
		internal void SetStaticData (DalConfig dalConfig)
		{
			_dalConfig = dalConfig;
			PrepareConfigEnumsCollection();
		}
		private void finishButton_Click(object sender, EventArgs e)
		{
			var config = new DalConfig()
			{
				ApplicationConnectionString = appConnectionTab.ConnectionStringName,
				DesignerConnection = new DesignerConnection()
				{
					Authentication = designerInformationTab.WindowsAuthentication ? new WindowsAuthentication() : new SqlAuthentication(designerInformationTab.Username, designerInformationTab.Password) as Authentication
				},
				Namespace = designerInformationTab.Namespace,
				Enums = enumsTab.SelectedEnums,
				Procedures = proceduresTab.SelectedProcedures
			};

			_config = config;
		}
		internal void SetStaticData(DalConfig dalConfig)
		{
			_dalConfig = dalConfig;
			PrepareConfigProceduresCollection();
		}
	    /// <summary>
	    /// Sets the initial data - existing connection strings and current config
	    /// </summary>
	    /// <param name="connectionStrings"></param>
	    /// <param name="config"></param>
	    internal void SetStaticData (Dictionary<string, string> connectionStrings, DalConfig config)
		{
			// this is called after all components of this control are initialized, so it is safe to populate all data
			_connectionStrings = connectionStrings;
			_dalConfig = config;

			PopulateFormFields();
		}