/// <summary> /// Renders control to String representation /// </summary> /// <param name="siteID">This SiteID is used in report query instead of default CMSContext one</param> public String RenderToString(int siteID) { // Change siteID from context to subscription id AllParameters.Add("CMSContextCurrentSiteID", siteID); // Reload data isSave = true; ReloadData(true); isSave = false; // If control is not visible - subscription (report's or all items) is not allowed or no data found if (!Visible) { return(String.Empty); } // Render to string StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); Html32TextWriter writer2 = new Html32TextWriter(sw); pnlContent.RenderControl(writer2); return(sb.ToString()); }
private void AddParameter(MemberInfo info, Type parameterType, ParameterAttribute paramAttribute) { var paramInfo = new CommandParameterInfo(info, parameterType, paramAttribute); if (!NamedParameters.ContainsKey(paramInfo.Name)) { NamedParameters[paramInfo.Name] = paramInfo; } AllParameters.Add(paramInfo); }
static void BuildExpressionParameters(List<MenuAction> sourceActions) { //Find all unique menu parameters AllParameters.Clear(); foreach (var action in sourceActions) { var param = GenerateParameter(action); if (param != null && IsNewParameter(param)) AllParameters.Add(param); param = GenerateParameterIsOpen(action); if(param != null && IsNewParameter(param)) AllParameters.Add(param); } bool IsNewParameter(ExpressionParameters.Parameter param) { foreach (var item in AllParameters) { if (string.IsNullOrEmpty(item.name)) continue; if (item.name == param.name) { if (item.valueType == param.valueType) return false; else { BuildFailed = true; EditorUtility.DisplayDialog("Build Error", $"Unable to build VRCExpressionParameters. Parameter named '{item.name}' is used twice but with different types.", "Okay"); return false; } } } return true; } //Add foreach(var param in AllParameters) DefineExpressionParameter(param); }