PC Review


Reply
Thread Tools Rate Thread

API to get all themes from APP_Themes ?

 
 
WT
Guest
Posts: n/a
 
      30th Jan 2007
Hello,

I need to list all available themes for a .NET app, is there any API in
..NET2 for this or should I explore the folder files using IO methods ?

Thanks for indication
CS


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
Posts: n/a
 
      30th Jan 2007
Good Aftrenoon,

I'm afraid System.IO is the only friend. You can save some time by looking
at Page class code (here you'll find excellent utility
http://www.aisto.com/roeder/dotnet/)
--
Milosz


"WT" wrote:

> Hello,
>
> I need to list all available themes for a .NET app, is there any API in
> ..NET2 for this or should I explore the folder files using IO methods ?
>
> Thanks for indication
> CS
>
>
>

 
Reply With Quote
 
JJ
Guest
Posts: n/a
 
      30th Jan 2007
This is what I use to get an array of the name of all themes:



public static string[] GetThemes()

{

if (HttpContext.Current.Cache["SiteThemes"] != null)

{

return (string[])HttpContext.Current.Cache["SiteThemes"];

}

else

{

string themesDirPath = HttpContext.Current.Server.MapPath("~/App_Themes");

string[] themes = Directory.GetDirectories(themesDirPath);

for (int i = 0; i <= themes.Length - 1; i++)

themes[i] = Path.GetFileName(themes[i]);

// cache the array

CacheDependency dep = new CacheDependency(themesDirPath);

HttpContext.Current.Cache.Insert("SiteThemes", themes, dep);

return themes;

}

}



JJ

"WT" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I need to list all available themes for a .NET app, is there any API in
> .NET2 for this or should I explore the folder files using IO methods ?
>
> Thanks for indication
> CS
>



 
Reply With Quote
 
WT
Guest
Posts: n/a
 
      30th Jan 2007
Thanks.

CS
"JJ" <(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed)...
> This is what I use to get an array of the name of all themes:
>
>
>
> public static string[] GetThemes()
>
> {
>
> if (HttpContext.Current.Cache["SiteThemes"] != null)
>
> {
>
> return (string[])HttpContext.Current.Cache["SiteThemes"];
>
> }
>
> else
>
> {
>
> string themesDirPath = HttpContext.Current.Server.MapPath("~/App_Themes");
>
> string[] themes = Directory.GetDirectories(themesDirPath);
>
> for (int i = 0; i <= themes.Length - 1; i++)
>
> themes[i] = Path.GetFileName(themes[i]);
>
> // cache the array
>
> CacheDependency dep = new CacheDependency(themesDirPath);
>
> HttpContext.Current.Cache.Insert("SiteThemes", themes, dep);
>
> return themes;
>
> }
>
> }
>
>
>
> JJ
>
> "WT" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hello,
>>
>> I need to list all available themes for a .NET app, is there any API in
>> .NET2 for this or should I explore the folder files using IO methods ?
>>
>> Thanks for indication
>> CS
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Centralize app_themes Chris Roden Microsoft ASP .NET 0 16th Apr 2007 11:31 PM
Change App_themes folder path Matteo Migliore Microsoft ASP .NET 0 28th Feb 2007 11:21 PM
relative App_Themes path micfrost@gmail.com Microsoft ASP .NET 2 15th Nov 2006 06:47 AM
App_Themes and stylesheets for print Pål Andreassen Microsoft ASP .NET 4 10th May 2006 08:18 AM
How to reference image within the App_Themes folder? =?Utf-8?B?d2FsdGVy?= Microsoft ASP .NET 1 3rd Apr 2006 09:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:11 PM.