public override void Run() { WebReferenceNode node = Owner as WebReferenceNode; if (node != null && node.Project != null && node.ProjectItem != null) { WebReferenceUrl url = (WebReferenceUrl)node.ProjectItem; try { // Discover web services at url. DiscoveryClientProtocol protocol = DiscoverWebServices(url.UpdateFromURL); if (protocol != null) { // Save web services. WebReference webReference = new WebReference(url.Project, url.UpdateFromURL, node.Text, url.Namespace, protocol); webReference.Save(); // Update project. WebReferenceChanges changes = webReference.GetChanges(url.Project); if (changes.Changed) { foreach (ProjectItem itemRemoved in changes.ItemsRemoved) { ProjectService.RemoveProjectItem(url.Project, itemRemoved); FileService.RemoveFile(itemRemoved.FileName, false); } foreach (ProjectItem newItem in changes.NewItems) { ProjectService.AddProjectItem(url.Project, newItem); FileNode fileNode = new FileNode(newItem.FileName, FileNodeStatus.InProject); fileNode.InsertSorted(node); } ProjectBrowserPad.Instance.ProjectBrowserControl.TreeView.Sort(); url.Project.Save(); } // Update code completion. SD.ParserService.ParseFileAsync(FileName.Create(webReference.WebProxyFileName), parentProject: url.Project).FireAndForget(); } } catch (WebException ex) { LoggingService.Debug(ex); MessageService.ShowError(GetRefreshWebReferenceErrorMessage(ex, url.UpdateFromURL)); } } }
public override void Run() { WebReferenceNode node = Owner as WebReferenceNode; if (node != null && node.Project != null && node.ProjectItem != null) { WebReferenceUrl url = (WebReferenceUrl)node.ProjectItem; try { // Discover web services at url. DiscoveryClientProtocol protocol = DiscoverWebServices(url.UpdateFromURL); if (protocol != null) { // Save web services. WebReference webReference = new WebReference(url.Project, url.UpdateFromURL, node.Text, url.Namespace, protocol); webReference.Save(); // Update project. WebReferenceChanges changes = webReference.GetChanges(url.Project); if (changes.Changed) { foreach (ProjectItem itemRemoved in changes.ItemsRemoved) { ProjectService.RemoveProjectItem(url.Project, itemRemoved); FileService.RemoveFile(itemRemoved.FileName, false); } foreach (ProjectItem newItem in changes.NewItems) { ProjectService.AddProjectItem(url.Project, newItem); FileNode fileNode = new FileNode(newItem.FileName, FileNodeStatus.InProject); fileNode.InsertSorted(node); } ProjectBrowserPad.Instance.ProjectBrowserControl.TreeView.Sort(); url.Project.Save(); } // Update code completion. ParserService.ParseFile(webReference.WebProxyFileName); } } catch (WebException ex) { MessageService.ShowError(ex, String.Format(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ProjectBrowser.RefreshWebReference.ReadServiceDescriptionError}"), url.UpdateFromURL)); } } }