Get config settings from a class

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
2/14/2011 3:06:59 PM
Gravatar
Total Posts 251

Get config settings from a class

Hi, i wrote an API to a web service, to interface with my first mojoportal module

In the first version, i hardcoded the connection parameters in the class i created (/Components/MyAPI.cs)

So, following the tutorial, i added the configuration.

I can access the configuration in the main program, but i have no idea how i can give the right setting hashtable while in the class.

 

Or i have to pass those values?

For example, if i want to post something use that api, i do this:

PostAPI(text-to-post);

i should do PostAPI(config.user,config.pass,text-to-post);

2/14/2011 3:16:59 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Get config settings from a class

Hi, Joe's answer to me in this thread may be helpful to you.

Jamie

2/14/2011 3:23:20 PM
Gravatar
Total Posts 251

Re: Get config settings from a class

The problem is that i can only get the default (hardcoded in the config function) value of the module setting

(no wonder why, i call the ApiConfiguration.cs with

protected ApiConfiguration config = new ApiConfiguration();  , but i cannot specify the settings hashtable )

2/15/2011 11:35:18 AM
Gravatar
Total Posts 18439

Re: Get config settings from a class

Hashtable moduleSettings = ModuleSettings.GetModuleSettings(moduleId);
config = new ApiConfiguration(moduleSettings);

Hope it helps,

Joe

2/25/2011 5:20:04 AM
Gravatar
Total Posts 251

Re: Get config settings from a class

I need to call this from each method, or it's better to do a property?

(did I use the right terms?)

You must sign in to post in the forums. This thread is closed to new posts.