示例#1
0
        private void RemoveToolBoxItems()
        {
            EnvDTE.DTE dte = null;

            dte = LoadDTE();              // load the root object of VS.NET
            if (dte == null)
            {
                return;
            }

            try
            {
                EnvDTE.ToolBoxTab dataTab = FindDataTab(dte);;
                if (dataTab == null)
                {
                    return;
                }

                // only delete Ingres toolbox tabs, don't delete "Data" tab
                if (dataTab.Name == "Advantage Ingres" ||
                    dataTab.Name == "Ingres")
                {
                    System.Windows.Forms.MessageBox.Show(
                        "Deleted toolbox tab " + dataTab.Name, "Debugging");
                    dataTab.Delete();
                    return;
                }

                dataTab.Activate();

                RemoveItemFromTab(dataTab, "IngresDataAdapter");
                RemoveItemFromTab(dataTab, "IngresConnection");
                RemoveItemFromTab(dataTab, "IngresCommand");
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(
                    "RemoveToolBoxItems threw Exception" +
                    ex.ToString() + ".  Exiting...", "Debugging");
            }
            finally
            {
                try
                {
                    if (dte != null)
                    {
                        dte.Quit();                          // shut down the IDE
                        System.Windows.Forms.MessageBox.Show(
                            "EnvDTE Quit complete", "Debugging");
                    }
                }
                catch (Exception) {}
            }
        }          // RemoveToolBoxItems
示例#2
0
        private void AddToolBoxItems()
        {
            EnvDTE.DTE dte = null;

            object oInstallPath = Context.Parameters["InstallPath"];

            if (oInstallPath == null)
            {
                System.Windows.Forms.MessageBox.Show(
                    "InstallPath is null.  Exiting...", "Debugging");
                return;
            }
            string installPath = (string)oInstallPath;
            string dllPath     =
                System.IO.Path.Combine(installPath, "Ingres.Client.dll");

            System.Windows.Forms.MessageBox.Show(
                "dllPath is \"" + dllPath + "\"", "Debugging");


            dte = LoadDTE();              // load the root object of VS.NET
            if (dte == null)
            {
                return;
            }

            try
            {
                EnvDTE.ToolBoxTab dataTab = FindDataTab(dte);;
                if (dataTab == null)
                {
                    dataTab = AddDataTab(dte);
                }
//					return;

                dataTab.Activate();

                RemoveItemFromTab(dataTab, "IngresDataAdapter");
                RemoveItemFromTab(dataTab, "IngresConnection");
                RemoveItemFromTab(dataTab, "IngresCommand");

                AddItemToTab(dataTab, "IngresCommand", dllPath);
                AddItemToTab(dataTab, "IngresConnection", dllPath);
                AddItemToTab(dataTab, "IngresDataAdapter", dllPath);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(
                    "Ingres .NET Data Provider " +
                    "Install.AddToolBoxItems threw Exception" +
                    ex.ToString() + ".  Continuing...",
                    "Ingres .NET Data Provider Install");
            }
            finally
            {
                try
                {
                    if (dte != null)
                    {
                        dte.Quit();                          // shut down the IDE
                        System.Windows.Forms.MessageBox.Show(
                            "EnvDTE Quit complete", "Debugging");
                    }
                }
                catch (Exception) {}
            }
        }          // AddToolBoxItems