本文整理汇总了C#中PluginFinder类的典型用法代码示例。如果您正苦于以下问题:C# PluginFinder类的具体用法?C# PluginFinder怎么用?C# PluginFinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginFinder类属于命名空间,在下文中一共展示了PluginFinder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public override void SetUp()
{
base.SetUp();
var edit = new EditSection();// { Editors = new PermissionElement(), Administrators };
finder = new PluginFinder(typeFinder, new SecurityManager(new ThreadContext(), edit), TestSupport.SetupEngineSection());
}
示例2: SetUp
public new void SetUp()
{
_taxSettings = new TaxSettings();
_taxSettings.DefaultTaxAddressId = 10;
_workContext = null;
_addressService = MockRepository.GenerateMock<IAddressService>();
//default tax address
_addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address { Id = _taxSettings.DefaultTaxAddressId });
var pluginFinder = new PluginFinder();
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
_geoLookupService = MockRepository.GenerateMock<IGeoLookupService>();
_countryService = MockRepository.GenerateMock<ICountryService>();
_logger = MockRepository.GenerateMock<ILogger>();
_customerSettings = new CustomerSettings();
_addressSettings = new AddressSettings();
_taxService = new TaxService(_addressService, _workContext, _taxSettings,
pluginFinder, _geoLookupService, _countryService, _logger
, _customerSettings, _addressSettings);
}
示例3: LibraryProviderSelector
public LibraryProviderSelector(Action<LibraryProvider> setCurrentLibraryProvider)
: base(null)
{
this.Name = "Home".Localize();
this.setCurrentLibraryProvider = setCurrentLibraryProvider;
ApplicationController.Instance.CloudSyncStatusChanged.RegisterEvent(CloudSyncStatusChanged, ref unregisterEvents);
if (false)
{
// This is test code for how to add these when we get to it
// put in the queue provider
libraryCreators.Add(new LibraryProviderQueueCreator());
AddFolderImage("queue_folder.png");
// put in the queue provider
libraryCreators.Add(new LibraryProviderHistoryCreator());
AddFolderImage("queue_folder.png");
}
// put in the sqlite provider
libraryCreators.Add(new LibraryProviderSQLiteCreator());
AddFolderImage("library_folder.png");
// Check for LibraryProvider factories and put them in the list too.
PluginFinder<LibraryProviderPlugin> libraryProviderPlugins = new PluginFinder<LibraryProviderPlugin>();
foreach (LibraryProviderPlugin libraryProviderPlugin in libraryProviderPlugins.Plugins)
{
// This coupling is required to navigate to the Purchased folder after redemption or purchase updates
libraryCreators.Add(libraryProviderPlugin);
folderImagesForChildren.Add(libraryProviderPlugin.GetFolderImage());
if (libraryProviderPlugin.ProviderKey == "LibraryProviderPurchasedKey")
{
this.PurchasedLibraryCreator = libraryProviderPlugin;
}
}
// and any directory providers (sd card provider, etc...)
// Add "Downloads" file system example
string downloadsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
if (Directory.Exists(downloadsDirectory))
{
libraryCreators.Add(new LibraryProviderFileSystemCreator(downloadsDirectory, "Downloads"));
AddFolderImage("download_folder.png");
}
firstAddedDirectoryIndex = libraryCreators.Count;
#if !__ANDROID__
MenuOptionFile.CurrentMenuOptionFile.AddLocalFolderToLibrary += (sender, e) =>
{
AddCollectionToLibrary(e.Data);
};
#endif
this.FilterProviders();
}
示例4: LibraryProviderSelector
public LibraryProviderSelector(Action<LibraryProvider> setCurrentLibraryProvider, bool includeQueueLibraryProvider)
: base(null, setCurrentLibraryProvider)
{
this.includeQueueLibraryProvider = includeQueueLibraryProvider;
this.Name = "Home".Localize();
ApplicationController.Instance.CloudSyncStatusChanged.RegisterEvent(CloudSyncStatusChanged, ref unregisterEvents);
libraryProviderPlugins = new PluginFinder<LibraryProviderPlugin>();
ReloadData();
}
示例5: SetUp
public new void SetUp()
{
_paymentSettings = new PaymentSettings();
_paymentSettings.ActivePaymentMethodSystemNames = new List<string>();
_paymentSettings.ActivePaymentMethodSystemNames.Add("Payments.TestMethod");
var pluginFinder = new PluginFinder(new AppDomainTypeFinder());
_shoppingCartSettings = new ShoppingCartSettings();
_paymentService = new PaymentService(_paymentSettings, pluginFinder, _shoppingCartSettings);
}
示例6: SetUp
public new void SetUp()
{
_discountRepo = MockRepository.GenerateMock<IRepository<Discount>>();
var discount1 = new Discount
{
Id = 1,
DiscountType = DiscountType.AssignedToCategories,
Name = "Discount 1",
UsePercentage = true,
DiscountPercentage = 10,
DiscountAmount = 0,
DiscountLimitation = DiscountLimitationType.Unlimited,
LimitationTimes = 0,
};
var discount2 = new Discount
{
Id = 2,
DiscountType = DiscountType.AssignedToSkus,
Name = "Discount 2",
UsePercentage = false,
DiscountPercentage = 0,
DiscountAmount = 5,
RequiresCouponCode = true,
CouponCode = "SecretCode",
DiscountLimitation = DiscountLimitationType.NTimesPerCustomer,
LimitationTimes = 3,
};
_discountRepo.Expect(x => x.Table).Return(new List<Discount>() { discount1, discount2 }.AsQueryable());
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
_storeContext = MockRepository.GenerateMock<IStoreContext>();
_storeContext.Expect(x => x.CurrentStore).Return(new Store
{
Id = 1,
Name = "MyStore"
});
_settingService = MockRepository.GenerateMock<ISettingService>();
var cacheManager = new NullCache();
_discountRequirementRepo = MockRepository.GenerateMock<IRepository<DiscountRequirement>>();
_discountUsageHistoryRepo = MockRepository.GenerateMock<IRepository<DiscountUsageHistory>>();
var pluginFinder = new PluginFinder();
_genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
_discountService = new DiscountService(cacheManager, _discountRepo, _discountRequirementRepo,
_discountUsageHistoryRepo, _storeContext, _genericAttributeService, pluginFinder, _eventPublisher,
_settingService, base.ProviderManager);
}
示例7: SetUp
public new void SetUp()
{
_paymentSettings = new PaymentSettings();
_paymentSettings.ActivePaymentMethodSystemNames = new List<string>();
_paymentSettings.ActivePaymentMethodSystemNames.Add("Payments.TestMethod");
var pluginFinder = new PluginFinder();
_shoppingCartSettings = new ShoppingCartSettings();
_settingService = MockRepository.GenerateMock<ISettingService>();
_paymentService = new PaymentService(_paymentSettings, pluginFinder, _settingService, _shoppingCartSettings);
}
示例8: LibraryProviderSelector
public LibraryProviderSelector(Action<LibraryProvider> setCurrentLibraryProvider)
: base(null)
{
this.setCurrentLibraryProvider = setCurrentLibraryProvider;
ApplicationController.Instance.CloudSyncStatusChanged.RegisterEvent(CloudSyncStatusChanged, ref unregisterEvents);
if (false)
{
// This is test code for how to add these when we get to it
// put in the queue provider
libraryProviders.Add(new LibraryProviderQueue(null, this));
AddFolderImage("queue_folder.png");
// put in the queue provider
libraryProviders.Add(new LibraryProviderHistory(null, this));
AddFolderImage("queue_folder.png");
}
// put in the sqlite provider
libraryProviders.Add(new LibraryProviderSQLite(null, this));
AddFolderImage("library_folder.png");
// Check for LibraryProvider factories and put them in the list too.
PluginFinder<LibraryProviderPlugin> libraryProviderPlugins = new PluginFinder<LibraryProviderPlugin>();
foreach (LibraryProviderPlugin libraryProviderPlugin in libraryProviderPlugins.Plugins)
{
// This coupling is required to navigate to the Purchased folder after redemption or purchase updates
var pluginProvider = libraryProviderPlugin.CreateLibraryProvider(this);
if (pluginProvider.ProviderKey == "LibraryProviderPurchasedKey")
{
this.PurchasedLibrary = pluginProvider;
}
libraryProviders.Add(pluginProvider);
folderImagesForChildren.Add(libraryProviderPlugin.GetFolderImage());
}
// and any directory providers (sd card provider, etc...)
// Add "Downloads" file system example
string downloadsDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
if (Directory.Exists(downloadsDirectory))
{
libraryProviders.Add(new LibraryProviderFileSystem(downloadsDirectory, "Downloads", this));
AddFolderImage("download_folder.png");
}
this.FilterProviders();
}
示例9: SetUp
public new void SetUp()
{
var cacheManager = new NopNullCache();
_workContext = null;
_currencySettings = new CurrencySettings();
var currency1 = new Currency
{
Id = 1,
Name = "Euro",
CurrencyCode = "EUR",
DisplayLocale = "",
CustomFormatting = "€0.00",
DisplayOrder = 1,
Published = true,
CreatedOnUtc = DateTime.UtcNow,
UpdatedOnUtc= DateTime.UtcNow
};
var currency2 = new Currency
{
Id = 1,
Name = "US Dollar",
CurrencyCode = "USD",
DisplayLocale = "en-US",
CustomFormatting = "",
DisplayOrder = 2,
Published = true,
CreatedOnUtc = DateTime.UtcNow,
UpdatedOnUtc= DateTime.UtcNow
};
_currencyRepo = MockRepository.GenerateMock<IRepository<Currency>>();
_currencyRepo.Expect(x => x.Table).Return(new List<Currency>() { currency1, currency2 }.AsQueryable());
_storeMappingService = MockRepository.GenerateMock<IStoreMappingService>();
var pluginFinder = new PluginFinder();
_currencyService = new CurrencyService(cacheManager, _currencyRepo, _storeMappingService,
_currencySettings, pluginFinder, null);
_taxSettings = new TaxSettings();
_localizationService = MockRepository.GenerateMock<ILocalizationService>();
_localizationService.Expect(x => x.GetResource("Products.InclTaxSuffix", 1, false)).Return("{0} incl tax");
_localizationService.Expect(x => x.GetResource("Products.ExclTaxSuffix", 1, false)).Return("{0} excl tax");
_priceFormatter = new PriceFormatter(_workContext, _currencyService,_localizationService,
_taxSettings, _currencySettings);
}
示例10: SetUp
public new void SetUp()
{
_paymentSettings = new PaymentSettings();
_paymentSettings.ActivePaymentMethodSystemNames = new List<string>();
_paymentSettings.ActivePaymentMethodSystemNames.Add("Payments.TestMethod");
var pluginFinder = new PluginFinder();
_shoppingCartSettings = new ShoppingCartSettings();
_settingService = MockRepository.GenerateMock<ISettingService>();
var localizationService = MockRepository.GenerateMock<ILocalizationService>();
localizationService.Expect(ls => ls.GetResource(null)).IgnoreArguments().Return("NotSupported").Repeat.Any();
_paymentService = new PaymentService(_paymentSettings, pluginFinder, _shoppingCartSettings, _settingService, localizationService, this.ProviderManager);
}
示例11: SetUp
public new void SetUp()
{
_shippingSettings = new ShippingSettings();
_shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List<string>();
_shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
_shippingMethodRepository = MockRepository.GenerateMock<IRepository<ShippingMethod>>();
_deliveryDateRepository = MockRepository.GenerateMock<IRepository<DeliveryDate>>();
_warehouseRepository = MockRepository.GenerateMock<IRepository<Warehouse>>();
_logger = new NullLogger();
_productAttributeParser = MockRepository.GenerateMock<IProductAttributeParser>();
_checkoutAttributeParser = MockRepository.GenerateMock<ICheckoutAttributeParser>();
var cacheManager = new NopNullCache();
var pluginFinder = new PluginFinder();
_productService = MockRepository.GenerateMock<IProductService>();
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
_localizationService = MockRepository.GenerateMock<ILocalizationService>();
_addressService = MockRepository.GenerateMock<IAddressService>();
_genericAttributeService = MockRepository.GenerateMock<IGenericAttributeService>();
_store = new Store { Id = 1 };
_storeContext = MockRepository.GenerateMock<IStoreContext>();
_storeContext.Expect(x => x.CurrentStore).Return(_store);
_shoppingCartSettings = new ShoppingCartSettings();
_shippingService = new ShippingService(_shippingMethodRepository,
_deliveryDateRepository,
_warehouseRepository,
_logger,
_productService,
_productAttributeParser,
_checkoutAttributeParser,
_genericAttributeService,
_localizationService,
_addressService,
_shippingSettings,
pluginFinder,
_storeContext,
_eventPublisher,
_shoppingCartSettings,
cacheManager);
}
示例12: Index
public ActionResult Index()
{
//加载插件
PluginFinder _pluginFinder = new PluginFinder();
List<IShippingMethod> shippingMethodList = _pluginFinder.GetPlugins<IShippingMethod>().ToList();
ViewData["ShippingMethods"] = shippingMethodList;
_indexService.GetTestName();
var TestTable = _indexService.GetTestTable();
var categoryModelList =
TestTable.Select(p =>
{
var categoryModel = new CategoryModel();
categoryModel.Id = p.Id;
categoryModel.Name = p.Name;
return categoryModel;
});
IEnumerable<CategoryModel> CategoryModel = categoryModelList;
return View(categoryModelList);
}
示例13: ShippingMethod
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);
}
示例14: GetAppropriateFactory
public static FrostedSerialPortFactory GetAppropriateFactory(string driverType)
{
lock(availableFactories)
{
try
{
if (availableFactories.Count == 0)
{
// always add a serial port this is a raw port
availableFactories.Add("Raw", new FrostedSerialPortFactory());
// add in any plugins that we find with other factories.
PluginFinder<FrostedSerialPortFactory> pluginFinder = new PluginFinder<FrostedSerialPortFactory>();
foreach (FrostedSerialPortFactory plugin in pluginFinder.Plugins)
{
availableFactories.Add(plugin.GetDriverType(), plugin);
}
// If we did not finde a RepRap driver add the default.
if (!availableFactories.ContainsKey("RepRap"))
{
availableFactories.Add("RepRap", new FrostedSerialPortFactory());
}
}
if (!string.IsNullOrEmpty(driverType)
&& availableFactories.ContainsKey(driverType))
{
return availableFactories[driverType];
}
return availableFactories["RepRap"];
}
catch
{
return new FrostedSerialPortFactory();
}
}
}
示例15: SetUp
public new void SetUp()
{
_taxSettings = new TaxSettings();
_taxSettings.DefaultTaxAddressId = 10;
_workContext = null;
_cartSettings = new ShoppingCartSettings();
_addressService = MockRepository.GenerateMock<IAddressService>();
//default tax address
_addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address() { Id = _taxSettings.DefaultTaxAddressId });
var pluginFinder = new PluginFinder();
_eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
_eventPublisher.Expect(x => x.Publish(Arg<object>.Is.Anything));
_settingService = MockRepository.GenerateMock<ISettingService>();
_geoCountryLookup = MockRepository.GenerateMock<IGeoCountryLookup>();
_taxService = new TaxService(_addressService, _workContext, _taxSettings, _cartSettings, pluginFinder, _settingService, _geoCountryLookup, this.ProviderManager);
}