protected IItemProvider _newItemProvider = null; // Store new item provider until next render cylce #endregion #region Ctor public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager) { base.DeepCopy(source, copyManager); VirtualizingStackPanel p = (VirtualizingStackPanel) source; _itemProvider = copyManager.GetCopy(p._itemProvider); _arrangedItems.Clear(); _averageItemSize = 0; }
public static void RenderItemIcon(SpriteBatch spriteBatch, Texture2D texture, IItemProvider provider, byte metadata, Rectangle destination, Color color) { var icon = provider.GetIconTexture(metadata); var scale = texture.Width / 16; var source = new Rectangle(icon.Item1 * scale, icon.Item2 * scale, scale, scale); spriteBatch.Draw(texture, destination, source, color); }
public ItemVM(IItemProvider provider, ContainerVM parent, string name, bool canRename) { Provider = provider; Parent = parent; _name = name; CanRename = canRename; MetaData = new MetaData(); }
public void Setup() { SystemTime.Freeze(); _session = TestHelpers.Instance.GenerateSession(); _item = TestHelpers.Instance.GenerateItemProvider(); _mailHttpClient = new Mock <IMailHttpClient>(); _itemInstanceDao = new Mock <IGenericDao <IItemInstanceDto> >(); _pclPacketHandler = new PclPacketHandler(_mailHttpClient.Object, _item, _itemInstanceDao.Object); }
public CScalcPacketHandler(WorldConfiguration worldConfiguration, IBazaarHttpClient bazaarHttpClient, IItemProvider itemProvider, ILogger logger, IDao <IItemInstanceDto?, Guid> itemInstanceDao) { _worldConfiguration = worldConfiguration; _bazaarHttpClient = bazaarHttpClient; _itemProvider = itemProvider; _logger = logger; _itemInstanceDao = itemInstanceDao; }
public CommandPacketController(WorldConfiguration worldConfiguration, List <Item> items, IItemProvider itemProvider, IMapInstanceProvider mapInstanceProvider, ILogger logger) { _worldConfiguration = worldConfiguration; _items = items; _itemProvider = itemProvider; _mapInstanceProvider = mapInstanceProvider; _logger = logger; }
public ValueVM(IItemProvider provider, ContainerVM parent, string name, RegistryValueKind kind, object value) : base(provider, parent, string.IsNullOrEmpty(name) ? "(Default)" : name, false) { MetaData.Add(new MetaEntry { Name = RegistryMetaData.Type.Name, Value = kind }); MetaData.Add(new MetaEntry { Name = RegistryMetaData.Data.Name, Value = value }); }
public RenderFieldArgs(IItemProvider itemProvider, IItemUrlService itemUrlService, Item item, Field field, TextWriter output, Dictionary<string, string> attributes) { ItemProvider = itemProvider; ItemUrlService = itemUrlService; Item = item; Field = field; Output = output; Attributes = attributes; }
public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager) { base.DeepCopy(source, copyManager); VirtualizingWrapPanel p = (VirtualizingWrapPanel)source; _itemProvider = copyManager.GetCopy(p._itemProvider); _assumedLineExtendsInNonOrientationDirection = 0; _arrangedItems = null; _firstArrangedLineIndex = -1; _lastArrangedLineIndex = -1; }
public AdventureContextHelper(ILogger <MapHelper> log, IItemProvider itemProvider, ILocationProvider locationProvider, AdventureContext context) { _log = log; _itemProvider = itemProvider; _locationProvider = locationProvider; _context = context; }
public MapNpcProvider(IItemProvider itemProvider, List <ShopDto> shops, List <ShopItemDto> shopItems, List <NpcMonsterDto> npcMonsters, List <MapNpcDto> mapNpcs) { _itemProvider = itemProvider; _npcMonsters = npcMonsters; _shops = shops; _shopItems = shopItems; _mapNpcs = mapNpcs; }
public void Setup() { _session = TestHelpers.Instance.GenerateSession(); _item = TestHelpers.Instance.GenerateItemProvider(); _nRunHandler = new NrunPacketHandler(_logger, new NrunProvider( new List <IEventHandler <Tuple <IAliveEntity, NrunPacket>, Tuple <IAliveEntity, NrunPacket> > > { new ChangeClassEventHandler() })); }
public RenderFieldArgs(IItemProvider itemProvider, IItemUrlService itemUrlService, Item item, Field field, TextWriter output, Dictionary <string, string> attributes) { ItemProvider = itemProvider; ItemUrlService = itemUrlService; Item = item; Field = field; Output = output; Attributes = attributes; }
public WarehouseHttpClient(IHttpClientFactory httpClientFactory, Channel channel, IChannelHttpClient channelHttpClient, IItemProvider itemProvider, IDao <IItemInstanceDto?, Guid> itemInstanceDao) : base(httpClientFactory, channel, channelHttpClient) { ApiUrl = "api/warehouse"; RequireConnection = true; _itemProvider = itemProvider; _itemInstanceDao = itemInstanceDao; }
public SelectPacketHandler(IAdapter adapter, IGenericDao <CharacterDto> characterDao, ILogger logger, IItemProvider itemProvider, IMapInstanceProvider mapInstanceProvider, IGenericDao <IItemInstanceDto> itemInstanceDao) { _adapter = adapter; _characterDao = characterDao; _logger = logger; _mapInstanceProvider = mapInstanceProvider; _itemProvider = itemProvider; _itemInstanceDao = itemInstanceDao; }
public MapNpc(IItemProvider itemProvider, IGenericDao <ShopDto> shops, IGenericDao <ShopItemDto> shopItems, List <NpcMonsterDto> npcMonsters, ILogger logger) { _npcMonsters = npcMonsters; _shops = shops; _shopItems = shopItems; _itemProvider = itemProvider; _logger = logger; }
public ComputerVM(IItemProvider provider, string machine) : base(provider, null, machine ?? "Computer", false) { IsRemote = !string.IsNullOrEmpty(machine); //using (var kf = KnownFolders.Computer) //{ // _shell = ShellObject.FromParsingName(kf.ParsingName); // _shell.Thumbnail.CurrentSize = new System.Windows.Size(16, 16); //} }
public MapHelper(ILogger <MapHelper> log, IResponseBuilder responseBuilder, IItemProvider itemProvider, ILocationProvider locationProvider, IAdventureContextHelper advHelper) { _log = log; _responseBuilder = responseBuilder; _itemProvider = itemProvider; _locationProvider = locationProvider; _advHelper = advHelper; }
public void CreatePortionerControl(IItemProvider itemProvider, uint nBins) { var ctrlLog = new SimpleTextLog(); var binLog = new SimpleTextLog(); var control = new Control(itemProvider, ctrlLog, new RoundRobinPortioningAlgorithm()); for (uint i = 0; i < nBins; i++) { control.AddBin(new Bin(i, 2000, binLog)); } }
public override void Dispose() { base.Dispose(); IItemProvider itemProvider = _itemProvider; _itemProvider = null; if (itemProvider != null) MPF.TryCleanupAndDispose(itemProvider); itemProvider = _newItemProvider; _newItemProvider = null; if (itemProvider != null) MPF.TryCleanupAndDispose(itemProvider); }
public void GetNewsItems_WithValidNewsRootAndNoNewsItems_ReturnsEmptyList() { // Arrange IItemProvider itemProvider = ItemProviderFactory.CreateItemProviderWithNewsItemRootWithoutNewsItems(); NewsItemService newsItemService = GetNewsItemService(itemProvider); // Act var result = newsItemService.GetNewsItems(); // Assert result.Should().BeEmpty(); }
public override FrameworkElement GetElement(int index) { IItemProvider itemProvider = ItemProvider; if (itemProvider == null) { return(base.GetElement(index)); } lock (Children.SyncRoot) return(GetItem(index, itemProvider, true)); }
/// <summary> /// Focuses the first line if an item on the last line currently has focus /// </summary> /// <returns>true if the first line was focused</returns> protected override bool TryLoopToFirstLine() { IItemProvider itemProvider = ItemProvider; if (itemProvider == null) { return(base.TryLoopToFirstLine()); } int maxIndex = itemProvider.NumItems - 1; if (maxIndex < 0) { return(false); } FrameworkElement currentElement = GetFocusedElementOrChild(); if (currentElement == null) { return(false); } IList <LineMeasurement> lines = new List <LineMeasurement>(_arrangedLines); if (lines.Count == 0) { return(false); } var lastLine = lines[lines.Count - 1]; //check if last arranged line is actual last line if (lastLine.EndIndex != maxIndex) { return(false); } for (int childIndex = lastLine.StartIndex; childIndex <= lastLine.EndIndex; childIndex++) { FrameworkElement item = GetItem(childIndex, itemProvider, false); if (item != null && InVisualPath(item, currentElement)) { //item on last line has focus //assume first line always has at least same number of items as last line //set focus to item in same position on first line item = GetItem(childIndex - lastLine.StartIndex, itemProvider, false); if (item != null) { item.SetFocusPrio = SetFocusPriority.Default; } SetScrollIndex(0, true); return(true); } } return(false); }
public CharNewPacketHandler(IDao <CharacterDto, long> characterDao, IDao <MinilandDto, Guid> minilandDao, IItemProvider itemBuilderService, IDao <QuicklistEntryDto, Guid> quicklistEntryDao, IDao <IItemInstanceDto?, Guid> itemInstanceDao, IDao <InventoryItemInstanceDto, Guid> inventoryItemInstanceDao, IHpService hpService, IMpService mpService, IOptions <WorldConfiguration> worldConfiguration) { _characterDao = characterDao; _minilandDao = minilandDao; _itemBuilderService = itemBuilderService; _quicklistEntryDao = quicklistEntryDao; _inventoryItemInstanceDao = inventoryItemInstanceDao; _itemInstanceDao = itemInstanceDao; _hpService = hpService; _mpService = mpService; _worldConfiguration = worldConfiguration.Value; }
public CharacterScreenPacketController( IItemProvider itemProvider, IMapInstanceProvider mapInstanceProvider, IAdapter adapter, IGenericDao <CharacterDto> characterDao, IGenericDao <AccountDto> accountDao, IGenericDao <IItemInstanceDto> itemInstanceDao, IGenericDao <MateDto> mateDao, ILogger logger) { _mapInstanceProvider = mapInstanceProvider; _itemProvider = itemProvider; _adapter = adapter; _characterDao = characterDao; _accountDao = accountDao; _itemInstanceDao = itemInstanceDao; _mateDao = mateDao; _logger = logger; }
public MailController(IDao <MailDto, long> mailDao, IDao <IItemInstanceDto?, Guid> itemInstanceDao, IConnectedAccountHttpClient connectedAccountHttpClient, List <ItemDto> items, IItemProvider itemProvider, IIncommingMailHttpClient incommingMailHttpClient, ParcelHolder parcelHolder, IDao <CharacterDto, long> characterDto) { _mailDao = mailDao; _itemInstanceDao = itemInstanceDao; _connectedAccountHttpClient = connectedAccountHttpClient; _items = items; _itemProvider = itemProvider; _incommingMailHttpClient = incommingMailHttpClient; _parcelHolder = parcelHolder; _characterDto = characterDto; }
public void RegisterItemProvider(IItemProvider provider) { int i; for (i = ItemProviders.Count - 1; i >= 0; i--) { if (provider.ID == ItemProviders[i].ID) { ItemProviders[i] = provider; // Override return; } if (ItemProviders[i].ID < provider.ID) break; } ItemProviders.Insert(i + 1, provider); }
public override void AddChildren(ICollection <UIElement> childrenOut) { IItemProvider itemProvider = ItemProvider; if (itemProvider == null) { base.AddChildren(childrenOut); return; } if (_arrangedItems != null) { lock (Children.SyncRoot) CollectionUtils.AddAll(childrenOut, _arrangedItems.Where(i => i != null)); } }
public void Setup() { var items = new List <ItemDto> { new Item { VNum = 1, ItemType = ItemType.Title, EffectValue = 0, Type = NoscorePocketType.Main }, }; _itemProvider = new ItemProvider(items, new List <IEventHandler <Item, Tuple <InventoryItemInstance, UseItemPacket> > >()); _session = TestHelpers.Instance.GenerateSession(); _handler = new TitleGuriHandler(); }
/// <summary> /// Initializes a new instance of the VaultForm class. /// </summary> public VaultForm(IServiceProvider serviceProvider) { if (LicenseManager.UsageMode == LicenseUsageMode.Runtime) { this.ServiceProvider = serviceProvider; this.FontService = this.ServiceProvider.GetService <IFontService>(); this.UIService = this.ServiceProvider.GetService <IUIService>(); this.Database = this.ServiceProvider.GetService <IDatabase>(); this.ItemProvider = this.ServiceProvider.GetService <IItemProvider>(); this.PlayerCollectionProvider = this.ServiceProvider.GetService <IPlayerCollectionProvider>(); this.GamePathResolver = this.ServiceProvider.GetService <IGamePathService>(); this.titleFont = FontService.GetFontAlbertusMTLight(9.5F); InitForm(); } }
private int _itemsPerRow = 3; // TODO(deccer): add config public MapLandBrowserWindow( IItemProvider itemProvider, TileDataProvider tileDataProvider, MapTileDetailWindow mapTileDetailWindow, MapTilePreviewWindow mapTilePreviewWindow) : base("Lands") { _itemProvider = itemProvider; _tileDataProvider = tileDataProvider; _mapTileDetailWindow = mapTileDetailWindow; _mapTilePreviewWindow = mapTilePreviewWindow; _landTexturesMap = new Dictionary <Texture2D, IntPtr>(); _landIdMap = new Dictionary <IntPtr, int>(); _landNameMap = new Dictionary <int, string>(); _landNameFilter = string.Empty; }
public SelectPacketHandler(IAdapter adapter, IGenericDao <CharacterDto> characterDao, ILogger logger, IItemProvider itemProvider, IMapInstanceProvider mapInstanceProvider, IGenericDao <IItemInstanceDto> itemInstanceDao, IGenericDao <InventoryItemInstanceDto> inventoryItemInstanceDao, IGenericDao <StaticBonusDto> staticBonusDao, IGenericDao <QuicklistEntryDto> quickListEntriesDao, IGenericDao <TitleDto> titleDao) { _adapter = adapter; _characterDao = characterDao; _logger = logger; _mapInstanceProvider = mapInstanceProvider; _itemProvider = itemProvider; _itemInstanceDao = itemInstanceDao; _inventoryItemInstanceDao = inventoryItemInstanceDao; _staticBonusDao = staticBonusDao; _quickListEntriesDao = quickListEntriesDao; _titleDao = titleDao; }
public override void Dispose() { base.Dispose(); IItemProvider itemProvider = _itemProvider; _itemProvider = null; if (itemProvider != null) { MPF.TryCleanupAndDispose(itemProvider); } itemProvider = _newItemProvider; _newItemProvider = null; if (itemProvider != null) { MPF.TryCleanupAndDispose(itemProvider); } }
public void CreatePortionerControl(IItemProvider itemProvider, uint nBins) { var ctrlLog = new FileTextLog("c:\\PortionerCtrlLog.txt"); var binLog = new SimpleTextLog(); //var binLog = new ConsoleLog(); var control = new Control(itemProvider, ctrlLog, new BinScorePortioningAlgorithm()); var scorer = new MultipleOfMeanItemScorer(125); for (uint i = 0; i < nBins; i++) { control.AddBin(new Bin(i, 2000, binLog) { ItemScorer = scorer }); } }
public void Setup() { var items = new List <ItemDto> { new Item { VNum = 1, ItemType = ItemType.Magical, Type = NoscorePocketType.Etc, Effect = ItemEffectType.Speaker }, }; _itemProvider = new ItemProvider(items, new List <IEventHandler <Item, Tuple <InventoryItemInstance, UseItemPacket> > >()); _session = TestHelpers.Instance.GenerateSession(); _logger = new Mock <ILogger>(); _handler = new SpeakerGuriHandler(_logger.Object); Broadcaster.Instance.LastPackets.Clear(); }
/// <summary> /// Initializes a new instance of the <see cref="Item"/> class with the specified Fully Qualified Name, source Item, /// source FQN, access mode and provider. /// </summary> /// <param name="fqn">The Fully Qualified Name of the Item to create.</param> /// <param name="sourceItem">The source Item.</param> /// <param name="sourceFQN">The Fully Qualified Name of the source Item.</param> /// <param name="accessMode">The access mode of the Item.</param> /// <param name="provider">The Item Provider from which the Item originates.</param> private Item(string fqn, Item sourceItem = default(Item), string sourceFQN = "", ItemAccessMode accessMode = ItemAccessMode.ReadWrite, IItemProvider provider = default(IItemProvider)) { FQN = fqn; SourceItem = sourceItem; SourceFQN = SourceItem == default(Item) ? sourceFQN : SourceItem.FQN; AccessMode = accessMode; Provider = provider; Value = default(object); Timestamp = default(DateTime); Quality = ItemQuality.Uninitialized; Guid = Guid.NewGuid(); Lock = new ReaderWriterLockSlim(); Children = new List <Item>(); }
public ProviderVM(IItemProvider provider) { _provider = provider; }
public void SetItemProvider(IItemProvider itemProvider) { if (_elementState == ElementState.Running) lock (Children.SyncRoot) { if (_newItemProvider == itemProvider) return; if (_newItemProvider != null) MPF.TryCleanupAndDispose(_newItemProvider); _newItemProvider = null; if (_itemProvider == itemProvider) return; _newItemProvider = itemProvider; } else { if (_newItemProvider == itemProvider) return; if (_newItemProvider != null) MPF.TryCleanupAndDispose(_newItemProvider); _newItemProvider = null; if (_itemProvider == itemProvider) return; if (_itemProvider != null) MPF.TryCleanupAndDispose(_itemProvider); _itemProvider = itemProvider; } InvalidateLayout(true, true); }
public ShellFolderVM(IItemProvider provider, ContainerVM parent, ShellFolder folder) : base(provider, parent, folder.GetDisplayName(DisplayNameType.Default), false) { Folder = folder; Util.FillCommonData(folder, MetaData); }
protected FrameworkElement GetItem(int childIndex, IItemProvider itemProvider, bool forceMeasure) { lock (Children.SyncRoot) { bool newlyCreated; FrameworkElement item = itemProvider.GetOrCreateItem(childIndex, this, out newlyCreated); if (item == null) return null; if (newlyCreated) { // VisualParent and item.Screen were set by the item provider item.SetElementState(ElementState.Preparing); if (_elementState == ElementState.Running) item.SetElementState(ElementState.Running); } if (newlyCreated || forceMeasure) { SizeF childSize = Orientation == Orientation.Vertical ? new SizeF((float) ActualWidth, float.NaN) : new SizeF(float.NaN, (float) ActualHeight); item.Measure(ref childSize); } return item; } }
protected override SizeF CalculateInnerDesiredSize(SizeF totalSize) { FrameworkElementCollection children = Children; lock (children.SyncRoot) { if (_newItemProvider != null) { if (children.Count > 0) children.Clear(false); if (_itemProvider != null) MPF.TryCleanupAndDispose(_itemProvider); _itemProvider = _newItemProvider; _newItemProvider = null; _updateRenderOrder = true; } _averageItemSize = 0; IItemProvider itemProvider = ItemProvider; if (itemProvider == null) return base.CalculateInnerDesiredSize(totalSize); int numItems = itemProvider.NumItems; if (numItems == 0) return new SizeF(); SizeF resultSize; // Get all viewable children (= visible children inside our range) IList<FrameworkElement> exemplaryChildren = GetMeasuredViewableChildren(totalSize, out resultSize); if (exemplaryChildren.Count == 0) { // Might be the case if no item matches into totalSize. Fallback: Use the first visible item. for (int i = 0; i < numItems; i++) { FrameworkElement item = GetItem(i, itemProvider, true); if (item == null || !item.IsVisible) continue; exemplaryChildren.Add(item); } } if (exemplaryChildren.Count == 0) return new SizeF(); _averageItemSize = GetExtendsInOrientationDirection(Orientation, resultSize) / exemplaryChildren.Count; return Orientation == Orientation.Vertical ? new SizeF(resultSize.Width, resultSize.Height * numItems / exemplaryChildren.Count) : new SizeF(resultSize.Width * numItems / exemplaryChildren.Count, resultSize.Height); } }
public UserController(IItemProvider itemProvider) { _itemProvider = itemProvider; }
public MenuController(IItemProvider itemProvider) { _itemProvider = itemProvider; }
protected override SizeF CalculateInnerDesiredSize(SizeF totalSize) { FrameworkElementCollection children = Children; lock (Children.SyncRoot) { if (_newItemProvider != null) { if (children.Count > 0) children.Clear(false); if (_itemProvider != null) MPF.TryCleanupAndDispose(_itemProvider); _itemProvider = _newItemProvider; _newItemProvider = null; _updateRenderOrder = true; } _assumedLineExtendsInNonOrientationDirection = 0; IItemProvider itemProvider = ItemProvider; if (itemProvider == null) return base.CalculateInnerDesiredSize(totalSize); int numItems = itemProvider.NumItems; if (numItems == 0) return new SizeF(); // CalculateInnerDesiredSize is called before ArrangeChildren! // under the precondition that all items use the same template and are equally sized // calulate just one line to find number of items and required size of a line LineMeasurement exemplaryLine = _firstArrangedLineIndex < 0 ? CalculateLine(0, totalSize, false) : _arrangedLines[_firstArrangedLineIndex]; _assumedLineExtendsInNonOrientationDirection = exemplaryLine.TotalExtendsInNonOrientationDirection; var itemsPerLine = exemplaryLine.EndIndex - exemplaryLine.StartIndex + 1; var estimatedExtendsInNonOrientationDirection = (float)Math.Ceiling((float)numItems / itemsPerLine) * _assumedLineExtendsInNonOrientationDirection; return Orientation == Orientation.Horizontal ? new SizeF(exemplaryLine.TotalExtendsInOrientationDirection, estimatedExtendsInNonOrientationDirection) : new SizeF(estimatedExtendsInNonOrientationDirection, exemplaryLine.TotalExtendsInOrientationDirection); } }
//public KeyVM(IItemProvider provider, ContainerVM parent, string name) // : base(provider, parent, name, false) //{ //} public KeyVM(IItemProvider provider, ContainerVM parent, RegistryKey key) : base(provider, parent, Path.GetFileName(key.Name), false) { _key = key; }
public ShellFileVM(IItemProvider provider, ContainerVM parent, ShellFile file) : base(provider, parent, file.GetDisplayName(DisplayNameType.Default), false) { File = file; Util.FillCommonData(file, MetaData); }
public ComputerVM(IItemProvider provider) : this(provider, null) { }
public RequestArgs(HttpContext httpContext, IItemProvider itemProvider, LightcoreOptions options) { HttpContext = httpContext; Options = options; ItemProvider = itemProvider; }