本文整理汇总了C#中IResourceLoader类的典型用法代码示例。如果您正苦于以下问题:C# IResourceLoader类的具体用法?C# IResourceLoader怎么用?C# IResourceLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IResourceLoader类属于命名空间,在下文中一共展示了IResourceLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckoutSummaryPageViewModel
public CheckoutSummaryPageViewModel(INavigationService navigationService,
IOrderService orderService,
IOrderRepository orderRepository,
IShippingMethodService shippingMethodService,
ICheckoutDataRepository checkoutDataRepository,
IShoppingCartRepository shoppingCartRepository,
IAccountService accountService,
IResourceLoader resourceLoader,
IAlertMessageService alertMessageService,
ISignInUserControlViewModel signInUserControlViewModel)
{
_navigationService = navigationService;
_orderService = orderService;
_orderRepository = orderRepository;
_shippingMethodService = shippingMethodService;
_checkoutDataRepository = checkoutDataRepository;
_shoppingCartRepository = shoppingCartRepository;
_resourceLoader = resourceLoader;
_accountService = accountService;
_alertMessageService = alertMessageService;
_signInUserControlViewModel = signInUserControlViewModel;
SubmitCommand = DelegateCommand.FromAsyncHandler(SubmitAsync, CanSubmit);
EditCheckoutDataCommand = new DelegateCommand(EditCheckoutData);
SelectCheckoutDataCommand = new DelegateCommand(async () => await SelectCheckoutDataAsync());
AddCheckoutDataCommand = new DelegateCommand(AddCheckoutData);
}
示例2: Inform
// TODO: this should use inputstreams from the loader, not File!
public virtual void Inform(IResourceLoader loader)
{
if (mapping != null)
{
IList<string> wlist = null;
if (File.Exists(mapping))
{
wlist = new List<string>(GetLines(loader, mapping));
}
else
{
var files = SplitFileNames(mapping);
wlist = new List<string>();
foreach (string file in files)
{
var lines = GetLines(loader, file.Trim());
wlist.AddRange(lines);
}
}
NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();
ParseRules(wlist, builder);
normMap = builder.Build();
if (normMap.map == null)
{
// if the inner FST is null, it means it accepts nothing (e.g. the file is empty)
// so just set the whole map to null
normMap = null;
}
}
}
示例3: MenuViewModel
public MenuViewModel(IEventAggregator eventAggregator, INavigationService navigationService, IResourceLoader resourceLoader, ISessionStateService sessionStateService)
{
eventAggregator.GetEvent<NavigationStateChangedEvent>().Subscribe(OnNavigationStateChanged);
_navigationService = navigationService;
_sessionStateService = sessionStateService;
Commands = new ObservableCollection<MenuItemViewModel>
{
new MenuItemViewModel { DisplayName = resourceLoader.GetString("MainPageMenuItemDisplayName"), FontIcon = "\ue19f", Command = new DelegateCommand(() => NavigateToPage(PageTokens.Main), () => CanNavigateToPage(PageTokens.Main)) },
};
_canNavigateLookup = new Dictionary<PageTokens, bool>();
foreach (PageTokens pageToken in Enum.GetValues(typeof(PageTokens)))
{
_canNavigateLookup.Add(pageToken, true);
}
if (_sessionStateService.SessionState.ContainsKey(CurrentPageTokenKey))
{
// Resuming, so update the menu to reflect the current page correctly
PageTokens currentPageToken;
if (Enum.TryParse(_sessionStateService.SessionState[CurrentPageTokenKey].ToString(), out currentPageToken))
{
UpdateCanNavigateLookup(currentPageToken);
RaiseCanExecuteChanged();
}
}
}
示例4: GooglePlayCSVGenerator
public GooglePlayCSVGenerator (IEditorUtil util, ProductIdRemapper remapper, InventoryDatabase db, IResourceLoader loader) {
this.util = util;
this.remapper = remapper;
this.db = db;
remapper.initialiseForPlatform(BillingPlatform.GooglePlay);
this.inventory = XDocument.Load(loader.openTextFile("unibillInventory"));
}
示例5: ShoppingCartPageViewModel
public ShoppingCartPageViewModel(IShoppingCartRepository shoppingCartRepository,
INavigationService navigationService,
IAccountService accountService,
ISignInUserControlViewModel signInUserControlViewModel,
IResourceLoader resourceLoader,
IAlertMessageService alertMessageService,
ICheckoutDataRepository checkoutDataRepository,
IOrderRepository orderRepository,
IEventAggregator eventAggregator)
{
_shoppingCartRepository = shoppingCartRepository;
_navigationService = navigationService;
_accountService = accountService;
_signInUserControlViewModel = signInUserControlViewModel;
_resourceLoader = resourceLoader;
_alertMessageService = alertMessageService;
_checkoutDataRepository = checkoutDataRepository;
_orderRepository = orderRepository;
CheckoutCommand = DelegateCommand.FromAsyncHandler(CheckoutAsync, CanCheckout);
RemoveCommand = DelegateCommand<ShoppingCartItemViewModel>.FromAsyncHandler(Remove);
IncrementCountCommand = DelegateCommand.FromAsyncHandler(IncrementCount);
DecrementCountCommand = DelegateCommand.FromAsyncHandler(DecrementCount, CanDecrementCount);
// Subscribe to the ShoppingCartUpdated event
if (eventAggregator != null)
{
eventAggregator.GetEvent<ShoppingCartUpdatedEvent>().Subscribe(UpdateShoppingCartAsync);
}
}
示例6: RemoteConfigManager
public RemoteConfigManager(IResourceLoader loader, IStorage storage, ILogger logger, RuntimePlatform platform)
{
this.storage = storage;
logger.prefix = "Unibill.RemoteConfigManager";
this.XML = loader.openTextFile ("unibillInventory.json").ReadToEnd ();
Config = new UnibillConfiguration(XML, platform, logger);
if (Config.UseHostedConfig) {
string val = storage.GetString (CACHED_CONFIG_PATH, string.Empty);
if (string.IsNullOrEmpty (val)) {
logger.Log ("No cached config available. Using bundled");
} else {
logger.Log ("Cached config found, attempting to parse");
try {
Config = new UnibillConfiguration(val, platform, logger);
if (Config.inventory.Count == 0) {
logger.LogError ("No purchasable items in cached config, ignoring.");
Config = new UnibillConfiguration (XML, platform, logger);
} else {
logger.Log (string.Format ("Using cached config with {0} purchasable items", Config.inventory.Count));
XML = val;
}
} catch (Exception e) {
logger.LogError ("Error parsing inventory: {0}", e.Message);
Config = new UnibillConfiguration(XML, platform, logger);
}
}
refreshCachedConfig (Config.HostedConfigUrl, logger);
} else {
logger.Log ("Not using cached inventory, using bundled.");
Config = new UnibillConfiguration(XML, platform, logger);
}
}
示例7: LoadAsync
public override Task LoadAsync(IConfiguration configuration, IResourceLoader loader)
{
var link = Link;
var request = link.CreateRequestFor(Url);
var download = loader.DownloadAsync(request);
SetDownload(download);
return link.ProcessResponse(download, response =>
{
var type = link.Type ?? MimeTypeNames.Css;
var engine = configuration.GetStyleEngine(type);
if (engine != null)
{
var options = new StyleOptions
{
Element = link,
IsDisabled = link.IsDisabled,
IsAlternate = link.RelationList.Contains(Keywords.Alternate),
Configuration = configuration
};
_sheet = engine.ParseStylesheet(response, options);
_sheet.Media.MediaText = link.Media ?? String.Empty;
}
});
}
示例8: LoadAsync
/// <summary>
/// See http://www.w3.org/TR/html-imports/#dfn-import-request.
/// </summary>
public override async Task LoadAsync(IConfiguration configuration, IResourceLoader loader)
{
var link = Link;
var document = link.Owner;
var list = ImportLists.GetOrCreateValue(document);
var location = Url;
var request = link.CreateRequestFor(location);
var item = new ImportEntry
{
Relation = this,
IsCycle = CheckCycle(document, location)
};
_isasync = link.HasAttribute(AttributeNames.Async);
list.Add(item);
if (!item.IsCycle)
{
var nestedStatus = new TaskCompletionSource<Boolean>();
var download = loader.DownloadAsync(request);
SetDownload(download);
await link.ProcessResponse(download, async response =>
{
var context = new BrowsingContext(document.Context, Sandboxes.None);
var options = new CreateDocumentOptions(response, configuration)
{
ImportAncestor = document
};
_import = await context.OpenAsync(options, CancellationToken.None).ConfigureAwait(false);
nestedStatus.SetResult(true);
}).ConfigureAwait(false);
await nestedStatus.Task.ConfigureAwait(false);
}
}
示例9: ChangeDefaultsFlyoutViewModel
public ChangeDefaultsFlyoutViewModel(ICheckoutDataRepository checkoutDataRepository, IResourceLoader resourceLoader)
{
_checkoutDataRepository = checkoutDataRepository;
_resourceLoader = resourceLoader;
GoBackCommand = new DelegateCommand(() => GoBack());
}
示例10: MenuViewModel
public MenuViewModel(INavigationService navigationService, IResourceLoader resourceLoader)
{
_navigationService = navigationService;
Commands = new ObservableCollection<MenuItemViewModel>
{
new MenuItemViewModel { DisplayName = resourceLoader.GetString("DTSBehaviorSampleMenuItemDisplayName"), FontIcon = "\ue15f", Command = new DelegateCommand(() => NavigateToSamplePage(PageTokens.DTSBehaviorSample), () => CanNavigateToSamplePage(PageTokens.DTSBehaviorSample)) },
new MenuItemViewModel { DisplayName = resourceLoader.GetString("DTSSampleMenuItemDisplayName"), FontIcon = "\ue19f", Command = new DelegateCommand(() => NavigateToSamplePage(PageTokens.DTSSample), () => CanNavigateToSamplePage(PageTokens.DTSSample)) },
new MenuItemViewModel { DisplayName = resourceLoader.GetString("IncrementalLoadingMenuItemDisplayName"), FontIcon = "\ue19f", Command = new DelegateCommand(() => NavigateToSamplePage(PageTokens.IncrementalLoadingSample), () => CanNavigateToSamplePage(PageTokens.IncrementalLoadingSample)) },
new MenuItemViewModel { DisplayName = resourceLoader.GetString("DeferLoadStrategyMenuItemDisplayName"), FontIcon = "\ue19f", Command = new DelegateCommand(() => NavigateToSamplePage(PageTokens.DeferLoadStrategySample), () => CanNavigateToSamplePage(PageTokens.DeferLoadStrategySample)) },
new MenuItemViewModel { DisplayName = resourceLoader.GetString("CustomLVIPMenuItemDisplayName"), FontIcon = "\ue19f", Command = new DelegateCommand(() => NavigateToSamplePage(PageTokens.CustomLVIPSample), () => CanNavigateToSamplePage(PageTokens.CustomLVIPSample)) },
new MenuItemViewModel { DisplayName = resourceLoader.GetString("StateTriggerMenuItemDisplayName"), FontIcon = "\ue19f", Command = new DelegateCommand(() => NavigateToSamplePage(PageTokens.StateTriggerSample), () => CanNavigateToSamplePage(PageTokens.StateTriggerSample)) },
new MenuItemViewModel { DisplayName = resourceLoader.GetString("CVSMenuItemDisplayName"), FontIcon = "\ue19f", Command = new DelegateCommand(() => NavigateToSamplePage(PageTokens.CollectionViewSourceSample), () => CanNavigateToSamplePage(PageTokens.CollectionViewSourceSample)) },
new MenuItemViewModel { DisplayName = resourceLoader.GetString("DeviceSpecificMenuItemDisplayName"), FontIcon = "\ue19f", Command = new DelegateCommand(() => NavigateToSamplePage(PageTokens.DeviceSpecificSample), () => CanNavigateToSamplePage(PageTokens.DeviceSpecificSample)) },
new MenuItemViewModel { DisplayName = resourceLoader.GetString("ExpanderSampleMenuItemDisplayName"), FontIcon = "\ue19f", Command = new DelegateCommand(() => NavigateToSamplePage(PageTokens.ExpanderSample), () => CanNavigateToSamplePage(PageTokens.ExpanderSample)) },
new MenuItemViewModel { DisplayName = resourceLoader.GetString("OldMainPageMenuItemDisplayName"), FontIcon = "\ue19f", Command = new DelegateCommand(() => NavigateToSamplePage(PageTokens.OldMain), () => CanNavigateToSamplePage(PageTokens.OldMain)) },
};
_currentPageToken = PageTokens.DTSBehaviorSample;
_canNavigateLookup = new Dictionary<PageTokens, bool>();
foreach (PageTokens pageToken in Enum.GetValues(typeof(PageTokens)))
{
_canNavigateLookup.Add(pageToken, true);
}
_canNavigateLookup[_currentPageToken] = false;
}
示例11: CategoryPageViewModel
public CategoryPageViewModel(IProductCatalogRepository productCatalogRepository, INavigationService navigationService, IAlertMessageService alertMessageService, IResourceLoader resourceLoader)
{
_productCatalogRepository = productCatalogRepository;
_navigationService = navigationService;
_alertMessageService = alertMessageService;
_resourceLoader = resourceLoader;
}
示例12: SplashPageViewModel
public SplashPageViewModel(INavigationService navigationService, IOpenhabDatabase database, IEventAggregator eventAggregator, IResourceLoader resourceLoader)
{
_navigationService = navigationService;
_database = database;
_eventAggregator = eventAggregator;
_resourceLoader = resourceLoader;
}
示例13: DefaultResourceLoader
public DefaultResourceLoader(IResourceLoader loader)
{
if (loader == null)
throw new ArgumentNullException("wrappedLoader");
this.loader = loader;
}
示例14: Inform
public virtual void Inform(IResourceLoader loader)
{
Stream stream = null;
try
{
if (dictFile != null) // the dictionary can be empty.
{
dictionary = GetWordSet(loader, dictFile, false);
}
// TODO: Broken, because we cannot resolve real system id
// ResourceLoader should also supply method like ClassLoader to get resource URL
stream = loader.OpenResource(hypFile);
//InputSource @is = new InputSource(stream);
//@is.Encoding = encoding; // if it's null let xml parser decide
//@is.SystemId = hypFile;
var xmlEncoding = string.IsNullOrEmpty(encoding) ? Encoding.UTF8 : Encoding.GetEncoding(encoding);
hyphenator = HyphenationCompoundWordTokenFilter.GetHyphenationTree(stream, xmlEncoding);
}
finally
{
IOUtils.CloseWhileHandlingException(stream);
}
}
示例15: Add
/// <summary>
/// Add a new resource loader.
/// </summary>
/// <param name="loader">Provider to add.</param>
/// <exception cref="InvalidOperationException">Manager have been started.</exception>
public void Add(IResourceLoader loader)
{
if (_isStarted)
throw new InvalidOperationException("Manager have been started.");
_logger.Trace("Adding resource loader '" + loader.GetType().FullName + "'.");
_providers.Add(loader);
}