AskiaPortalCmnApiOnSetup Event |
Namespace: AskiaPortalCmn
Register a module using his main web service (Global.asax).
using System; using System.Web; using System.Collections.Generic; using AskiaPortalCmn; using AskiaPortalCmn.Setup; using AskiaPortalCmn.Common; namespace MyWebModule { public class Global : HttpApplication { protected void Application_Start(object sender, EventArgs e) { AskiaPortalCmnApi.OnSetup += AskiaPortalCmnApi_OnSetup; Guid myWebModuleGuid = Guid.Parse("26f6ab8b-2fdb-4f4f-ad14-7507892846a5"); Version myWebModuleVersion = new Version("1.0.0.0"); AskiaPortalCmnApi.InitializeModule(myWebModuleGuid, myWebModuleVersion); } private void AskiaPortalCmnApi_OnSetup(IModuleSetup moduleSetup, IModule currentModule) { if (currentModule != null) { // This is an update of the version: // currentModule.Version // to the current assembly version } else { // This is the first registration // of the module } // Set meta information moduleSetup.Name = "MyWebModule"; moduleSetup.Description = "Web module to do something..."; moduleSetup.Authors = "Myself and Co."; moduleSetup.RootUrl = "MyWebModule/"; // Set the default module configuration moduleSetup.SetDefaultConfig(new Dictionary<string, object> { {"myStringKey", "default value"}, {"myBoolKey", false}, {"myIntKey", 50}, {"myDblKey", 50.2}, {"myGuidKey", Guid.Parse("26f6ab8b-2fdb-4f4f-ad14-7507892846a5"} } ); // Set the default module translations moduleSetup.SetDefaultTranslations("en-GB", new Dictionary<string, string> { {"new", "New"}, {"open", "Open"} } ); moduleSetup.SetDefaultTranslations("fr-FR", new Dictionary<string, string> { {"new", "Nouveau"}, {"open", "Ouvrir"} } ); // Save the module moduleSetup.Save(); } } }