public async void NewWebReference() { // Get the project and project folder var project = CurrentNode.GetParentDataItem (typeof(DotNetProject), true) as DotNetProject; // Check and switch the runtime environment for the current project if (project.TargetFramework.Id == TargetFrameworkMoniker.NET_1_1) { string question = "The current runtime environment for your project is set to version 1.0."; question += "Web Service is not supported in this version."; question += "Do you want switch the runtime environment for this project version 2.0 ?"; var switchButton = new AlertButton ("_Switch to .NET2"); if (MessageService.AskQuestion(question, AlertButton.Cancel, switchButton) == switchButton) project.TargetFramework = Runtime.SystemAssemblyService.GetTargetFramework (TargetFrameworkMoniker.NET_2_0); else return; } var dialog = new WebReferenceDialog (project); dialog.NamespacePrefix = project.DefaultNamespace; try { if (MessageService.RunCustomDialog (dialog) != (int)Gtk.ResponseType.Ok) return; await dialog.SelectedService.GenerateFiles (project, dialog.Namespace, dialog.ReferenceName); await IdeApp.ProjectOperations.SaveAsync(project); } catch (Exception exception) { MessageService.ShowError ("The web reference could not be added", exception); } finally { dialog.Destroy (); dialog.Dispose (); } }
public async void Configure () { var item = (WebReferenceItem) CurrentNode.DataItem; if (!WCFConfigWidget.IsSupported (item)) return; WCF.ReferenceGroup refgroup; WCF.ClientOptions options; try { refgroup = WCF.ReferenceGroup.Read (item.MapFile.FilePath); if (refgroup == null || refgroup.ClientOptions == null) return; options = refgroup.ClientOptions; } catch { return; } var dialog = new WebReferenceDialog (item, options); try { if (MessageService.RunCustomDialog (dialog) != (int)Gtk.ResponseType.Ok) return; if (!dialog.Modified) return; refgroup.Save (item.MapFile.FilePath); await UpdateReferences (new [] { item }); } catch (Exception exception) { LoggingService.LogInternalError (exception); } finally { dialog.Destroy (); dialog.Dispose (); } }