Exemple #1
0
        /// <summary>
        /// Check if app is valid and load.
        /// </summary>
        /// <param name="appId">Application ID</param>
        /// <param name="filePath">Path on file system.</param>
        private void LoadApp(long appId, string filePath)
        {
            FileInfo     file         = new FileInfo(Path.Combine(Local.Folder, filePath));
            ModuleHeader moduleHeader = ModuleHeaderReader.AppHeader(Local.Folder, file.FullName);

            if (moduleHeader != null)
            {
                if (apps.ContainsKey(appId))
                {
                    ModuleInstance app = apps[appId];

                    app.Load();

                    currentApp = app;
                }
                else
                {
                    ModuleInstance app = new ModuleInstance(file.FullName, "Module.App",
                                                            new object[] { Frame, Networking, PlatformFunctions, Platform, UserGroups.ToArray() });

                    bool result = app.Load();

                    apps.Add(appId, app);

                    currentApp = app;
                }

                CurrentlyRunningAppName = moduleHeader.Name;
            }
        }
Exemple #2
0
        /// <summary>
        /// Enable service.
        /// </summary>
        /// <param name="serviceId">The service identifier.</param>
        public void EnableService(long serviceId)
        {
            if (services.ContainsKey(serviceId))
            {
                ModuleInstance service = services[serviceId];

                Module module = moduleRepository.Get(serviceId);

                if (module.type == (int)ModuleType.Service && module.enabled == 0)
                {
                    try
                    {
                        if (service.Load())
                        {
                            moduleRepository.EnableService(serviceId);
                        }
                    }
                    catch (Exception err)
                    {
                        logManager.Add(module.id, err.ToString());
                    }
                }
            }
        }