Merge branch 'master' of https://codefirst.iut.uca.fr/git/remi.arnal/blazor
continuous-integration/drone/push Build is passing Details

master
remrem 2 years ago
commit c973844f4a

@ -3,7 +3,7 @@
<h3>Inventory</h3>
<CascadingValue Value="@this">
<div class="css-grid">
@for(int i = 0; i<InventoryList.size;i++)
@for(int i = 0; i<Models.InventoryList.size;i++)
{
@if (inventory.inventoryItems[i] != null)
{

@ -7,7 +7,8 @@ namespace Blazor.Components
{
partial class Inventory
{
public InventoryItem CurrentDragItem { get; set; }
public Models.InventoryList inventory = new Models.InventoryList();
public Models.InventoryItem CurrentDragItem { get; set; }
public ObservableCollection<InventoryAction> Actions { get; set; }
public Inventory()
@ -20,8 +21,6 @@ namespace Blazor.Components
return;
}
[Parameter]
public InventoryList inventory { get; set; }
}
}

@ -4,13 +4,13 @@ namespace Blazor.Components
{
public class InventoryAction
{
public InventoryAction(String ac, int num,ItemInventory objet) {
public InventoryAction(String ac, int num,Item objet) {
Action = ac;
Index = num;
Item = objet;
}
public string Action { get; set; }
public int Index { get; set; }
public ItemInventory Item { get; set; }
public Item Item { get; set; }
}
}

@ -10,7 +10,7 @@
Responsive>
<DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="#" Width="15%"/>
<DataGridColumn TItem="Item" Field="@nameof(Item.Id)" Caption="Image" Filterable="false">
<DisplayTemplate >
<DisplayTemplate>
@if (!string.IsNullOrWhiteSpace(context.ImageBase64))
{
<img src="data:image/png;base64, @(context.ImageBase64)" class="img-thumbnail" title="@context.DisplayName" alt="@context.DisplayName" style="width: 60px" />

@ -29,12 +29,34 @@ namespace Blazor.Components
[Inject]
public IStringLocalizer<InventoryList> Localizer { get; set; }
protected override async Task OnInitializedAsync()
[CascadingParameter]
public Inventory Parent { get; set; }
public void OnDragStart()
{
}
public void OnDrop()
{
Parent.CurrentDragItem = null;
return;
}
internal void OnDragEnter()
{
Parent.Actions.Add(new InventoryAction("Drag Enter", this.items[0].Id, items[0]));
}
internal void OnDragLeave()
{
Parent.Actions.Add(new InventoryAction("Drag Leave", this.items[0].Id, items[0]));
}
protected override async Task OnInitializedAsync()
{
items = await DataService.getAll();
totalItem = await DataService.Count();
await base.OnInitializedAsync();
}
}
}

@ -28,7 +28,7 @@ namespace Blazor.Components
Parent.CurrentDragItem = this.Items;
Parent.inventory.inventoryItems[this.Index] = null;
this.NoDrop = false;
Parent.Actions.Add(new InventoryAction("On drag start",this.Index,this));
Parent.Actions.Add(new InventoryAction("On drag start",this.Index,Items.item));
Parent.update();
}
@ -40,7 +40,7 @@ namespace Blazor.Components
this.Items = Parent.CurrentDragItem;
NoDrop = true;
Parent.CurrentDragItem = null;
Parent.Actions.Add(new InventoryAction("On Drop",this.Index,this));
Parent.Actions.Add(new InventoryAction("On Drop",this.Index,Items.item));
return;
}
if(Parent.CurrentDragItem == null)
@ -52,7 +52,7 @@ namespace Blazor.Components
this.Items = Parent.CurrentDragItem;
this.NoDrop= true;
Parent.CurrentDragItem = null;
Parent.Actions.Add(new InventoryAction("On drag start",this.Index,this));
Parent.Actions.Add(new InventoryAction("On drag start",this.Index,Items.item));
return;
}
else
@ -61,7 +61,7 @@ namespace Blazor.Components
if (total >this.Items.item.StackSize)
{
this.Items.Stack = this.Items.item.StackSize;
Parent.Actions.Add(new InventoryAction("On drag start",this.Index,this));
Parent.Actions.Add(new InventoryAction("On drag start",this.Index,Items.item));
return;
}
else
@ -73,12 +73,12 @@ namespace Blazor.Components
}
internal void OnDragEnter()
{
Parent.Actions.Add(new InventoryAction("Drag Enter",this.Index,this));
Parent.Actions.Add(new InventoryAction("Drag Enter",this.Index,Items.item));
}
internal void OnDragLeave()
{
Parent.Actions.Add(new InventoryAction("Drag Leave",this.Index,this));
Parent.Actions.Add(new InventoryAction("Drag Leave",this.Index,Items.item));
}
}
}

@ -1,5 +1,5 @@
@page "/"
@using Blazor.Components;
<div>
<Inventory inventory="inventory"/>
<Blazor.Components.Inventory inventory="inventory"/>
</div>

@ -7,12 +7,6 @@ namespace Blazor.Pages
{
public partial class Index
{
/* TEST */
InventoryList inventory = new InventoryList();
[Inject]
public IDataService DataService { get; set; }

@ -8,7 +8,9 @@
<div id="master">
<div class="inventory">
<span>Ici c'est l'inventaire</span>
<span>
<Blazor.Components.Inventory/>
</span>
</div>

Loading…
Cancel
Save