WCF.ClientOptions CreateClientOptions ()
		{
			var options = new WCF.ClientOptions ();
			var dialog = new ConfigurationDialog (options);

			try {
				if (MessageService.RunCustomDialog (dialog) != (int)Gtk.ResponseType.Ok)
					return null;
				return options;
			} catch (Exception exception) {
				MessageService.ShowException (exception);
				return null;
			} finally {
				dialog.Destroy ();
			}
		}
		public void Configure ()
		{
			var item = (WebReferenceItem) CurrentNode.DataItem;

			if (!ConfigurationDialog.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 ConfigurationDialog (options);

			try {
				if (MessageService.RunCustomDialog (dialog) != (int)Gtk.ResponseType.Ok)
					return;
				if (!dialog.Modified)
					return;

				refgroup.Save (item.MapFile.FilePath);
				UpdateReferences (new [] { item });
			} catch (Exception exception) {
				MessageService.ShowException (exception);
			} finally {
				dialog.Destroy ();
			}
		}