コード例 #1
0
        /// <summary>
        /// Register services and interfaces
        /// </summary>
        /// <param name="builder">Container builder</param>
        /// <param name="typeFinder">Type finder</param>
        /// <param name="config">Config</param>
        public void Register(ContainerBuilder builder, ITypeFinder typeFinder, NopConfig config)
        {
            var pluginFinder = new PluginFinder();

            pluginFinder.ReloadPlugins();

            var pluginDescriptor = pluginFinder.GetPluginDescriptorBySystemName("BreadCrumb.GBS");

            if (pluginDescriptor != null)
            {
                builder.RegisterType <GBSProductModelFactory>().As <IProductModelFactory>().InstancePerLifetimeScope();
            }
        }
コード例 #2
0
        public void Register(ContainerBuilder builder, ITypeFinder typeFinder, NopConfig config)
        {
            var pluginFinder = new PluginFinder();

            pluginFinder.ReloadPlugins();

            var pluginDescriptor = pluginFinder.GetPluginDescriptorBySystemName("PriceCalculation.GBS");

            if (pluginDescriptor != null)  // pluginDescriptor.Installed == true
            {
                builder.RegisterType <GBSPriceCalculationService>().As <IPriceCalculationService>().InstancePerLifetimeScope();
            }
        }
コード例 #3
0
        public void Register(ContainerBuilder builder, ITypeFinder typeFinder, NopConfig config)
        {
            var pluginFinder = new PluginFinder();

            pluginFinder.ReloadPlugins();

            var pluginDescriptor = pluginFinder.GetPluginDescriptorBySystemName("Order.GBS");



            if (pluginDescriptor != null)  // pluginDescriptor.Installed == true
            {
                // builder.RegisterType<OrderController>().As<NW.OrderController>();
                builder.RegisterType <GBSOrderProcessingService>().As <IOrderProcessingService>().InstancePerLifetimeScope();
                builder.RegisterType <CustomTokenProvider>().As <IMessageTokenProvider>().InstancePerLifetimeScope();
                builder.RegisterType <GBSPdfService>().As <IPdfService>().InstancePerLifetimeScope();
                builder.RegisterType <GBSOrderModelFactory>().As <Plugin.Order.GBS.Factories.IOrderModelFactory>().InstancePerLifetimeScope();
                builder.RegisterType <GBSOrderService>().As <IGBSOrderService>().InstancePerLifetimeScope();
            }
        }
コード例 #4
0
ファイル: HomeController.cs プロジェクト: code-v/Mem
        public ActionResult ShippingMethod(string method)
        {
            PluginFinder _pluginFinder = new PluginFinder();
            var pluginDescriptor = _pluginFinder.GetPluginDescriptorBySystemName<IShippingMethod>(method);
            var plugin = pluginDescriptor.Instance() as IShippingMethod;

            string actionName = "";
            string controllerName = "";
            RouteValueDictionary configurationRouteValues = null;
            plugin.GetConfigurationRoute(out actionName, out controllerName, out configurationRouteValues);

            ShippingMethodModel model = new ShippingMethodModel()
            {
                ActionName = actionName,
                ConfigurationRouteValues = configurationRouteValues,
                ControllerName = controllerName
            };

            return View(model);
        }
コード例 #5
0
ファイル: PluginController.cs プロジェクト: lolegg/Cupcake
        public ActionResult Install(string systemName)
        {
            try
            {
                PluginFinder _pluginFinder    = new PluginFinder();
                var          pluginDescriptor = _pluginFinder.GetPluginDescriptorBySystemName(systemName, LoadPluginsMode.All);
                if (pluginDescriptor == null)
                {
                    //No plugin found with the specified id
                    return(RedirectToAction("List"));
                }

                //check whether plugin is not installed
                if (pluginDescriptor.Installed)
                {
                    return(RedirectToAction("List"));
                }

                //install plugin
                pluginDescriptor.Instance().Install();
                //SuccessNotification(_localizationService.GetResource("Admin.Configuration.Plugins.Installed"));

                //restart application
                //var webHelper = EngineContext.Current.Resolve<IWebHelper>();
                WebHelper webHelper = new WebHelper();
                webHelper.RestartAppDomain();
            }
            catch (Exception exc)
            {
                //TODO:webHelper.RestartAppDomain();中HttpRuntime.UnloadAppDomain();会导致log4报错(未解析成员“log4net.Util.PropertiesDictionary...)
                //Log4Helper.Error(this.GetType(), exc, new Guid("8D2E6410-2B20-E711-8A80-B8AC6F19DFD9"));
                //return Json(new AjaxResult() { Result = Result.Error, Message = exc.Message });
            }

            return(Json(new AjaxResult()
            {
                Result = Result.Success, Message = "安装成功"
            }));
        }
コード例 #6
0
ファイル: PluginController.cs プロジェクト: lolegg/Cupcake
        public ActionResult UnInstall(string systemName)
        {
            try
            {
                PluginFinder _pluginFinder    = new PluginFinder();
                var          pluginDescriptor = _pluginFinder.GetPluginDescriptorBySystemName(systemName, LoadPluginsMode.All);
                if (pluginDescriptor == null)
                {
                    //No plugin found with the specified id
                    return(RedirectToAction("List"));
                }

                //check whether plugin is not installed
                if (!pluginDescriptor.Installed)
                {
                    return(RedirectToAction("List"));
                }

                //install plugin
                pluginDescriptor.Instance().Uninstall();
                //SuccessNotification(_localizationService.GetResource("Admin.Configuration.Plugins.Installed"));

                //restart application
                //var webHelper = EngineContext.Current.Resolve<IWebHelper>();
                WebHelper webHelper = new WebHelper();
                webHelper.RestartAppDomain();
            }
            catch (Exception exc)
            {
                //ErrorNotification(exc);
                throw exc;
            }

            return(Json(new AjaxResult()
            {
                Result = Result.Success, Message = "卸载成功"
            }));
        }