private Dictionary<string, string> InitializeConectionStringsCollection(SimpleDataAccessLayer_vs2013Package package, string fileName) { Project project = package.GetEnvDTE().Solution.FindProjectItem(fileName).ContainingProject; var configurationFilename = (from ProjectItem item in project.ProjectItems where Regex.IsMatch(item.Name, "(app|web).config", RegexOptions.IgnoreCase) select item.FileNames[0]).FirstOrDefault(); // examine each project item's filename looking for app.config or web.config var returnValue = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(configurationFilename)) { // found it, map it and expose salient members as properties var configFile = new ExeConfigurationFileMap {ExeConfigFilename = configurationFilename}; var configuration = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(configFile, ConfigurationUserLevel.None); foreach (ConnectionStringSettings connStringSettings in configuration.ConnectionStrings.ConnectionStrings) { returnValue.Add(connStringSettings.Name, connStringSettings.ConnectionString); } } return returnValue; }
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> /// Constructor that calls the Microsoft.VisualStudio.Shell.WindowPane constructor then /// our initialization functions. /// </summary> /// <param name="package">Our Package instance.</param> public EditorPane(SimpleDataAccessLayer_vs2013Package package) : base(null) { PrivateInit(package); }
/// <summary> /// Initialization routine for the Editor. Loads the list of properties for the dal document /// which will show up in the properties window /// </summary> /// <param name="package"></param> private void PrivateInit(SimpleDataAccessLayer_vs2013Package package) { _myPackage = package; _loading = false; _gettingCheckoutStatus = false; _trackSel = null; Control.CheckForIllegalCrossThreadCalls = false; // Create an ArrayList to store the objects that can be selected var listObjects = new ArrayList(); // Create the object that will show the document's properties // on the properties window. var prop = new EditorProperties(this); listObjects.Add(prop); // Create the SelectionContainer object. _selContainer = new SelectionContainer(true, false) { SelectableObjects = listObjects, SelectedObjects = listObjects }; // Create and initialize the editor var resources = new ComponentResourceManager(typeof(EditorPane)); _editorControl = new MyEditor(); //resources.ApplyResources(_editorControl, "editorControl", CultureInfo.CurrentUICulture); // Handle Focus event // I should override this one //this.editorControl.RichTextBoxControl.GotFocus += new EventHandler(this.OnGotFocus); // Call the helper function that will do all of the command setup work // -- no commands here // setupCommands(); }
public EditorFactory(SimpleDataAccessLayer_vs2013Package package) { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering {0} constructor", ToString())); _editorPackage = package; }