private void btnGetMapKml_Click(object sender, EventArgs e) { var mapagent = _conn.GetCustomProperty("BaseUrl").ToString(); //NOXLATE mapagent += "mapagent/mapagent.fcgi?SESSION=" + _conn.SessionID + "&VERSION=1.0.0&OPERATION=GETMAPKML&DPI=96&MAPDEFINITION=" + _map.MapDefinition + "&FORMAT=KML&CLIENTAGENT=Maestro Local Map Previewer"; //NOXLATE _launcher.OpenUrl(mapagent); }
/// <summary> /// Previews the specified resource /// </summary> /// <param name="res">The resource to be previewed</param> /// <param name="edSvc">The editor service</param> /// <param name="locale">The locale to use if launching a viewer-based preview</param> public void Preview(IResource res, IEditorService edSvc, string locale) { //TODO: Prompt for symbol parameters if there are any, as these can affect the rendered output //and it is a nice way to test symbol parameters wrt to rendering IServerConnection conn = edSvc.CurrentConnection; BusyWaitDelegate worker = () => { //Save the current resource to another session copy string resId = "Session:" + edSvc.SessionID + "//" + res.ResourceType.ToString() + "Preview" + Guid.NewGuid() + "." + res.ResourceType.ToString(); //NOXLATE var resSvc = edSvc.CurrentConnection.ResourceService; resSvc.SaveResourceAs(res, resId); resSvc.CopyResource(res.ResourceID, resId, true); var previewCopy = resSvc.GetResource(resId); if (previewCopy.ResourceType == ResourceTypes.SymbolDefinition.ToString() && conn.SiteVersion >= new Version(2, 0)) { return(GenerateSymbolDefinitionPreview(conn, previewCopy, 100, 100)); } else { //Now feed it to the preview engine var url = new ResourcePreviewEngine(edSvc).GeneratePreviewUrl(previewCopy, locale); return(new UrlPreviewResult() { Url = url }); } }; Action <object, Exception> onComplete = (result, ex) => { if (ex != null) { ErrorDialog.Show(ex); } else { var urlResult = result as UrlPreviewResult; var imgResult = result as ImagePreviewResult; if (urlResult != null) { var url = urlResult.Url; _launcher.OpenUrl(url); } else if (imgResult != null) { new SymbolPreviewDialog(imgResult.ImagePreview).Show(null); } } }; BusyWaitDialog.Run(Strings.PrgPreparingResourcePreview, worker, onComplete); }
public override void OpenUrl(string url) { _launcher.OpenUrl(url); }