Ejemplo n.º 1
0
        public ActionResult Index()
        {
            UserMemberInfo currentUser = base.CurrentUser;

            PluginsManagement.GetPlugins <IMessagePlugin>();
            IEnumerable <Plugin <ISMSPlugin> > plugins = PluginsManagement.GetPlugins <ISMSPlugin>();
            PluginsInfo pluginsInfo = (
                from item in plugins
                select new PluginsInfo()
            {
                ShortName = item.Biz.ShortName,
                PluginId = item.PluginInfo.PluginId,
                Enable = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind = !string.IsNullOrEmpty(ServiceHelper.Create <IMessageService>().GetDestination(base.CurrentUser.Id, item.PluginInfo.PluginId, MemberContactsInfo.UserTypes.General))
            }).FirstOrDefault();
            IEnumerable <Plugin <IEmailPlugin> > plugins1 = PluginsManagement.GetPlugins <IEmailPlugin>();
            PluginsInfo pluginsInfo1 = (
                from item in plugins1
                select new PluginsInfo()
            {
                ShortName = item.Biz.ShortName,
                PluginId = item.PluginInfo.PluginId,
                Enable = item.PluginInfo.Enable,
                IsSettingsValid = item.Biz.IsSettingsValid,
                IsBind = !string.IsNullOrEmpty(ServiceHelper.Create <IMessageService>().GetDestination(base.CurrentUser.Id, item.PluginInfo.PluginId, MemberContactsInfo.UserTypes.General))
            }).FirstOrDefault();

            ViewBag.BindSMS   = pluginsInfo;
            ViewBag.BindEmail = pluginsInfo1;
            return(View(base.CurrentUser));
        }
Ejemplo n.º 2
0
        static ApplicationPartManagerExtensions()
        {
            //we use the default file provider, since the DI isn't initialized yet
            _fileProvider = CommonHelper.DefaultFileProvider;

            _baseAppLibraries = new List <string>();

            //get all libraries from /bin/{version}/ directory
            _baseAppLibraries.AddRange(_fileProvider.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.dll")
                                       .Select(fileName => _fileProvider.GetFileName(fileName)));

            //get all libraries from base site directory
            if (!AppDomain.CurrentDomain.BaseDirectory.Equals(Environment.CurrentDirectory, StringComparison.InvariantCultureIgnoreCase))
            {
                _baseAppLibraries.AddRange(_fileProvider.GetFiles(Environment.CurrentDirectory, "*.dll")
                                           .Select(fileName => _fileProvider.GetFileName(fileName)));
            }

            //get all libraries from refs directory
            var refsPathName = _fileProvider.Combine(Environment.CurrentDirectory, NopPluginDefaults.RefsPathName);

            if (_fileProvider.DirectoryExists(refsPathName))
            {
                _baseAppLibraries.AddRange(_fileProvider.GetFiles(refsPathName, "*.dll")
                                           .Select(fileName => _fileProvider.GetFileName(fileName)));
            }

            //load plugins info (names of already installed, going to be installed, going to be uninstalled and going to be deleted plugins)
            PluginsInfo = PluginsInfo.LoadPluginInfo(_fileProvider);
        }
Ejemplo n.º 3
0
 public PluginService(
     IUserService userService,
     ILogger logger,
     IFileProviderHelper fileProvider)
 {
     _userService  = userService;
     _logger       = logger;
     _fileProvider = fileProvider;
     _pluginsInfo  = Singleton <PluginsInfo> .Instance;
 }
Ejemplo n.º 4
0
 public PluginService(ICustomerService customerService,
                      ILogger logger,
                      INopFileProvider fileProvider,
                      IWebHelper webHelper)
 {
     _customerService = customerService;
     _logger          = logger;
     _fileProvider    = fileProvider;
     _webHelper       = webHelper;
     _pluginsInfo     = Singleton <PluginsInfo> .Instance;
 }