public override void Run()
        {
            AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.SelectedNode;

            if (node != null && node.Project != null)
            {
                using (AddWebReferenceDialog refDialog = new AddWebReferenceDialog(node.Project)) {
                    refDialog.NamespacePrefix = node.Project.RootNamespace;
                    if (refDialog.ShowDialog() == DialogResult.OK)
                    {
                        // Do not overwrite existing web references.
                        refDialog.WebReference.Name = WebReference.GetReferenceName(refDialog.WebReference.WebReferencesDirectory, refDialog.WebReference.Name);
                        refDialog.WebReference.Save();

                        foreach (ProjectItem item in refDialog.WebReference.Items)
                        {
                            ProjectService.AddProjectItem(node.Project, item);
                        }

                        AddWebReferenceToProjectBrowser(node, refDialog.WebReference);

                        // Add proxy to code completion.
                        ParserService.ParseFile(refDialog.WebReference.WebProxyFileName);

                        node.Project.Save();
                    }
                }
            }
        }
Пример #2
0
        void _winProjExplorer_AddWebRefrenceItem(object sender, EventArgs e)
        {
            TreeNode         t     = (TreeNode)sender;
            StringCollection files = new StringCollection();

            foreach (string Name in Parser.ProjectParser.ProjectFiles.Keys)
            {
                files.Add(Name);
            }
            using (AddWebReferenceDialog refDialog = new AddWebReferenceDialog(m_AIMSProject, _scriptLanguage, files))
            {
                refDialog.NamespacePrefix = m_AIMSProject.RootNamespace;
                if (refDialog.ShowDialog() == DialogResult.OK)
                {
                    // Do not overwrite existing web references.
                    refDialog.WebReference.Name = WebReference.GetReferenceName(refDialog.WebReference.WebReferencesDirectory, refDialog.WebReference.Name);
                    AddWebRefrenceToProject(t, refDialog.WebReference, refDialog.WebReferenceFileName);
                }
            }
        }