/// <summary> /// Loads all controls from given directory and its subdirectories. /// </summary> /// <param name="structureVirtualPath">The structure virtual path.</param> /// <returns></returns> public static WorkspaceTemplateInfo[] Load(string structureVirtualPath) { List <WorkspaceTemplateInfo> list = new List <WorkspaceTemplateInfo>(); string structurePath = HostingEnvironment.MapPath(structureVirtualPath); IList <Mediachase.Ibn.Web.UI.WebControls.FileResolverItem> files = Mediachase.Ibn.Web.UI.WebControls.FileResolver.GetFilesSingleSelector(structurePath, ControlsDir + Path.DirectorySeparatorChar + "Configs", "*.xml", new string[] { }); foreach (Mediachase.Ibn.Web.UI.WebControls.FileResolverItem file in files) { string controlDir = Path.GetDirectoryName(file.FilePath); if (!String.IsNullOrEmpty(controlDir)) { string configsDir = Path.DirectorySeparatorChar + ConfigDir; string tempControlDirString = controlDir.EndsWith(Convert.ToString(Path.DirectorySeparatorChar)) ? controlDir.Substring(0, controlDir.Length - 1) : controlDir; if (controlDir.EndsWith(configsDir, true, CultureInfo.InvariantCulture)) { controlDir = controlDir.Substring(0, controlDir.LastIndexOf(configsDir)); } } WorkspaceTemplateInfo wti = McXmlSerializer.GetObjectFromFile <WorkspaceTemplateInfo>(file.FilePath); if (string.IsNullOrEmpty(wti.Uid)) { wti.Uid = Path.GetFileNameWithoutExtension(file.FilePath); } //wti.Path = wti.Path; //MakeVirtualPath(structurePath, structureVirtualPath, controlDir, dci.Path); list.Add(wti); } return(list.ToArray()); }
/// <summary> /// Binds the data. /// </summary> /// <param name="uid">The uid.</param> private void BindData(string uid) { if (uid == null) { throw new ArgumentNullException("uid"); } WorkspaceTemplateInfo wti = WorkspaceTemplateFactory.GetTemplateInfo(uid); if (wti == null) { throw new ArgumentException(string.Format("Can't find Template with uid: {0}", uid)); } System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer(); List <ColumnInfo> list = jss.Deserialize <List <ColumnInfo> >(wti.ColumnInfo); foreach (ColumnInfo ci in list) { IbnControlPlace icp = new IbnControlPlace(); icp.WidthPercentage = ci.Width; icp.ID = ci.Id; icp.ControlPlaceId = ci.Id; this.Controls.Add(icp); } }