/// <summary> /// Update render mode text to match current render mode. /// </summary> private void UpdateStatusText() { if (_renderModeText != null) { _renderModeText.text = string.Format("Render Mode: {0}", _renderType.ToString()); } }
public string GetRenderType() { if (_renderType == RenderType.Custom) { return(_renderTypeCustom); } else { return(_renderType.ToString()); } }
private static string DefaultScriptBuilder(ChartOptions chartOptions, RenderType renderType, params string[] aditionalScriptData) { const string themeApi = @"var highchartsOptions = Highcharts.setOptions(themes['{0}']);"; chartOptions.Appearance.renderTo = "chart" + chartOptions.ClientId; chartOptions.Appearance.defaultSeriesType = renderType.ToString(); var scriptBuilder = new StringBuilder(); scriptBuilder.Append("var chart"); scriptBuilder.Append(chartOptions.ClientId); scriptBuilder.AppendLine(";"); scriptBuilder.AppendLine("$(document).ready(function() {"); scriptBuilder.AppendLine(chartOptions.Lang.ToString()); scriptBuilder.Append("chart"); scriptBuilder.Append(chartOptions.ClientId); scriptBuilder.AppendLine(" = new Highcharts.Chart({"); aditionalScriptData.ToList().ForEach(ad => scriptBuilder.AppendLine(ad)); scriptBuilder.AppendLine(chartOptions.Appearance != null ? chartOptions.Appearance.ToString() : string.Empty); scriptBuilder.AppendLine(chartOptions.Colors != null ? chartOptions.Colors.ToString() : string.Empty); scriptBuilder.AppendLine("credits: { enabled: "); scriptBuilder.Append(chartOptions.ShowCredits.ToString(CultureInfo.InvariantCulture).ToLower()); scriptBuilder.Append("},"); scriptBuilder.AppendLine(chartOptions.PlotOptions != null ? chartOptions.PlotOptions.ToString() : string.Empty); scriptBuilder.AppendLine(chartOptions.Title != null ? chartOptions.Title.ToString() : string.Empty); scriptBuilder.AppendLine(chartOptions.SubTitle != null ? chartOptions.SubTitle.ToString() : string.Empty); scriptBuilder.AppendLine(chartOptions.Legend != null ? chartOptions.Legend.ToString() : string.Empty); scriptBuilder.AppendLine(chartOptions.Exporting.ToString()); scriptBuilder.AppendLine(chartOptions.XAxis.ToString()); scriptBuilder.AppendLine(chartOptions.YAxis.ToString()); scriptBuilder.AppendLine(chartOptions.Tooltip.ToString()); scriptBuilder.AppendLine(chartOptions.Series.ToString()); scriptBuilder.AppendLine("});"); scriptBuilder.AppendLine(chartOptions.AjaxDataSource.ToString()); scriptBuilder.AppendLine("});"); var reg = new System.Text.RegularExpressions.Regex(@"\""(function\(event\)\{.*?\})\""", System.Text.RegularExpressions.RegexOptions.Multiline); var script = reg.Replace(scriptBuilder.ToString(), "$1"); return(string.IsNullOrEmpty(chartOptions.Theme) ? script : string.Concat(string.Format(themeApi, chartOptions.Theme), script)); }
/// <summary> /// Execute report result /// </summary> /// <param name="renderType">renderType</param> /// <param name="parameters"> request parameters</param> /// <param name="pageIndex">page index</param> /// <param name="findString">find string</param> public ReportResult Execute(RenderType renderType, int pageIndex = 1, Dictionary <string, string> parameters = null, string findString = "") { if (pageIndex < 1) { pageIndex = 1; } if (parameters != null) { foreach (var kv in parameters) { this.localReport.SetParameters(new ReportParameter(kv.Key, kv.Value)); } } var xml = JsonConvert.DeserializeXNode(JsonConvert.SerializeObject(new { Section = pageIndex, FindString = findString }), "DeviceInfo"); var deviceInfo = xml.ToString(System.Xml.Linq.SaveOptions.DisableFormatting); this.localReport.PageIndex = pageIndex; if (renderType == RenderType.Rpl) { string _deviceInfo = string.Format(CultureInfo.InvariantCulture, "<DeviceInfo><StartPage>{0}</StartPage><EndPage>{1}</EndPage><ToggleItems>{2}</ToggleItems><MeasureItems>{3}</MeasureItems><SecondaryStreams>{4}</SecondaryStreams><StreamNames>{5}</StreamNames><StreamRoot>{6}</StreamRoot><RPLVersion>{7}</RPLVersion><ImageConsolidation>{8}</ImageConsolidation></DeviceInfo>", new object[] { pageIndex, pageIndex, false, false, "Server", true, true, "", "10.6", true }); var stream = this.RenderStream(_deviceInfo, out Encoding encoding, out string mimeType, out string fileNameExtensions); var bytes = new byte[0]; if (stream != null && stream.Length > 0L) { stream.Seek(0, SeekOrigin.Begin); bytes = new byte[stream.Length]; stream.Read(bytes, 0, bytes.Length); } return(new ReportResult { MainStream = new ReportStream(bytes) { Encoding = encoding, Extension = fileNameExtensions, MimeType = mimeType }, TotalPages = localReport.GetTotalPages(), PageIndex = pageIndex, }); } else { var bytes = this.localReport.Render(renderType.ToString(), deviceInfo, PageCountMode.Actual, out string mimeType , out Encoding encoding, out string fileNameExtension, out string[] streams, out Warning[] warnings);
public override string ToString() { switch (m_specialTag) { case TemplateSpecialTags.RenderType: return(TagName + IOUtils.VALUE_SEPARATOR + (RenderType != RenderType.Custom? RenderType.ToString(): TagValue) + IOUtils.VALUE_SEPARATOR + m_specialTag); case TemplateSpecialTags.Queue: return(TagName + IOUtils.VALUE_SEPARATOR + m_renderQueue.ToString() + IOUtils.VALUE_SEPARATOR + m_specialTag + IOUtils.VALUE_SEPARATOR + m_renderQueueOffset); } return(TagName + IOUtils.VALUE_SEPARATOR + TagValue); }
public void Draw(UndoParentNode owner, ref List <CustomTagData> currentTags) { if (m_isLocked) { return; } if (m_reanalyzeTags) { if ((EditorApplication.timeSinceStartup - m_timeSinceReanalyzeCheck) > ReanalizeTreshold) { m_reanalyzeTags = false; AnalyzeTags(ref currentTags, true); } } EditorGUI.BeginChangeCheck(); m_enable = owner.EditorGUILayoutToggle(EnableStr, m_enable); if (EditorGUI.EndChangeCheck()) { if (m_enable) { AnalyzeTags(ref currentTags, true); } } bool guiEnabled = GUI.enabled; GUI.enabled = m_enable; EditorGUI.BeginChangeCheck(); m_currentRenderType = (RenderType)owner.EditorGUILayoutEnumPopup(RenderTypeStr, m_currentRenderType); if (EditorGUI.EndChangeCheck()) { currentTags[m_renderTypeIndex].TagValue = m_currentRenderType.ToString(); } EditorGUI.BeginChangeCheck(); m_currentRenderQueue = (RenderQueue)owner.EditorGUILayoutEnumPopup(RenderQueueStr, m_currentRenderQueue); if (EditorGUI.EndChangeCheck()) { currentTags[m_renderQueueIndex].TagValue = m_currentRenderQueue.ToString(); } GUI.enabled = guiEnabled; }
/// <summary> /// Imprimi o relatório. /// </summary> /// <param name="report">Relatório a ser impresso.</param> /// <param name="frame">Frame onde será exibido a imporessão.</param> public static void Download(LocalReport report, HtmlIframe frame, RenderType renderType) { string extension = string.Empty; string mimeType = string.Empty; Warning[] warnings; string[] streamids; string encoding; switch (renderType) { case RenderType.PDF: extension = "pdf"; mimeType = "application/pdf"; break; case RenderType.Excel: extension = "xls"; mimeType = "application/vnd.excel"; break; case RenderType.Image: extension = "emf"; mimeType = "application/image"; break; default: throw new Exception("Unrecognized type: " + renderType + ". Type must be PDF, Excel or Image."); } byte[] bytes = report.Render(renderType.ToString(), null, out mimeType, out encoding, out extension, out streamids, out warnings); CacheHelper.AddToUser <string>("PDF_TO_PRINT_EXTENSION", extension, 1); CacheHelper.AddToUser <string>("PDF_TO_PRINT_MIMETYPE", "application/octet-stream", 1); CacheHelper.AddToUser <byte[]>("PDF_TO_PRINT", bytes, 1); frame.Attributes["src"] = VirtualPathUtility.ToAbsolute("~/") + "PDFViewer.aspx"; }
/// <summary> /// Load the viewer with an specific render type /// </summary> public string Load(string report, RenderType renderType) { //read the report stream string contents = null; //read the report stream from an embedded resource or an external file System.IO.Stream stream = null; if (EmbeddedReportFiles) { stream = Assembly.GetCallingAssembly().GetManifestResourceStream(report); } else { stream = File.OpenRead(report); } using (StreamReader reader = new StreamReader(stream)) contents = reader.ReadToEnd(); //load the parameters into the viewer reportViewer.Parameters = parameters.GetReportStringParameters(); //load the report contents into the report viewer reportViewer.SourceRdl = contents; try { //reload the data objects into the report viewer for (int i = 0; i < datas.GetCount(); i++) { reportViewer.Report.DataSets[datas.GetReportViewerData(i).DataName].SetData( datas.GetReportViewerData(i).Data); } //refresh the report reportViewer.Rebuild(); //unique identifier for the file name string fileName = Guid.NewGuid().ToString(); //render the document reportViewer.SaveAs(string.Format(@"{0}\{1}.pdf", reportFolder, fileName), renderType.ToString()); //return the saved file return(string.Format("{0}.pdf", fileName)); } catch (NullReferenceException ex) { throw new Exception(string.Format("Could not load the report !\r\n{0}", ex.Message)); } catch (ArgumentException) { //can not pass the report argument because the report viewer could not reload the data //because there is an error in the report definition, so te report it self will print the error } return(null); }
/// <summary> /// Load the viewer with an specific render type /// </summary> public string Load(string report, RenderType renderType) { //read the report stream string contents = null; //read the report stream from an embedded resource or an external file System.IO.Stream stream = null; if (EmbeddedReportFiles) stream = Assembly.GetCallingAssembly().GetManifestResourceStream(report); else stream = File.OpenRead(report); using (StreamReader reader = new StreamReader(stream)) contents = reader.ReadToEnd(); //load the parameters into the viewer reportViewer.Parameters = parameters.GetReportStringParameters(); //load the report contents into the report viewer reportViewer.SourceRdl = contents; try { //reload the data objects into the report viewer for (int i = 0; i < datas.GetCount(); i++) reportViewer.Report.DataSets[datas.GetReportViewerData(i).DataName].SetData( datas.GetReportViewerData(i).Data); //refresh the report reportViewer.Rebuild(); //unique identifier for the file name string fileName = Guid.NewGuid().ToString(); //render the document reportViewer.SaveAs(string.Format(@"{0}\{1}.pdf", reportFolder, fileName), renderType.ToString()); //return the saved file return string.Format("{0}.pdf", fileName); } catch (NullReferenceException ex) { throw new Exception(string.Format("Could not load the report !\r\n{0}", ex.Message)); } catch (ArgumentException) { //can not pass the report argument because the report viewer could not reload the data //because there is an error in the report definition, so te report it self will print the error } return null; }
public static string Name(this RenderType value) { DescriptionAttribute[] da = (DescriptionAttribute[])(value.GetType().GetField(value.ToString())).GetCustomAttributes(typeof(DescriptionAttribute), false); return(da.Length > 0 ? da[0].Description : value.ToString()); }
protected virtual void Include(RenderType key, string bundleName) { _logger.LogVerbose("Include called with parameters: {0} {1}", key.ToString(), bundleName); if (!_toBeRendered.ContainsKey(key)) { _logger.LogDebug(" first time adding of type {0}", key.ToString()); var list = new List<string>(); _toBeRendered.Add(key, list); } if (!_toBeRendered[key].Contains(bundleName)) { _toBeRendered[key].Add(bundleName); _logger.LogVerbose("Include added {0} to key {0}", bundleName, key.ToString()); } else { _logger.LogInformation("Include was already added {0} to key {0}", bundleName, key.ToString()); } }
protected virtual HtmlString Render(RenderType key) { _logger.LogVerbose("Render called with option {0}", key.ToString()); var sb = new StringBuilder(); if (_toBeRendered.ContainsKey(key)) { // go through the order of bundles within the config file foreach (var bundle in GetOrderList()) { _logger.LogVerbose(" trying bundle {0}", bundle); if (_toBeRendered[key].Contains(bundle.ToString())) { _logger.LogVerbose(" rendering {0}", bundle); var html = GetHtmlInclude(bundle, key); if (html != null) { sb.AppendLine(html); } } } } else { _logger.LogDebug(" no bundle data contained"); } _logger.LogVerbose("Render outputs: {0}", sb.ToString()); return new HtmlString(sb.ToString()); }
public override string ToString() { return($"{ Key } (Type: { m_Type.ToString() }, Distance: { m_Distance }, Bias: { m_Bias })"); }
// Start is called before the first frame update void Start() { Debug.Log(renderType.ToString()); Camera.main.SetReplacementShader(shader, "RenderType"); }
public string GenerateTag() { switch (m_specialTag) { case TemplateSpecialTags.RenderType: return(string.Format(TagFormat, TagName, (RenderType != RenderType.Custom ? RenderType.ToString() : TagValue))); case TemplateSpecialTags.DisableBatching: case TemplateSpecialTags.Queue: case TemplateSpecialTags.None: default: return(string.Format(TagFormat, TagName, TagValue)); } }