/// <summary> /// Locate all available themes for a store /// </summary> /// <returns></returns> public List<ThemeView> FindAvailableThemes(bool includeInstalled) { List<ThemeView> result = new List<ThemeView>(); List<ThemeView> installed = FindInstalledThemes(); string[] availablePaths = Storage.DiskStorage.ListAvailableThemePaths(); if (availablePaths == null) return result; if (availablePaths.Length < 1) return result; foreach (string themePath in availablePaths) { string themeId = System.IO.Path.GetFileName(themePath); if (!themeId.StartsWith("theme-")) continue; themeId = themeId.Replace("theme-", ""); if (includeInstalled || !AlreadyInstalled(installed, themeId)) { ThemeView v = new ThemeView(); v.LoadAvailableTheme(themeId); result.Add(v); } } return result.OrderBy(y => y.Info.Title).ToList(); }
/// <summary> /// Locate all themes already installed for a given store /// </summary> /// <param name="storeId"></param> /// <returns></returns> public List <ThemeView> FindInstalledThemes() { List <ThemeView> result = new List <ThemeView>(); string[] installedPaths = Storage.DiskStorage.ListInstalledThemePaths(MTApp.CurrentStore.Id); if (installedPaths == null) { return(result); } if (installedPaths.Length < 1) { return(result); } foreach (string themePath in installedPaths) { string themeId = System.IO.Path.GetFileName(themePath); themeId = themeId.Replace("theme-", ""); ThemeView v = new ThemeView(); v.LoadInstalledTheme(MTApp, themeId); result.Add(v); } return(result.OrderBy(y => y.Info.Title).ToList()); }
/// <summary> /// Locate all available themes for a store /// </summary> /// <returns></returns> public List <ThemeView> FindAvailableThemes(bool includeInstalled) { List <ThemeView> result = new List <ThemeView>(); List <ThemeView> installed = FindInstalledThemes(); string[] availablePaths = Storage.DiskStorage.ListAvailableThemePaths(); if (availablePaths == null) { return(result); } if (availablePaths.Length < 1) { return(result); } foreach (string themePath in availablePaths) { string themeId = System.IO.Path.GetFileName(themePath); if (!themeId.StartsWith("theme-")) { continue; } themeId = themeId.Replace("theme-", ""); if (includeInstalled || !AlreadyInstalled(installed, themeId)) { ThemeView v = new ThemeView(); v.LoadAvailableTheme(themeId); result.Add(v); } } return(result.OrderBy(y => y.Info.Title).ToList()); }
private void RenderSingleTheme(ThemeView t, StringBuilder sb) { string url = t.PreviewImageUrl; if (!url.StartsWith("http")) { url = Page.ResolveUrl("~" + t.PreviewImageUrl); } sb.Append("<img class=\"smallpreview\" src=\"" + url + "?uid=" + System.Guid.NewGuid().ToString() + "\" alt=\"" + t.Info.Title + "\" />"); sb.Append("<h3>" + t.Info.Title + "</h3>"); sb.Append("<label>Author:</label><span class=\"author\"><a href=\"" + t.Info.AuthorUrl + "\" target=\"_blank\">" + t.Info.Author + "</a></span><br />"); sb.Append("<label>Version:</label><span class=\"author\">" + t.Info.Version + "</span><br />"); }
private void LoadTheInfo(string themeId) { if ((themeId == null)) { return; } ThemeInfo info = MTApp.ThemeManager().GetThemeInfo(themeId); if ((info != null)) { this.ThemeNameField.Text = info.Title; this.DescriptionField.Text = info.Description; this.AuthorField.Text = info.Author; this.AuthorUrlField.Text = info.AuthorUrl; this.VersionField.Text = info.Version; this.VersionUrlField.Text = info.VersionUrl; ThemeView tv = new ThemeView(); tv.LoadInstalledTheme(MTApp, themeId); this.imgPreview.ImageUrl = tv.PreviewImageUrl + "?uid=" + System.Guid.NewGuid().ToString(); } }
/// <summary> /// Locate all themes already installed for a given store /// </summary> /// <param name="storeId"></param> /// <returns></returns> public List<ThemeView> FindInstalledThemes() { List<ThemeView> result = new List<ThemeView>(); string[] installedPaths = Storage.DiskStorage.ListInstalledThemePaths(MTApp.CurrentStore.Id); if (installedPaths == null) return result; if (installedPaths.Length < 1) return result; foreach (string themePath in installedPaths) { string themeId = System.IO.Path.GetFileName(themePath); themeId = themeId.Replace("theme-", ""); ThemeView v = new ThemeView(); v.LoadInstalledTheme(MTApp, themeId); result.Add(v); } return result.OrderBy(y => y.Info.Title).ToList(); }