public void SetAsCurrentResultView(Guid nodeId) { if (_PipelineInstance == null) { return; } Evaluation.IMultiFileContent result = null; using (var evaluator = _PipelineInstance.CreateEvaluator()) { result = evaluator.PreviewNode(nodeId).PreviewResult; } PreviewManager.ShowPreview(result); }
public static void ShowPreview(Evaluation.IMultiFileContent result) { if (result == null) { return; } var dirPath = _GetDocumentPreviewDirectory(); // copy all the contents to the temp directory foreach (var f in result.Content) { var ff = System.IO.Path.Combine(dirPath, f.Key); System.IO.File.WriteAllBytes(ff, f.Value); } var fileName = System.IO.Path.Combine(dirPath, result.FileName); try { var pinfo = new System.Diagnostics.ProcessStartInfo(fileName); // setup verb var verbIndex = pinfo.Verbs.IndexOf(item => item.ToLower() == "open"); if (verbIndex >= 0) { pinfo.Verb = pinfo.Verbs[verbIndex]; } // run using (var process = System.Diagnostics.Process.Start(pinfo)) { _OpenDocuments[System.IO.Path.GetFileName(dirPath)] = process == null ? 0 : process.Id; } } catch (ObjectDisposedException) { } catch (InvalidOperationException) { } catch (ArgumentNullException) { } catch (System.IO.FileNotFoundException) { } catch (System.ComponentModel.Win32Exception) { } }